02-12-2016 11:42 AM
Hi Experts,
I am using this FM CSAP_MAT_BOM_MAINTAIN to create alternate BOM. My business requirement is -
MATNR | WERKS | STLAN | STLNR | STLAL | LOSVN | LOSBS | ANDAT | ANNAM |
39130101 | GB39 | 1 | 16 | 4 | 0 | 0 | 04.02.2016 | ASAMANTA |
39130101 | GB39 | 1 | 16 | 5 | 0 | 0 | 04.02.2016 | ASAMANTA |
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.
02-12-2016 12:11 PM
Have you checked the table STKO to verify the message whether it is true?
02-12-2016 3:20 PM
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.
02-12-2016 3:24 PM
Did you passFL_COMMIT_AND_WAIT?
Could share the piece of code you are implementing?
02-12-2016 3:54 PM
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.
02-12-2016 3:58 PM
Try by using fm 'BAPI_TRANSACTION_COMMIT' in sequence to the above fm.
02-12-2016 4:22 PM
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.
02-12-2016 4:58 PM
02-12-2016 5:26 PM
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.
02-13-2016 8:33 AM
Try to use CEWB FMs - SAP note 488765 "Do-it-yourself EWB programming", they are really powerful once you know them.
cheers
Łukasz
06-22-2023 12:47 AM
How you resolved this issue can you please help with correct BAPI name .I am facing the same issue.