Skip to Content
0
Former Member
Apr 24, 2007 at 05:19 PM

bapi_salesorder_change

14 Views

hi experts,

iam using "bapi_salesorder_change" to change the quantity of a material entered in the sales order, the following i have written in a report program to update .The return table messages me that the sales order has been changed and successfully updated but when i check the document its not get updated. please help me to solve the problem..

data: is_header type BAPISDH1, " HEADER STRUCTURE

is_headerx type BAPISDH1X, " UPDATE FLAG SET HERE

SALESDOCUMENT LIKE BAPIVBELN-VBELN . " SALES ORDER NUMBER

data: com_cod type table of BAPISDH1 initial size 0,

com_cod1 type BAPISDH1,

it_return type table of BAPIRET2 initial size 0,

WA_RETURN LIKE BAPIRET2 ,

it_poitem type table of BAPISDITM initial size 0 ,

it_poitem1 type BAPISDITM,

it_poitemx type table of BAPISDITMX initial size 0 ,

it_poitemx1 type BAPISDITMX,

it_poshed type table of BAPISCHDL initial size 0 ,

it_poshed1 type BAPISCHDL,

it_poshedx type table of BAPISCHDLX initial size 0 ,

it_poshedx1 type BAPISCHDLX.

SALESDOCUMENT = '0000011548' .

IS_HEADER-SALES_ORG = '1000' .

IS_HEADER-DISTR_CHAN = '10' .

IS_HEADER-DIVISION = '00' .

IS_HEADERX-UPDATEFLAG = 'U' .

IT_POITEM1-ITM_NUMBER = '000010' .

IT_POITEM1-MATERIAL = 'M-20' .

IT_POITEM1-TARGET_QTY = '0000000000020' .

APPEND IT_POITEM1 TO IT_POITEM .

IT_POITEMX1-ITM_NUMBER = '000010' .

IT_POITEMX1-UPDATEFLAG = 'U' .

IT_POITEMX1-MATERIAL = 'X' .

IT_POITEMX1-TARGET_QTY = 'X' .

APPEND IT_POITEMX1 TO IT_POITEMX .

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = SALESDOCUMENT

ORDER_HEADER_IN = IS_HEADER

order_header_inx = IS_HEADERX

tables

return = IT_RETURN

ORDER_ITEM_IN = IT_POITEM

ORDER_ITEM_INX = IT_POITEMX

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = space

  • IMPORTING

  • RETURN =

.

LOOP AT IT_RETURN INTO WA_RETURN .

WRITE :/ WA_RETURN-MESSAGE .

ENDLOOP .

with regards,

James....

valuable answers will be rewarded....