Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

BAPI_SALESORDER_CHANGE

hi experts,

i am using the bapi BAPI_SALESORDER_CHANGE to update a sales order by adding new line item to the sales order... it is adding the new line item but the problem is that it is not taking into consideration the order quantity...

am passing the data as follows:

import

SALESDOCUMENT = sales document number (5488)

ORDER_HEADER_INX-UPDATEFLAG = 'U'

tables

ORDER_ITEM_IN-MATERIAL = matnr (12871)

ORDER_ITEM_IN-TARGET_QTY = 75

then i run the bapi BAPI_TRANSACTION_COMMIT

the sales order is updated with the new line item but order quantity remains blank...

please help me on this..

points will be rewarded..

regards,

vitish

Tags:
Former Member replied

Hi,

Check this sample code to update quantity.

DATA: T_ITEM LIKE BAPISDITM OCCURS 0 WITH HEADER LINE.
DATA: T_ITEMX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.
DATA: T_SCHE LIKE BAPISCHDL OCCURS 0 WITH HEADER LINE.
DATA: T_SCHEX LIKE BAPISCHDLX OCCURS 0 WITH HEADER LINE.
DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
DATA: BAPISDH1X LIKE BAPISDH1X.

PARAMETERS: P_VBELN LIKE VBAK-VBELN OBLIGATORY.
PARAMETERS: P_KWMENG LIKE VBAP-KWMENG OBLIGATORY.

BAPISDH1X-UPDATEFLAG = 'U'.

T_ITEM-ITM_NUMBER = '000010'.
APPEND T_ITEM.

T_ITEMX-ITM_NUMBER = '000010'.
T_ITEMX-UPDATEFLAG = 'U'.
APPEND T_ITEMX.


T_SCHE-ITM_NUMBER = '000010'.
T_SCHE-SCHED_LINE = '0001'.
T_SCHE-REQ_QTY = P_KWMENG.
APPEND T_SCHE.

T_SCHEX-ITM_NUMBER = '000010'.
T_SCHEX-SCHED_LINE = '0001'.
T_SCHEX-REQ_QTY = 'X'.
APPEND T_SCHEX.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = P_VBELN
order_header_inx = BAPISDH1X
tables
return = T_RETURN
ORDER_ITEM_IN = T_ITEM
ORDER_ITEM_INX = T_ITEMX
SCHEDULE_LINES = T_SCHE
SCHEDULE_LINESX = T_SCHEX
.

COMMIT WORK.

Thanks

naren

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question