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: –

Pricing Fm Parameters 01 46380 4082680 Pricing Fm Parameters 03 46382 4006427

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

New NetWeaver Information at SAP.com

Very Helpfull



User Rating: Be the first one !