Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Re-Pricing in SALES ORDER using BAPI

0 Likes
13,018

Hi all,

I modified sales order positions using BAPI_SALESORDER_CHANGE, now I need to force re-price type 'C'... I tried adding LOGIC_SWITCH-PRICING = 'C' and LOGIC_SWITCH-COND_HANDL = 'X' but it doesn't work.

I really thank any help.

cya,

dimas.

Hi all,

I modified sales order positions using BAPI_SALESORDER_CHANGE, now I need to force re-price type 'C'... I tried adding LOGIC_SWITCH-PRICING = 'C' and LOGIC_SWITCH-COND_HANDL = 'X' but it doesn't work.

I really thank any help.

cya,

dimas.

14 REPLIES 14
Read only

Maciej_DomagaBa
Contributor
7,329

Make sure you pass CONDITIONS_X parameter table filled properly. Then it should be enough to set LOGIC_SWITCH like this:

  clear LOGIC_SWITCH.
  LOGIC_SWITCH-PRICING = 'C'.

regards

Read only

0 Likes
7,329

What do I have to check???

thanks,

dimas

Read only

0 Likes
7,329

Here's a sample code that fills 1 row of CONDITIONS and CONDITIONS_X to be passed as params for BAPI_SALESORDER_CHANGE:

clear CONDITIONS.
clear CONDITIONS_X.
*               
CONDITIONS_X-UPDATEFLAG = item_cond_operation. " I, U or D 
*               
CONDITIONS-ITM_NUMBER =   QIN_ITEMS-POSNR.
CONDITIONS_X-ITM_NUMBER = CONDITIONS-ITM_NUMBER.
*               
CONDITIONS-COND_ST_NO =   '010'.
CONDITIONS_X-COND_ST_NO = CONDITIONS-COND_ST_NO.
*               
CONDITIONS-COND_COUNT =   '05'.
CONDITIONS_X-COND_COUNT = CONDITIONS-COND_COUNT.
*               
CONDITIONS-COND_TYPE =    'PR00'.
CONDITIONS_X-COND_TYPE =  CONDITIONS-COND_TYPE.
*               
if item_cond_operation <> 'D'.
   CONDITIONS-COND_VALUE = QIN_ITEMS-CENA_KAT. " new price
   CONDITIONS_X-COND_VALUE = 'X'.
endif.
*               
CONDITIONS-CURRENCY =    CURRENCY.
CONDITIONS_X-CURRENCY =  'X'.
*               
append CONDITIONS.
append CONDITIONS_X.

good luck

Read only

0 Likes
7,329

hi,

thanks for your answer but I don't want to make it manually... I want the BAPI to recalculate prices, the same way you do it with VA02...

is there a way to make the BAPI an automatic re-prices????

thanks!!!

dimas

Read only

0 Likes
7,329

You have to decide what kind of recalculating you want to perform. When you press "Update prices" in VA02 you choose one of the pricing types - this is the same what you set in LOGIC_SWITCH-PRICING. If you don't want to have any manual conditions in your order, then just try with LOGIC_SWITCH-PRICING set to 'A' or 'B'.

regards

Read only

0 Likes
7,329

Let me try... but i already did it with C type and checking also cond_handl... and it doesn't work

cya,

dimas

Read only

0 Likes
7,329

hi,

it didn't work...

thanks,

dimas

Read only

0 Likes
7,329

I'm really surprised that thare's not any ABAPer here who knows how to do that...

Read only

0 Likes
7,329

Hi,

I am facing the same issue you had.

were you able to solve that??.If then Pls let me know.

Regards,

Karuna

Read only

0 Likes
7,329

Hi all,

do anybody knows the answer or how to solve it?

Thanks in advance.

Read only

7,329

If you want to just re-price the order without do any other changes, just fill these structures and call BAPI_SALESORDER_CHANGE fm:

This parameter identify the Sales Order number to be recalculated

salesdocument

Here you will define the re-pricing mode do you want to:

logic_switch-pricing = 'B'.

Tell the BAPI that you will change something on SO

order_header_inx-updateflag = 'U'.

Create one entry in both structures for each item do you want to re-calc

order_item_in-itm_number = item number.

order_item_inx-itm_number = item number.

order_item_inx-updateflag = 'U'.

I hope it helps.

Marcelo Vieira

Read only

0 Likes
7,329

Any other idea????

Read only

0 Likes
7,329

Followed Marcelo's instruction.... didn't work initially.

But forgot the basic BAPI rule, need to call 'BAPI_TRANSACTION_COMMIT'

now the repricing is working.

Read only

0 Likes
7,329

Can you post the final samp code,Tks