0% found this document useful (0 votes)
88 views

How To Derive A Variable Value From Another Variable

The document describes how to derive the value of one variable from another variable in SAP Business Warehouse. It involves creating two variables - an input variable for the period and a second variable with a customer exit to derive the period value. Two text variables display the column headers. A query is built with two selections, one for the input period and one for the cumulative value calculated in the customer exit. The customer exit code appends the derived interval for the cumulative variable based on the input period variable. This allows displaying the period value and cumulative value in separate columns.

Uploaded by

ravisapmaster
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views

How To Derive A Variable Value From Another Variable

The document describes how to derive the value of one variable from another variable in SAP Business Warehouse. It involves creating two variables - an input variable for the period and a second variable with a customer exit to derive the period value. Two text variables display the column headers. A query is built with two selections, one for the input period and one for the cumulative value calculated in the customer exit. The customer exit code appends the derived interval for the cumulative variable based on the input period variable. This allows displaying the period value and cumulative value in separate columns.

Uploaded by

ravisapmaster
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

How to…

Derive a Variable value from


another variable
BUSINESS INFORMATION WAREHOUSE

ASAP “How to…” Paper

Applicable Releases: BW 2.0B, 2.1C


May 2001

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.

Ó2001 SAP AMERICA, INC. AND SAP AG 1


HOW TO … DERIVE A VARIABLE VALUE FROM ANOTHER VARIABLE

3 The Step By Step Solution

This example is based on the InfoCube 0D_SD_C03 from the Demo Business Content.

1. Create an input variable. The


variable is based on the InfoObject
0CALMONTH. Set the following
attributes:
q Single Value
q Ready for input
q Mandatory variable entry

2. Create a variable with a customer


exit as a processing type. The
variable is based on the InfoObject
0CALMONTH. Set the following
attributes:
q Interval
q Mandatory variable entry

Ó2001 SAP AMERICA, INC. AND SAP AG 2


HOW TO … DERIVE A VARIABLE VALUE FROM ANOTHER VARIABLE

3. Create two text variables. Both


variables use the “Replacement
Path” as the processing type.

The first text variable is filled with


the text from the ‘from value’.

The second variable is filled with the


text from the ‘to value’.

4. Call Transaction CMOD for the


definition of the customer exit.
Create a new project, maintain the
short text, and assign a development
class.

Goto Enhancements Assignments


and assign RSR00001. Press the
button components to continue.

Ó2001 SAP AMERICA, INC. AND SAP AG 3


HOW TO … DERIVE A VARIABLE VALUE FROM ANOTHER VARIABLE

5. Double-click on
EXIT_SAPLRRS0_001.

For documentation place the cursor


on RSR00001 and use the menu Goto
-> Display documentation.
6. Then double-click on ZXRSRU01.

If the include doesn’t exist you have


to create it; assign a development
class and a transport request.

7. Enter the coding (see also


Appendix). Save and activate the
coding.

Ó2001 SAP AMERICA, INC. AND SAP AG 4


HOW TO … DERIVE A VARIABLE VALUE FROM ANOTHER VARIABLE

8. Activate the project. This is very


important.

9. Define a query. The details are


described in the following steps.

10. Create a new structure for the


columns by using a right-mouse
click on the columns.

Ó2001 SAP AMERICA, INC. AND SAP AG 5


HOW TO … DERIVE A VARIABLE VALUE FROM ANOTHER VARIABLE

11. Make another right-mouse click on


the columns and choose the option
‘New selection’.

12. Drag & drop the variable


‘MONTH’ to your selection. Add
the text variable &TMONTHF& as
the description.

13. Create a second selection

Ó2001 SAP AMERICA, INC. AND SAP AG 6


HOW TO … DERIVE A VARIABLE VALUE FROM ANOTHER VARIABLE

14. Now drag & drop the variable


‘CUMMONTH’ to your selection
Add the text variable
&TMONTHF& as the description.

15. Your Query should look like this


now.

16. Save your query, embed the query


in a workbook and execute the
query.

17. You can see in the first column the


value for the period which was
entered by the user.
The second column shows the
accumulated value from the
beginning of the year.
Both columns have the correct text.

Ó2001 SAP AMERICA, INC. AND SAP AG 7


HOW TO … DERIVE A VARIABLE VALUE FROM ANOTHER VARIABLE

4 Appendix

*----------------------------------------------------------------------*
* INCLUDE ZXRSRU01 *
*----------------------------------------------------------------------*

DATA: L_S_RANGE TYPE RSR_S_RANGESID.


DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.

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.

Ó2001 SAP AMERICA, INC. AND SAP AG 8

You might also like