2024 Mar 08 4:44 AM - edited 2024 Mar 08 4:45 AM
Hello All , I want to change sales order line item material through BAPI_SALESORDER_CHANGE , I have written all those required ABAP codes , but still am getting an error : "Field 'MATNR' cannot be changed, VBAPKOM 000010 ready for input"
Kindly guide me the steps to achieve this .
Screenshot :
#SAPABAP #ABAP #BAPI
Request clarification before answering.
When You are using BAPI_SALESORDER_CHANGE You need to fulfil table order_item_in and then change value and mark this change (X for field which You are changing) and update flag in table order_item_inx. Also You need to set update flag in the header.
Example code of changing rejection reason (in Your case You need to do analogic changes for MATNR
ORDER_HEADER_INX-UPDATEFLAG = "U"
ORDER_ITEM_IN- ITM_NUMBER = "000010".
ORDER_ITEM_IN-MATERIAL = material_number
ORDER_ITEM_INX-ITM_NUMBER = "000010"..
ORDER_ITEM_INX-UPDATEFLAG = "U".
ORDER_ITEM_INX-MATERIAL = "X".)
SELECT * FROM vbap INTO TABLE @DATA(lt_vbap_delv)
WHERE vbeln = '100000002'
AND abgru = ''
AND uepos = '000000'
AND ( LFGSA = 'A' OR LFGSA = 'B' ).
LOOP AT lt_vbap_delv INTO DATA(ls_vbap_delv).
APPEND INITIAL LINE TO order_item_in ASSIGNING FIELD-SYMBOL(<it_in_dlv>).
<it_in_dlv>-itm_number = ls_vbap_delv-posnr.
<it_in_dlv>-reason_rej = 'Z1'.
APPEND INITIAL LINE TO order_item_inx ASSIGNING FIELD-SYMBOL(<it_in_dlvx>).
<it_in_dlvx>-itm_number = <it_in_dlv>-itm_number.
<it_in_dlvx>-reason_rej = 'X'.
<it_in_dlvx>-updateflag = 'U'.
ENDLOOP.
order_header_inx-updateflag = 'U'.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = '100000002'
order_header_inx = order_header_inx
TABLES
return = return
order_item_in = order_item_in
order_item_inx = order_item_inx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.