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: 

BAPI_SALESORDER_CHANGE not updating database

Former Member
0 Kudos
828

Hi,

I am using BAPI_SALESORDER_CHANGE to change the target quantity ( ZMENG ) of the Standard sales order.

I am getting no error message in the bapi return table but the data is not getting updated in the database.

I am also calling commit work 'BAPI_transaction_Commit'. Please let me know if there is an alternative to this BAPI. I have tried BAPI_SALESDOCUMENT_CHANGE also.

thanks,

Hitanshu

2 REPLIES 2

Former Member
0 Kudos
106

Hi Himanshu,

I have a feeling that you may not be filling in all the details required. Just ckeck out if you are filling out

TARGET_QTY and TARGET_QU in the tables parameter ORDER_ITEM_INX, for the relevant item.

If your problem is still not resolved, please let us know which version of SAP you're using.

Regards,

Anand Mandalika.

johan_geraedts
Explorer
0 Kudos
106

Hitanshu,

You need to use as well the schedule line table and change the qty overthere. Did you use the schedule_linesx and order_item_inx to tell which fields you want to update?

Example code:

orderch_header_inx-updateflag = 'U'.

orderch_item_in-itm_number = it_vbap_old-posnr.

orderch_item_inx-itm_number = it_vbap_old-posnr.

orderch_item_inx-updateflag = 'U'.

APPEND : orderch_item_in, orderch_item_inx.

orderch_header_inx-updateflag = 'U'.

schedulech_lines-itm_number = it_vbap_old-posnr.

schedulech_lines-sched_line = '0001'.

schedulech_linesx-itm_number = it_vbap_old-posnr.

schedulech_lines-req_qty = it_vbap-kwmeng.

schedulech_linesx-sched_line = '0001'.

schedulech_linesx-req_qty = 'X'.

schedulech_linesx-updateflag = 'U'.

APPEND : schedulech_lines, schedulech_linesx.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = order_number

order_header_in = orderch_header_in

order_header_inx = orderch_header_inx

  • SIMULATION =

  • BEHAVE_WHEN_ERROR = ' '

  • INT_NUMBER_ASSIGNMENT = ' '

  • LOGIC_SWITCH =

TABLES

return = return

order_item_in = orderch_item_in

order_item_inx = orderch_item_inx

  • PARTNERS =

partnerchanges = partnerch

  • PARTNERADDRESSES =

  • ORDER_CFGS_REF =

  • ORDER_CFGS_INST =

  • ORDER_CFGS_PART_OF =

  • ORDER_CFGS_VALUE =

  • ORDER_CFGS_BLOB =

  • ORDER_CFGS_VK =

  • ORDER_CFGS_REFINST =

schedule_lines = schedulech_lines

schedule_linesx = schedulech_linesx

  • ORDER_TEXT =

  • ORDER_KEYS =

  • CONDITIONS_IN =

  • CONDITIONS_INX =

  • EXTENSIONIN =

.