‎2009 Jan 16 10:25 AM
Dear All,
I am trying to change the Scheduling dates for a Sales Order using BAPI_SALESORDER_CHANGE.
After executing the BAPI, the retrn code is 0 but the return table has error as "Enter the document number"
Pasting the code for you ref.
wa_orderx-updateflag = 'U'.
wa_orderx-sales_org = 'X'.
wa_orderx-distr_chan = 'X'.
wa_orderx-division = 'X'.
wa_order-sales_org = lv_vkorg.
wa_order-distr_chan = lv_vtweg.
wa_order-division = lv_spart.
wa_bapisditm-itm_number = wa_xvbep-posnr.
APPEND wa_bapisditm TO it_bapisditm.
wa_bapisditmx-itm_number = wa_xvbep-posnr.
wa_bapisditmx-updateflag = 'U'.
APPEND wa_bapisditmx TO it_bapisditmx.
wa_bapischdl-itm_number = wa_xvbep-posnr.
wa_bapischdl-sched_line = wa_xvbep-etenr.
wa_bapischdl-ms_date = wa_xvbep-mbdat.
wa_bapischdl-load_date = wa_xvbep-lddat.
wa_bapischdl-gi_date = wa_xvbep-wadat.
wa_bapischdl-req_date = wa_xvbep-edatu.
APPEND wa_bapischdl TO it_bapischdl.
wa_bapischdlx-itm_number = wa_xvbep-posnr.
wa_bapischdlx-sched_line = wa_xvbep-etenr.
wa_bapischdlx-ms_date = 'X'.
wa_bapischdlx-load_date = 'X'.
wa_bapischdlx-gi_date = 'X'.
wa_bapischdlx-req_date = 'X'.
wa_bapischdlx-updateflag = 'U'.
APPEND wa_bapischdlx TO it_bapischdlx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = lv_vbeln
order_header_in = wa_order
order_header_inx = wa_orderx
TABLES
return = it_bapiret2
order_item_in = it_bapisditm
order_item_inx = it_bapisditmx
schedule_lines = it_bapischdl
schedule_linesx = it_bapischdlx.
All the work areas and variables have values.
Please help me find a solution.
regards,
Jinson
‎2009 Jan 16 10:33 AM
‎2009 Jan 16 10:29 AM
Check while debugging lv_vbeln is not initial.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = lv_vbeln """" Check not initial
order_header_in = wa_order
order_header_inx = wa_orderx
TABLES
return = it_bapiret2
order_item_in = it_bapisditm
order_item_inx = it_bapisditmx
schedule_lines = it_bapischdl
schedule_linesx = it_bapischdlx.
‎2009 Jan 16 10:35 AM
Try populating the quantity field in the schedule line structure of the BAPISCHDL-REQ_QTY as well along with the date fields. That may remove the error.
‎2009 Jan 16 10:46 AM
>
> Try populating the quantity field in the schedule line structure of the BAPISCHDL-REQ_QTY as well along with the date fields. That may remove the error.
Dear Bhaskar,
Tried populating the BAPISCHDL-REQ_QTY field.But still the error is coming.
thanks,
Jinson
‎2009 Jan 16 10:56 AM
Hi
Fill the reference document number field REF_DOC in bapi importing structure BAPISDH1.
I think this will resolve your problem as the sales order change requires this field, if the order created with reference document number.
With Regards,
Dwarakanath.S
‎2009 Jan 16 11:03 AM
Dwarakanath,
I have checked the order again, it was not created with ref doc no.
thanks,
Jinson
‎2009 Jan 16 10:30 AM
Pl. check whether the variable lv_vbeln contains the sales order no. or not. Also pl. post the message id and message no that u r getting in the return table.
‎2009 Jan 16 10:35 AM
Thanks for the quick response.
lv_vbeln is not initial.
and the msg details are as follows.
TYPE E
ID V1
NUMBER 045
MESSAGE Enter the document number
thanks,
Jinson
‎2009 Jan 16 10:55 AM
Hi,
I can only suspect one thing.
You are using this inside a loop endloop. and may be using a control break statement did you check if all values are well in debugging.
santhosh
‎2009 Jan 16 10:58 AM
>
> Hi,
> I can only suspect one thing.
>
> You are using this inside a loop endloop. and may be using a control break statement did you check if all values are well in debugging.
>
> santhosh
No Santosh, I am not using it in a Loop or using any control break statement with it.
thanks,
Jinson.
‎2009 Jan 16 10:33 AM
Hi Jinso,
i think u need pass the order number to evry table then i hope it will not through an error for you.
Thanks,
‎2009 Jan 16 10:33 AM