Application Development 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: 

Re-Pricing in SALES ORDER using BAPI

0 Kudos

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

maciej_domagaa
Contributor

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

0 Kudos

What do I have to check???

thanks,

dimas

0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

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

cya,

dimas

0 Kudos

hi,

it didn't work...

thanks,

dimas

0 Kudos

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

0 Kudos

Hi,

I am facing the same issue you had.

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

Regards,

Karuna

0 Kudos

Hi all,

do anybody knows the answer or how to solve it?

Thanks in advance.

0 Kudos

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

0 Kudos

Any other idea????

0 Kudos

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.

0 Kudos

Can you post the final samp code,Tks