Pricing_condition Base Value
Short Description
Download Pricing_condition Base Value...
Description
SDN Contribution
Custom Routine for Sales and Distribution Module
Applies to: SAP 4.6C
Summary In pricing procedure there are different condition types and some time we can not use direct this condition type in pricing procedure as it is based on different condition. In such situation we have to define custom routine. In Sales and Distribution module I have define custom routine to calculate Condition value for some condition types. Depending on the business processes used it may be necessary to influence the standard behavior of R/3 applications. For that purpose the VOFM function provides a corresponding environment in order to be able to develop and manage customer-specific logic simply. The system stores the objects generated via the VOFM in the Customizing of the respective application area (Pricing, message determination and so on) and its programs call the objects correspondingly.
Author(s): Nilesh Shete © 20 0 6 S A P AG
1
Company: Tata Consultancy Services Ltd. Mumbai India Created on: 30 June 2006
Author Bio Name
-
Company Name-
Nilesh Shete, Tata Consultancy Services Ltd. . Mumbai India
Working as SAP Technical Consultant ABAP Workbench on different areas SAP –External system interface, ABAP reporting, ALV, BAPI, etc.
© 2006 SAP AG
2
Introduction First of all I will explain what is the difference between Condition Value and Condition base value? o
o
Condition value is nothing but the calculated value depending upon the specified condition or pricing condition type. The include name will start with RV64A* and subroutine name will be Form routine: FRM_KONDI_WERT_. Whereas Condition base value are used to validate for the particular pricing condition type value. . The include name will start with RV61A* and subroutine name will be Form routine: FRM_KONDI_WERT_.
Important Points Defining custom routine we have to keep in mind few important points; o o o
o o
Access key for each custom routine. VOFM objects are subject to SSCR registration Required authorization to define custom routine. Understand the requirement and check whether it is possible to incorporate in the custom routine or not We have customer number range from 900 to 999 for custom routine. Execute ‘RV80HGEN’ report after completing the routine in each system.
Step to Follows To define Custom Z routine in Sales and Distribution module please follow the following steps. o o o o o
o o
o o o
o
o
Transaction Code VOFM (Maintain: Requirements and Formulas) Menu Path Formulas Condition value. Go to bottom of the table control, Enter the routine number for Ex. 900 and some meaningful description, 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 Modification operation Switch off Assistant. In custom routine we can use KOMP structure, where we can get the pricing value, 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. Depending upon the requirement you can refer KOMP or XKOMV structure in your code. The calculated result we have to pass to XWERT field, which will be display to the condition record. 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 Activate. After activating the custom routine, functional person will attach this custom routine to the condition type of the pricing procedure at AltCty column. Function person can define one field at Subto column for condition type, which we can use in our custom routine.
© 2006 SAP AG
3
o
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. 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:
Sample Code
1
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.
© 2006 SAP AG
4
Sample code
2
DATA: WORKFIELD(16) TYPE P DECIMALS 2, WORKFIELD1 LIKE KOMP-FACTOR, WORKFIELD2 LIKE KOMP-FACTOR. DATA: ZKOMV TYPE STANDARD TABLE OF INDEXED_KOMV WITH HEADER LINE INITIAL SIZE 50. CLEAR: XKWERT. ZKOMV[] = XKOMV[]. READ TABLE ZKOMV WITH KEY KSCHL = C_PRICE. IF SY-SUBRC = 0. WORKFIELD2 = ZKOMV-KWERT. ELSE. READ TABLE ZKOMV WITH KEY KSCHL = C_PRICE1. IF SY-SUBRC = 0. WORKFIELD2 = ZKOMV-KWERT. ENDIF. ENDIF. CHECK WORKFIELD2 NE 0. IF WORKFIELD1 NE 0. WORKFIELD = ( WORKFIELD1 - WORKFIELD2 ) * 10000 / WORKFIELD2. XKWERT = WORKFIELD. ELSE. XKWERT = 0.
Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.
© 2006 SAP AG
5
View more...
Comments