SAP BW Reporting Variables:Customer Exit

Examples:

Customer Variable Exit Documentation

With this enhancement to global variables in reporting you have the option of determining your default values for variables. You can use this enhancement for variables, for which 'Processing by Customer-Exit' has been selected in the variable maintenance. This is valid for all variable types (characteristic value, node, hierarchy, formula and text variables). You use the Exit EXIT_SAPLRRS0_001 for this.

You could, for example, establish the default value of a characteristic value variable depending on the user.

Depending on the variable type, the fields LOW, HIGH, SIGN and OPT of the internal table E_T_RANGE must be filled as follows:

LOW Single value or lower interval limit (characteristic variable)

Text (Text variable)

Formula value (Formula variable)

Hierarchy name (Hierarchy variable)

Hierarchy node (Hierarchy node variable)

HIGH Upper interval limit (char. variable with interval)

InfoObject of the hierarchy node (hierarchy node variable):

- when selecting a sheet in the LOW field this field must remain empty

- when selecting a node that cannot be posted to in the LOW field, the InfoObject, to which the node that cannot be posted to refers, must be in this field (normally here the InfoObject '0HIER_NODE'). Only in the case that the node refers to another InfoObject as the variable, must the name of the other InfoObject appear here HIGH remains empty for other variable type. SIGN I (inclusive) or E (exclusive) E only makes sense with intervals, otherwise I is always used OPT EQ with single values With intervals: BT or NB.

Example use 1:
Users are responsible for various product groups (meaning a sub-tree of the product hierarchy). Each person should only see the key figures for "his or her" products. You can do this by filling the hierarchy node variable with the help of the user master data.

Example use 2 with coding (Include in Exit source code):
* *
* INCLUDE ZXRSRU01 *
* *
DATA: L_S_RANGE TYPE RSR_S_RANGESID.

CASE I_VNAM. " Variable name
WHEN 'SINGVAL'. " Name of a variable
CLEAR L_S_RANGE.
L_S_RANGE-LOW = 'VALUE1'. " worth filter 'VALUE1'
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
* -> Only data for 'VALUE1' is analyzed in the query.

WHEN 'INTVAL'. "Variable mid range
CLEAR L_S_RANGE.
L_S_RANGE-LOW = 'AA'. " From'AA'
L_S_RANGE-HIGH = 'FF'. " To' 'FF'
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
* -> Only data for interval 'AA' to 'FF' is analyzed in the query.

WHEN 'HIERARCHY'. " Hierarchy variable
CLEAR L_S_RANGE.
L_S_RANGE-LOW = 'MY HIERARCHY'. " hierarchy name
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
* -> Only dependents of hierarchy 'MY HIERARCHY'

WHEN 'HNODE'. " Hierarchy node variable
CLEAR L_S_RANGE.
L_S_RANGE-LOW = 'DEPT1'. " Node name
L_S_RANGE-HIGH = '0HIER_NODE'. " InfoObject
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
* -> Node 'DEPT1', that cannot be posted to

WHEN 'HNODEVAL'. " Hierarchy node variable
CLEAR L_S_RANGE.
L_S_RANGE-LOW = 'LEAVE1'. " node name (node is a leaf)
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
* -> Node 'LEAVE1' (leaf)

WHEN 'TEXT'. " Text variable
CLEAR L_S_RANGE.
L_S_RANGE-LOW = 'Heading'.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
* Text variable in the report is replaced by 'Heading'

WHEN 'INTRATE'. " example for formula variable
CLEAR L_S_RANGE.
L_S_RANGE-LOW = '5'.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
* The value 5 is taken as interest rate in the formula
ENDCASE.
 
Step by Step Guide

1. Selection the option to create a new variable on the InfoObject you want.
2. Enter in the short name of the variable, a description of the variable.
3. Select �Customer Exit� for processing by, Click Next.
4. Select the type of variable and whether or not it is optional or mandatory. Click Next
5. Click Finish.
6. Open up a SAPGUI session, and enter in SE37.
7. Open the function module, EXIT_SAPLRRS0_001.
8. Open the include ZXRSRU01, change to Edit mode.
9. Enter in a WHEN case for your variable, be sure to also follow good coding technique and include descriptive header and modification information. It does not matter
10. Save, check and activate your changes. Place the program in the appropriate transport.

Notes:
Make sure to include the I_STEP If statement to select at which step you would like your code to execute. Generally you will want to have the code execute at I_STEP = 1, which is before any user input takes place.

Comments

Anonymous said…
Thanks for sharing this Information. Got to learn new things from your Blog on SAP HANA

http://thecreatingexperts.com/category/sap-hana-training-in-chennai/

contact 8122241286
Anonymous said…
Thanks for sharing this Information. Got to learn new things from your Blog on SAP HANA

http://thecreatingexperts.com/category/sap-hana-training-in-chennai/

contact 8122241286

Popular posts from this blog

One stage stop to know all about BW Extractors-Part1

COPA Extraction Step By Step in SAP BW

Generic Extraction via Function Module