Thursday, July 1, 2021

Custom routine creation in SAP


                              Sales order pricing

 Requirement: In sales order, for one of the condition type, value is populating incorrectly which leads to the change in the total amount of that order. So after analysis we found that one condition type is considering 4 positions after decimals where as others considering only 2 positions after decimals. So to correct this we need to create custom formula. 

Creation of Custom Routines with your profile

First get the pricing procedure name from Sales order. Go to 

:-\VA02/VA03 .






























Double click on material number and go to conditions tab. Here we can see the net value and Condition type values. Highlighted Condition type is having the issue in this scenario.

































Click on Analysis Button to view pricing procedure triggered for this sales order.
So here in our scenario, pricing procedure name is ‘ZAGA01’.
And also we can see pricing conditions like ‘PR00’, ‘PBXX’.
Here we can observe ‘ZTRC’,’ZTRV’ are the custom pricing routines created for this procedure.


Now same these conditions we can see from V/08 transactions.


How to create Formulas and assign them to pricing routines

Procedure:
1.       Create formula from VOFM transaction in between 600-999
2.       Get access code
3.       Activate the formula using menu option
4.       Assign this formula in V/08 against our pricing condition

1. Go to VOFM Transaction à Formulas à condition value
2.  Use available routine number, and give description and application as below.
Here we are using number ‘910’ and application as ‘V’ which we can get from Pricing routine V/08 transaction






























  3.After entering above details, we need to click on Create/Change button. Now it will ask for access key and Basis team will provide us this access key.


















   4. Click on source text button and write your code using enhancement implementation.

Then go back and click on activate button from menu to activate our code. And we can confirm by below check box .






























5. Now go to V/08 transactionà select procedure à click on control buttonà


Now it will show you all condition types. Go to required condition type and assign  our formula to that step.

In our scenario it is ‘ZTRC’ and our formula ‘910’ assigned at ‘Calculation type’ column.





























Here below the outputs and we can find the difference in amounts of ZTRC condition

Before formula addition in Condition :
After formula addition (custom routine) in condition:



































The ZTRC price difference :

Before: 13% of 422.57 = 54.9341
                For Quantity 30: 54.9341 * 30 = 1648.02

After: 13% of 422.57 = 54.9341
            Our custom formula changed this value to 54.93
             ( If value is divided by 10 then it eliminates one decimals)

             For Quantity 30: 54.93 * 30 = 1647.9



Custom routine creation in SAP

                              Sales order pricing   Requirement : In sales order, for one of the condition type, value is populating ...