Skip to Content
0

Programmatically update prices of item conditions in Sales Order, BAPI_SALESORDER_CHANGE

Apr 13, 2017 at 10:28 AM

374

avatar image

Hi all,

we are trying to programmatically update prices of item conditions in Sales Order.

what we do manually is:


for this we are writing a program using function module: BAPI_SALESORDER_CHANGE
at item level, there i could not found any paratmeter to update to 'G'.
also there is one export parameter LOGIC_SWITCH-PRICING, but it is not working.

I checked in scn, but could not help.

is there any way, we can update pricing using pricing type 'G' using Bapi or batch mode.

Madhu_1980

clipboard01.jpg (213.9 kB)
clipboard02.jpg (65.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Shanthi Kumar Juluru Apr 13, 2017 at 11:56 AM
0

Dear Madhu,

I am not sure what is your business requirements here. But you don't need to write a program and call BAPI to redetermine the prices. Just add a line code in MV45AFZB program as below.

FORM USEREXIT_NEW_PRICING_VBAP CHANGING NEW_PRICING.

new_pricing = 'G'.

ENDFORM.

This will redetermine the price for each item automatically. You can write any conditions or logic in the same for itself.

But if you want to make this happen with BAPI, please follow the below thread.

https://archive.sap.com/discussions/thread/617361

Let me know if you have any questions.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

thanks.

>>I am not sure what is your business requirements here.

We want this program to update the pricing of our selected SOs whenever we execute this program, and this need not be called everytime the SO gets saved for all SOs, so we are avoiding the user exit.

The following code worked for us.

PARAMETERS: p_vbeln TYPE vbeln_va OBLIGATORY.
DATA:
lv_salesdocument LIKE bapivbeln-vbeln,
ls_order_header_inx TYPE bapisdh1x,
ls_logic_switch TYPE bapisdls,
ls_return TYPE bapiret2,
ls_order_item_in TYPE bapisditm,
ls_order_item_inx TYPE bapisditmx,
lt_return TYPE TABLE OF bapiret2,
lt_order_item_in TYPE TABLE OF bapisditm,
lt_order_item_inx TYPE TABLE OF bapisditmx.
""""""""""""""""""""""""""""""""""""""""""""""""""""
lv_salesdocument = p_vbeln.
ls_order_header_inx-updateflag = 'U'.
ls_logic_switch-pricing = 'G'.
ls_order_item_in-itm_number = '10'.
ls_order_item_inx-itm_number = '10'.
ls_order_item_inx-updateflag = 'U'.
APPEND ls_order_item_in TO lt_order_item_in.
APPEND ls_order_item_inx TO lt_order_item_inx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = lv_salesdocument
order_header_inx = ls_order_header_inx
logic_switch = ls_logic_switch
TABLES
return = lt_return
order_item_in = lt_order_item_in
order_item_inx = lt_order_item_inx
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = abap_true
IMPORTING
return = ls_return.

Thanks,

Madhu_1980

0

This can be done with VA05 report as well. It will redetermine prices for selected open sales orders. Please check.

0