cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically update prices of item conditions in Sales Order, BAPI_SALESORDER_CHANGE

former_member188019
Active Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member194575
Active Participant
0 Kudos

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.

former_member188019
Active Participant
0 Kudos

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

former_member194575
Active Participant
0 Kudos

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

Answers (0)