Function Module PRICING
You must be aware of the function module PRICING which simulates (sales order) and returns back TKOMV which contains all the pricing data - condition types and price values.
It works fine with a normal material. But when I am trying to call the same for a material which is configurable (variant configuration) it does not returns the variant price conditions.
It is found in debugging that it looses the value of KOMP-VARCOND which is perhaps the reason that it does not considers variant conditions.
The requirement is to extract the prices of all possible combination of sold-to / ship-to and materials in different sales area.
I also tried BAPI_SALESORDER_SIMULATE but it does the same thing.
Any help will be highly appreciated with points.
Aabhas K Vishnoi replied
Somehow, I was able to solve the issue yesterday night after a lot of debugging into VA01 and PRICING. And the solution is that we just have to call 'PRICING_LOAD_VARIANT_KEYS' before we call PRICING for configurable material.
This function module populates the structure XVCKEY but strange, even when the control returns back to the program the structure remains filled.
Anyways, it worked!
Sample code that may be of help to others:
DATA: l_vckey TYPE STANDARD TABLE OF vckey WITH HEADER LINE. l_vckey-kappl = 'V'. l_vckey-posnr = '000010'. l_vckey-varcond = 'area'. l_vckey-factor = 1. APPEND l_vckey. CALL FUNCTION 'PRICING_LOAD_VARIANT_KEYS' EXPORTING application = 'V' vbeln = '' posnr = '000010' TABLES tvckey = l_vckey. CALL FUNCTION 'PRICING' EXPORTING calculation_type = 'C' comm_head_i = i_komk "Fill the header comm_item_i = i_komp "Fill the item (with a configurable material) TABLES tkomv = i_tkomv.
Aabhas K Vishnoi