Hi All,
Could any one of you plz provide the solution for the below problem:
1) I am processing the BAPI_SALESORDER_CHANGE to MODIFy the Quantity of existing line item and simultaneously INSERT a New ITEM.
2) When I am only modifying the REQ_QTY of 2 or more items it is processing correctly.
3) And if i INSERT a new item then it is INSERTING all fields correctly.
BUT if I both MODIFY the quantity of line item AND INSERT a new item .The Quantity of existing item is getting Updated Correctly.
BUT the Quanity of new Item is not the Quantity we send through the IDOC it is showing some different Quantity.
I am filling the following fields in my code :
For MODIFYING an existing Line Item QUANTITY:
wa_item_bapi-sales_unit = 'CT'.
wa_item_bapi-itm_number = '156'.
APPEND wa_item_bapi TO i_item_bapi.
*********UPDATE i_item_BAPIX
wa_item_bapix-itm_number = '156'.
wa_item_bapix-updateflag = c_u.
wa_item_bapix-sales_unit = c_x.
APPEND wa_item_bapix TO i_item_bapix.
wa_schedule-itm_number = lv_posnr.
wa_schedule-sched_line = '0001'.
wa_schedule-req_qty = 15.
wa_schedule-sched_type = CN.
APPEND wa_schedule TO i_schedule.
**UPDATE i_scheduleX
wa_schedulex-itm_number = 156.
wa_schedulex-sched_line = 0001.
wa_schedulex-sched_type = c_x.
wa_schedulex-updateflag = c_u.
wa_schedulex-req_qty = c_x.
APPEND wa_schedulex TO i_schedulex.
After this I am passing these internal tables to BAPI_SALESORDER_CHANGE
For INSERTING a NEW LINE ITEM.
wa_item_bapi-sales_unit = 'CT'.
wa_item_bapi-itm_number = '157'.
wa_item_bapi-hg_lv_item = '156'(this field we are passing the item number of existing item in the Salesorder)
wa_item_bapi-po_itm_no = Blank.
wa_item_bapi-material = gv_codmat.
wa_item_bapi-plant = ITPA.
wa_item_bapi-item_categ = 'xxxx'.
APPEND wa_item_bapi TO i_item_bapi.
*UPDATE i_item_BAPIX
wa_item_bapix-updateflag = c_i.
wa_item_bapix-material = c_x.
wa_item_bapix-sales_unit = c_x.
wa_item_bapix-plant = c_x.
wa_item_bapix-item_categ = c_x.
wa_item_bapix-hg_lv_item = c_x.
wa_item_bapix-itm_number = c_x.
wa_item_bapix-po_itm_no = c_x.
APPEND wa_item_bapix TO i_item_bapix.
wa_schedule-itm_number = '157'.
wa_schedule-sched_line = 0001.(this schedule line is that of item existing already in Sales order for item 156)
wa_schedule-sched_type = CN(this schedule type is that of item existing already in Sales order for item 156)
wa_schedule-req_qty = 15.
APPEND wa_schedule TO i_schedule.
*UPDATE i_scheduleX
wa_schedulex-itm_number = '157'.
wa_schedulex-sched_line = 0001(this schedule line is that of item existing already in Sales order for item 156)
wa_schedulex-sched_type = c_x.
wa_schedulex-updateflag = c_i.
wa_schedulex-req_qty = c_x.
APPEND wa_schedulex TO i_schedulex.
Now i process the BAPI_SALESORDER_CHANGE
Could any one plz provide help on it?