2011 Oct 11 5:50 PM
Hi,
I need to update pricing date on sales order (but only on item level).
I have been trying to use BAPI_SALESORDER_CHANGE but nothing changes.Bapi returns no errors, ends with success.
I hoped that bapi would change not only pricing date but also recalculate things the date affected.
Here is my code:
ls_head_inx-updateflag = 'U'.
ls_bapisdls-pricing = 'C'.
ls_item-itm_number = sales_order_posnr
ls_item-price_date = new_price_date
APPEND ls_item TO lt_item.
ls_item_inx-itm_number = sales_order_posnr
ls_item_inx-updateflag = 'U'.
ls_item_inx-price_date = 'X'.
APPEND ls_item_inx TO lt_item_inx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = sales_order
order_header_inx = ls_head_inx
logic_switch = ls_bapisdls
TABLES
return = lt_return
order_item_in = lt_item
order_item_inx = lt_item_inx
Thanks & Regards,
Mario
Hi,
I need to update pricing date on sales order (but only on item level).
I have been trying to use BAPI_SALESORDER_CHANGE but nothing changes.Bapi returns no errors, ends with success.
I hoped that bapi would change not only pricing date but also recalculate things the date affected.
Here is my code:
ls_head_inx-updateflag = 'U'.
ls_bapisdls-pricing = 'C'.
ls_item-itm_number = sales_order_posnr
ls_item-price_date = new_price_date
APPEND ls_item TO lt_item.
ls_item_inx-itm_number = sales_order_posnr
ls_item_inx-updateflag = 'U'.
ls_item_inx-price_date = 'X'.
APPEND ls_item_inx TO lt_item_inx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = sales_order
order_header_inx = ls_head_inx
logic_switch = ls_bapisdls
TABLES
return = lt_return
order_item_in = lt_item
order_item_inx = lt_item_inx
Thanks & Regards,
Mario
2011 Oct 12 4:14 AM
Mario,
I run same code as yours and work for me fine, able to update ITEM pricing date.
I suppose you are using BAPI_TRANSACTION_COMMIT after your BAPI call, then only it will work.
Also note that VBKD table stores this date for header and item. In my system, there are generally only header rows in that table, but a new item row gets generated when I change the item date with the BAPI to some other date. Also, this BAPI sometimes issues a W message instead of ERROR for something like non-existing items, so carefully check your RETURN table too.
'Item 000002 does not exist' as WARNING message, so might be considering it as a success.
If nothing works, try to do the same thing for the same data using VA02 and check . If that works, BAPI will work surely.
Regards,
Diwakar
2011 Oct 12 8:08 AM
Hi,
Thanks a lot Diwakar.
The problem was in calling BAPI_SALESORDER_CHANGE. Sorry, but I missed DESTINATION 'NONE' in my earlier post:).
I've removed DESTINATION and now works.
Regards,
Mario