How To Derive A Variable Value From Another Variable
How To Derive A Variable Value From Another Variable
SAP (SAP America, Inc. and SAP AG) assumes no responsibility for errors or omissions in these materials.
These materials are provided “as is” without a warranty of any kind, either express or implied, including but not limited to, the
implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages
that may result from the use of these materials.
SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within
these materials. SAP has no control over the information that you may access through the use of hot links contained in these
materials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party
web pages.
HOW TO … DERIVE A VARIABLE VALUE FROM ANOTHER VARIABLE
1 Business Scenario
A query should show in one column the value for one period. The period should be entered by the
user. In the second column the accumulated value from the beginning of the year to the period from
the first column should be displayed. The InfoCube contains only the InfoObject 0CALMONTH
(Month/Year) and not single InfoObjects for the period and year.
2 The Result
For this scenario we need four variables; two variables for the column text and two variables for the
period values. One of these period variables is defined as a variable with a customer exit.
The customer exit for variables is called three times maximally. These three steps are called I_STEP.
The first step (I_STEP = 1) is before the processing of the variable pop-up and gets called for every
variable of the processing type “customer exit”. You can use this step to fill your variable with default
values.
The second step (I_STEP = 2) is called after the processing of the variable pop-up. This step is called
only for those variables that are not marked as “ready for input” and are set to “mandatory variable
entry”.
The third step (I_STEP = 3) is called after all variable processing and gets called only once and not
per variable. Here you can validate the user entries.
Please note that you can not overwrite the user input values into a variable with this customer exit.
You can only derive values for other variables or validate the user entries.
This example is based on the InfoCube 0D_SD_C03 from the Demo Business Content.
5. Double-click on
EXIT_SAPLRRS0_001.
4 Appendix
*----------------------------------------------------------------------*
* INCLUDE ZXRSRU01 *
*----------------------------------------------------------------------*
CASE I_VNAM.
WHEN 'CUMMONTH'.
IF I_STEP = 2. "after the popup
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'MONTH'.
CLEAR L_S_RANGE.
L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(4)."low value, e.g.200001
L_S_RANGE-LOW+4(2) = '01'.
L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW. "high value = input
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
EXIT.
ENDLOOP.
ENDIF.
ENDCASE.