Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CSAP_MAT_BOM_MAINTAIN

arindam_samanta
Participant
0 Kudos

Hi Experts,

I am using this FM CSAP_MAT_BOM_MAINTAIN to create alternate BOM. My business requirement is -

MATNRWERKSSTLANSTLNRSTLALLOSVNLOSBSANDATANNAM
39130101GB3911640004.02.2016ASAMANTA
39130101GB3911650004.02.2016ASAMANTA

through this FM I can create first entry with alternate BOM 4 but when I am trying to create 2nd entry with alternate BOM 5 it is throwing error  "BOM already exists for 39130101 GB39 5".

Is there any way to avoid this or is there any FM to fulfill my business requirement.

Kindly suggest me. Thanks in advance!

Regards,

Arindam Samanta.

10 REPLIES 10

jogeswararao_kavala
Active Contributor
0 Kudos

Have you checked the table STKO to verify the message whether it is true?

0 Kudos

Hi Jogeswara,

I have checked the table STKO. It does not have any record with alternate BOM 5. But it has the record with 4.

My business requirement is - Need to create alternate BOM for a material for the same plant & BOM usage. Also I need to pass the change number for creating alternate BOM. This is not happening.

Need help in this area!

Thanks & Regards,

Arindam Samanta.

0 Kudos

Did you passFL_COMMIT_AND_WAIT?

Could share the piece of code you are implementing?

0 Kudos

Hi Simone,

I am sharing my code -

I_MATNR = '000000000034547011'.

I_WERKS = 'GB39'.

I_STLAN = '1'.

I_STLAL = '05'.

I_DATUV = '29.01.2016'.

WA_STPO-ITEM_NO = '0010'.

WA_STPO-COMP_QTY = '7.000'.

APPEND WA_STPO TO I_STPO.

CALL FUNCTION 'CSAP_MAT_BOM_MAINTAIN'

  EXPORTING

   MATERIAL                  = I_MATNR

   PLANT                     = I_WERKS

   BOM_USAGE                 = I_STLAN

   ALTERNATIVE               = I_STLAL

   VALID_FROM                = I_DATUV

   CHANGE_NO                 = '500000000040'

   I_STKO                    = I_STKO_API01

   FL_COMMIT_AND_WAIT        = 'X'

   FL_BOM_CREATE             = 'X'

   FL_DEFAULT_VALUES         = 'X'

IMPORTING

   FL_WARNING                = I_WAR

   O_STKO                    = I_STKO

TABLES

   T_STPO                    = I_STPO

EXCEPTIONS

   ERROR                     = 1

*   OTHERS                    = 2

          .

IF SY-SUBRC <> 0.

* Implement suitable error handling here

ENDIF.

As I said, This code is working for my first entry but when I am trying to create altrnate BOM 5 with passing same values, It is showing the error.

Could you please suggest on this?

Thanks & regards,

Arindam Samanta.

0 Kudos

Try by using fm  'BAPI_TRANSACTION_COMMIT'  in sequence to the above fm.

0 Kudos

Hi,

My first FM returning SY-SUBRC is 1. After that if I will call the BAPI_TRNSACTION_COMMIT, It will not make the new entry in table.

Thanks & Regards,

Arindam Samanta.

0 Kudos

Try to debug to find where the issue is raised

0 Kudos

Hi Simone,

I have found. This FM calling another FM CS_DI_HEADER_OBJECT_CHECK.

Inside this FM, flg_no_alt_create contains X. This is not allowing to create my 2nd entry.


Thanks & Regards,

Arindam Samanta.

0 Kudos

Try to use CEWB FMs - SAP note 488765 "Do-it-yourself EWB programming", they are really powerful once you know them.

cheers

Łukasz

kishoreale
Member
0 Kudos

How you resolved this issue can you please help with correct BAPI name .I am facing the same issue.