About Variable:
1.Variable is bound to infoobject and can be used in any query that contains the IO. There are several types of 2.Variable:
- Characteristic: Used to restrict char.
- Text: Used to dynamically display texts in a report.
- Hierarchy: Used to limit Hierarchy.
- Hieararchy node: Used to restrict hierarchy node.
- Formula: You can use a variable in a formula to allow the user to enter a number, read a char. Properties (such as the price property of Prduct), and so on for the calculation.
application of Offset: Set offsetSAP BI content has many standard variables built into it. When it is not enough to meet the requirements, sometimes just need to set the next offset to meet the requirements. For example, the system already has a variable for the current month, and you can get the variables for the last n months and the next n months by offsetting, without the need for an enhancement.
Define Customer Exit Variables (BW 3.x, BI7 similar)Client exit variables can be used to process variable logic through a program. The definition process is as follows: 1. In Query Designer, right-click the characteristic to which you want to create a variable, and select New Variable.2. Set to Customer exit Type 3. Enter Cmod, modify: Enhancement Exp RSR00001 bi:enhancements for Global Variables in Reporting-->function exit Exit_saplrrs0_001-->include ZXRSRU01 。 The function Module is called multiple times when the query is run. 3-1: The system saves the current values of other variables in the table before calling
I_t_var_rangeIn The table type is Rrs0_t_var_range, and row type Rrs0_s_var_range references structure rrrangeexit. This structure have the following fields:
Field |
Description |
Vnam |
Variable Name |
Iobjnm |
InfoObject Name |
Sign |
(I) ncluding [] or (E) xcluding [] |
Opt |
Operators:eq =, BT [], LE <=, Lt <, GE >=, gt;, CP, and so on |
Low |
Characteristic value |
High |
Characteristic value of upper limit for intervals or node InfoObject for hierarchy nodes |
3-2: The system passes the parameter value to the function Module each time it is called. Among them, the more important parameters are as follows:
I_step identifies the time when the call occurred:
- I_step = 1:call is made directly before variable entry.
- I_step = 2:call is made directly after variable entry. This step was only _executed if the same variable are not input-ready and could not being filled for i_step = 1.
- I_step = 3:in This call, you can check the values of the variables. When a exception (RAISE) is triggered, the variable screen appears again. I_step = 2 is then also called again.
- I_step = 0:the enhancement is not called from the variable screen. The call can originate from the authorization check or from the monitor.
I_vnam Identifies the variables that are currently being processed.
3-3: After the processing of the variable is completed, the value of the variable should be written to E_t_range.
Sample Code:
Data:l_s_range TYPE Rsr_s_rangesid. Data:l_s_var_range TYPE Rrrangeexit. Case I_vnam. When ' Cummonth '. IF I_step = 2. After the popup READ TABLE I_t_var_range to l_s_var_range with KEY Vnam = ' MONTH '. IF SY-SUBRC = 0. CLEAR L_s_range.
L_s_range-low = Loc_var_range-low (4). " Low value, for example, 200601
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.
ENDIF.
ENDIF.
Endcase.
View SAP Exit variables
The SAP exit variable provides a good reference for us to write the customer exit variable. 1. SE16 View Table
RSZGLOBVYou can get a list of all the variables in the system and select Process Type=sap exit to get all the SAP exit variable list 2. SE37 View
Rrex_variable_exitOr
Rsvarexit_ *You can find the code for the SAP exit variable
The variables and their enhancements in BEx Query designer