Skip to Content
0
Jan 09, 2008 at 01:37 PM

BAPI_SALESORDER_CHANGE - item quantity not being set

379 Views

I am using BAPI_SALESORDER_CHANGE to add line items to a sales order. Everything works great except the quantity is not being saved into the sales order. I tried passing the quantity when creating the line item and that didn't work. Then I tried updating the quantity after creating the line item but the sales order is locked because the data is incomplete (quantity is missing). I have tried sending the UoM and that doesn't work. Does anybody have any idea what I can do? Also, if I send the UoM in item-target_qu will that override (or cause a conversion to) the sales unit?

Below is what I am passing:

header-sd_doc_cat = 'C'.

headerx-updateflag = 'U'.

schedule-itm_number = items-posnr.

schedulex-itm_number = 'X'.

schedule-sched_line = '0001'.

schedulex-sched_line = 'X'.

schedule-req_date = items-req_date.

schedulex-req_date = 'X'.

schedule-req_qty = items-zmeng.

schedulex-req_qty = 'X'.

schedulex-updateflag = 'I'.

item-itm_number = items-posnr.

itemx-itm_number = items-posnr.

item-material = items-matnr.

itemx-material = 'X'.

item-plant = items-werks.

itemx-plant = 'X'.

items-zmeng = items-zmeng * 1000.

item-target_qty = items-zmeng.

itemx-target_qty = 'X'.

itemx-updateflag = 'I'.

  • item-target_qu = 'EA'.

  • item-target_qu = 'X'.

APPEND: schedule, schedulex, item, itemx.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = items-vbeln

order_header_in = header

order_header_inx = headerx

  • SIMULATION =

behave_when_error = 'P'

  • INT_NUMBER_ASSIGNMENT = ' '

  • LOGIC_SWITCH =

  • NO_STATUS_BUF_INIT = ' '

TABLES

return = return

order_item_in = item

order_item_inx = itemx

  • PARTNERS =

  • PARTNERCHANGES =

  • 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 = schedule

schedule_linesx = schedulex

  • ORDER_TEXT =

  • ORDER_KEYS =

  • CONDITIONS_IN =

  • CONDITIONS_INX =

  • EXTENSIONIN =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Regards,

Davis