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: 

Function Module PRICING

aabhas_wilmar
Contributor

Hi friends,

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.

Regards,

Aabhas

1 ACCEPTED SOLUTION

former_member193964
Active Participant

Hi,

Try to use this FM PRICING_BUILD_XKOMV. You can simulate the conditions too. But is necessary to pass right values. If you have a problem, try to use the debug in VA01. Put a break point in the FM Pricing and take a look the parameters. You can compare the both structures. If you forget a 'X' for example you will have difference in the result.

regards,

8 REPLIES 8

former_member193964
Active Participant

Hi,

Try to use this FM PRICING_BUILD_XKOMV. You can simulate the conditions too. But is necessary to pass right values. If you have a problem, try to use the debug in VA01. Put a break point in the FM Pricing and take a look the parameters. You can compare the both structures. If you forget a 'X' for example you will have difference in the result.

regards,

0 Kudos

Hi Marcelo,

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.

regards,

Aabhas K Vishnoi

Former Member
0 Kudos

Hi Aabhas,

I am working this same problem in version 4.7. Is it possible that you provide me with more detail?

I have used all your recommendations but it seems that populating the fields for comm_head_i and comm_item_i is very tricky.

I will really appreciate your help.

Luis Leston

0 Kudos

Hi Luis,

The following information should help you as an example that you need to pass to the comm_head_i and comm_item_i parameters of FM PRICING...

Header Data

Fill the header with these values:

i_komk-vkorg	=	
  i_komk-vtweg	=	
  i_komk-spart	=	
  i_komk-vkbur	=	
  i_komk-konda	=	
  i_komk-kdgrp	=	
  i_komk-pltyp	=	
  i_komk-bukrs	=	
  i_komk-waerk	=	
  i_komk-kunnr	=	
  i_komk-kunwe	=	
  i_komk-kappl	=	'V'.
  i_komk-kalsm	=	
  i_komk-prsdt	=	
  i_komk-inco1	=	
  i_komk-kdkg1	=	
  i_komk-trtyp       =     'V'.

Item Data

Fill the header with these values:

i_komp-kposn	=	'000010'.
  i_komp-matnr	=	
  i_komp-werks	=	
  i_komp-kondm	=	"Not mandatory
  i_komp-prodh	=	"Not mandatory
  i_komp-mgame	=	
  i_komp-vrkme	=	"Not mandatory
  i_komp-prsfd	=	
  i_komp-evrwr	=	
  i_komp-varcond	=	"Not mandatory

Hope it helps...

Regards,

Aabhas K Vishnoi

0 Kudos

Hi Aabhas,

The issue is not of more urgency to the company and I am caught by other stuff now.

I have tried putting this piece of coding you sent me inside the query in which I need it but somehow I don't get all the records with the conditions existing for every item in a particular sales order. I just got two records, one per each item of the order I am using.

Anyway, I appreciate your help and faster response compare to mine.

If you have any other idea, I will really appreciate it.

Thanks,

Luis Leston

0 Kudos

Dear Aabhas,

Is it possible for me to pass PO number to the function module 'PRICING'.

If so, what set of fields do i need to pass.

Thanks and Regards,

Sandeep

0 Kudos

hello

I am facing some problem in PRICING FM

I already sent a thread where i described my problem

Here I am using FM: 'PRICING' for Purchase order Invoice TAX Condition Pricing

And feed the entry in all required field as below

first field is CALCULATION TYPE' = 'C'.

Header data

MANDT

BELNR = EBELN

KNUMV

BUKRS

HWAER = WAERS

LIFNR

ZTERM

KAPPL

KALSM

EKORG

MWSKZ

item data

KPOSN = POSNR

MATNR

WERKS

but the data will not come

pleaze tell me any other field is required or suggest me the FM from i can get Invoice Condition Prices

Thank You,'

Jahnavee

racingpro
Explorer
0 Kudos

Hello,

I am having an issue with FM PRICING while using a Reference Material Number.

I am populating fields KOMP-MATNR with the main material number and KOMP-PMATN and KOMP-SATNR with the reference material number.

I get most conditions in KOMV but some discounts records are missing and field KOMP-NETPR is not accurate.

I tried calling the FM by setting parameter CALCULATION_TYPE to C, B and O but I am not able to obtain the net price of the reference material number.

I've looked in the VA01 process in debug mode but cannot figure out where is the problem.

I also try to use FM SALES_PRICE_READ but I get a message saying "No sales price available in mastr conditions". I am not convinced that this FM could work in my case. I would prefer to use the PRICING FM.

Does anyone has a clue or a coding example to share?

Thank you very much for the help.

Sylvain