Skip to Content

I am sure most of you who have programmed on Sales & Distribution Module in ERP would know that Pricing data is an important part of the Sales Document.

When you manually enter a Sales Document such as a Quotation or Sales Order and then change it, the pricing is carried out automatically.

This is due to the function module PRICING which is called by the standard Sales Transactions. Even the Sales Order BAPIs use this function module to carry out the PRICING.

Now try to implement this Pricing functionality via the Web! That’s the requirement we had in one of the projects I undertook this year.

This Weblog gives you a Technical Approach to implementing the PRICING functionality which can be used even in a Web Based Application.

Project Requirement

* Develop a Web Based Create Quotation application (based on the standard VA21 transaction).

A part of this requirement was to carry out the pricing in the same way as the R/3 transaction would in the backend system.

Now the web application was developed by the Portal team in my company using Web Dynpro for Java Technology. The SAP release was ECC 5.0 (WebAS 640).

I was responsible for developing a custom RFC function module which is called from the Web Application. It then carries out the Pricing in the backend and then returns the re-calculated Net Value and other pricing conditions. These are then displayed on the portal application.

There is a function module PRICING which is called by the standard SD transactions to carry out pricing.

In this blog, I shall explain how to write a custom RFC function module to carry out the Pricing using the standard function module PRICING. You can integrate this RFC into a Web application.

Please Note: –
The code presented in this blog is specific to the project I had undertaken and to the system on which it was tested. You might have to modify the code to adapt it as per your specific requirement.

Here is an RFC Function module Z_SD_SLS_PROCESS_PRICING. The function module is called for each item of the Quotation and performs the following steps: –

1) Accepts Sales Quotation Data such as: –

  • Sales organisation
  • Distribution Channel
  • Division
  • Order Type
  • Item Number
  • Material
  • Plant
  • Order Quantity
  • Sales Unit
  • Sold-To Party
  • Ship-To Party
  • Currency
  • Gross Weight
  • Net Weight
  • Weight Unit
  • Pricing Conditions entered by the User through the Web

2) Calls the function module SPR_KOMK_KOMP_FILL to populate the pricing structues KOMK and KOMP based on the data passed from above.

3) Populates the Pricing conditions entered by the user into a separate internal table of structure KOMV. In our example only pricing conditions ZPR0, ZMAN, ZMLT, ZSTP, ZFR1, ZFR2 and ZCST are accepted from the Web application to carry out re-pricing.

4) Then it calls the function module PRICING using the KOMK and KOMP structures populated earlier to carry out the Pricing.

5) Then it calls the function module PRICING_SUBSCREEN_SET_DATA to format the PRICING data as per the screen display required in R/3 transactions. This is where you can get the Total Net Value which you can display in your web applications.

Below are the steps to activate the RFC function module along with the code: –

Step 1:
In your ERP system, create a new Function Group Z_PRICING and activate it.

Step 2:
Create a new Function module Z_PROCESS_PRICING within the function group Z_PRICING. In the Attributes, set the Processing Type to “Remote-Enabled Module”. Enter the following interface parameters: –

image image image

Step 3:
Insert the following code into the Function module Z_PROCESS_PRICING.

Step 4:
Insert the following code in the TOP include of the function group Z_PRICING which is Include LZ_PRICINGTOP.

Step 5:
Activate the function group Z_PRICING and all the include programs. This will also activate our function module Z_PROCESS_PRICING.

Step 6:
Test the function module Z_PROCESS_PRICING first in the backend to check if the results are accurate before integrating into the Web Application.

A suggested approach to test is as follows: –

* Start the Create transaction for a Sales Document (in our example Create Sales Quotation – VA21) in one terminal session.
* Enter all the relevant parameters manually and check the Net Value at the Item Level of the document. This value is determined from the Pricing that is carried out by the system.
* In another terminal session, start the test mode for Function Module Z_PROCESS_PRICING. Enter similar parameters as the VA21 transaction and execute.
* The Net Nalue returned in the Changing Parameter CV_NET_VALUE should be the same as the Net Value on the pricing condition screen as shown below.


If the above test has been successful, then the function module can be integrated into a Web Application.

Aditya Palekar

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

    1. Former Member Post author
      Hi Mahesh,

               Thanks for reviewing the Weblog…much appreciated. Our project team spent about 2 whole days trying to debug standard transaction and find out how PRICING function module works.

              So I thought this will be an interesting blog to write which could benefit others.


      1. Former Member
        Hey Adi,

          Really great work, i was working on this subject for more than 3 months, this blog leverages me to look forward much faster.

          Please throw some light if you have worked on IPC and blogs from that end, we are waiting.

        Kishore Yerra.

    1. Former Member Post author
      Hi Mafika,

               Thank you very much for your comments on the same. The aim of this blog was to help others in their projects.

             There are many BAPIs (RFCs) available for all sales functions but not something so readily available for PRICING…so I wrote this blog.


  1. Former Member

       This is really Good  !

       Hope i was thinking of samekind on the CRM side.

      I am just find out whether ABAP only can be used for Pricing(instead of using JAVA on IPC 7.0).

      If you have any information, please let me know at



  2. Former Member
    I was researching on this subject when I came across this. This is an excellent piece. BTW, did you prepare any functional specifications document for this effort? If so, can you forward the same?
    1. Former Member Post author
      Hi Shubhajit,

              Unfortunately there were no functional specs. for this requirement. All we had is a set of screen shots from the customer indicating the requirement.

             We also did not create any technical specs. for the same. However the code is well documented with comments and will help in explaining the flow logic.


  3. Former Member
    Hi Adithya,

    I have a similar requirement where we needed to display the pricing information (net price and all condition types associated) when given a customer, material, quantity, sales area etc.

    I followed exactly what you did as it did match my requirement to an extent. We found that the SPR_KOMK_KOMP_FILL doesnt serve our purpose because we have some more feilds (ZZ fields) that we needed to give as input to PRICING to get all condition records.

    I would like to get some advice from you, provided you let me contact you. Please let me know, my Email is

    Thanks a lot for the information on the weblog.


  4. Former Member
    Dear Aditya,

    You presented a beautiful application which is not directly available. I am checking for this and  finally i got this .You given this in a Function module format which is so nice . I tried to copy and work on this. In the pricing conditions list i given  what value we have here. But it is showing some return message pricing procedure is not there . But it is there . can you give me some idea on this .


Leave a Reply