Application Development and Automation 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: 
Read only

routines

Former Member
0 Likes
589

hi,

I woudl like to add routines to condition type in a pricing procedure.Could any one of you guide me as how to create it?

or i would like to use RV61A997. help me how to create this include.

Thanks

hi,

I woudl like to add routines to condition type in a pricing procedure.Could any one of you guide me as how to create it?

or i would like to use RV61A997. help me how to create this include.

Thanks

2 REPLIES 2
Read only

Former Member
0 Likes
499

Hi Anu

There is a contribution regarding the pricing procedures in code sample

https://www.sdn.sap.com/irj/sdn/advancedsearch?query=%20routines%20to%20condition%20type%20in%20a%20...

Read only

Former Member
0 Likes
499

Anu,

See the instructions given below.

<b>Important Points</b>

Defining custom routine we have to keep in mind few important points;

o Access key for each custom routine. VOFM objects are subject to SSCR registration

o Required authorization to define custom routine.

o Understand the requirement and check whether it is possible to incorporate in the custom routine or not

o We have customer number range from 900 to 999 for custom routine.

o Execute ‘RV80HGEN’ report after completing the routine in each system

To define Custom Z routine in Sales and Distribution module please follow the following steps.

o Transaction Code - VOFM (Maintain: Requirements and Formulas)

o Menu Path - Formulas --> Condition value.

o Go to bottom of the table control,

o Enter the routine number for Ex. 900 and some meaningful description,

o It will ask the Access key, enter the available access key. Now ABAP editor will be opened, you can switch off Modification Assistant from Menu EDIT &#56256;&#56518; Modification operation &#56256;&#56518; Switch off Assistant.

o In custom routine we can use KOMP structure, where we can get the pricing value,

o To access the whole condition record, we can use structure XKOMV. But to access this XKOMV structure we have to define one internal table of type ‘INDEXED_KOMV’ and pass the structure XKOMV value to the new defined internal table.

o Depending upon the requirement you can refer KOMP or XKOMV structure in your code.

o The calculated result we have to pass to XWERT field, which will be display to the condition record.

o To activate the subroutine we have to first save the code and come out from the routine. In Maintain: Formulas Condition value screen, select routine to activate and select Edit menu &#56256;&#56518; Activate.

o After activating the custom routine, functional person will attach this custom routine to the condition type of the pricing procedure at AltCty column.

o Function person can define one field at Subto column for condition type, which we can use in our custom routine.

o For ex. We require to calculate the % discount depending upon the two condition type. To get the condition value for the both the condition type we have to select one field at Subto column. There are two types of fields, one is ‘Copy value to’ and another one is ‘Carry over value to’. One store the condition value whereas second store Condition rate. Depending upon the requirement we can select the field type. Before using the Subto field please make sure that it is not referring to other condition type.

o To calculate the % you have to divide or multiply by 10000 not by 100 due to SAP current type.

This is an example of a code sample:

DATA: WORKFIELD(16) TYPE P DECIMALS 2.
CHECK KOMP-KZWI1 NE 0.
IF XWORKJ NE 0.
  WORKFIELD = ( KOMP-KZWI1 - XWORKJ ) * 10000 / KOMP-KZWI1.
  XKWERT = WORKFIELD.
ELSE.
  XKWERT = 0.
ENDIF.

<i><b>Reward points if this reply found useful.</b></i>