BW出口变量增强

英文好的可以直接看下面2个链接,第三个是经过翻译的,本文中很多也是直接从第三篇拷贝过来的。

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htm

http://help.sap.com/saphelp_nw04s/helpdata/EN/1d/ca10d858c2e949ba4a152c44f8128a/frameset.htm

 

用户出口增强,定义方法:

1.在query designer中,右键单击要建立变量的characteristic,选择New variable.
2.设置为customer exit类型
3.进入CMOD,修改:Enhancement 添加出口 RSR00001 BI: Enhancements for Global Variables in Reporting-->Function exit EXIT_SAPLRRS0_001-->INCLUDE ZXRSRU01 。该Function Module 将在query运行时被调用多次。
 

I_STEP 值说明: I_STEP = 1,Call is made directly before variable entry. 可用于预先填充选择变量。如果在这里对变量进行了操作,就没法在step2里边对该变量做修改了。

I_STEP = 2,Call is made directly after variable entry. This step is only executed if the same variable is not input-ready and could not be filled for I_STEP = 1.

这句话的意思就是如果你想触发step2,就必须在Bex Analyser上变量属性中去掉“变量已准备输入”,并且在i_step = 1的时候不能对这个变量做处理。

"I_STEP = 3,In this call, you can check the values of the variables. When an exception (RAISE) is triggered, the variable screen appears again. I_STEP = 2 is then also called again.

检查变量,当抛出异常的时候,变量会被要求重新输入,当然step2也会被再次触发。

 

"I_STEP = 0,The enhancement is not called from the variable screen. The call can originate from the authorization check or from the monitor.

这个不会从变量输入触发,会被权限检查或者监视器触发。

 

 

When the enhancement RSR00001 is called,the system passes the current values of the other variables in table I_T_VAR_RANGE. The table type is RRS0_T_VAR_RANGE, and row type RRS0_S_VAR_RANGE references structure RRRANGEEXIT.
 
所有变量都回提前存放在 I_T_VAR_RANGE,类型是RRS0_T_VAR_RANGE,变量类型是RSR_S_RANGESID,提取结构是RRRANGEEXIT。
 
This structure has 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

 
Sample Code:
In the following example, the current
month is taken from an input-ready variable MONTH; this is then used to generate
an interval that cumulates all months from January ('01') up to the current
month. The customer exit variable CUMMONTH contains the interval as the
value.
 
DATA: L_S_RANGE TYPE RSR_S_RANGESID. 修改以后替换用户输入的变量
DATA: L_S_VAR_RANGE TYPE RRRANGEEXIT.从I_T_VAR_RANGE读取的变量保存到该变量
CASE I_VNAM.
WHEN 'CUMMONTH'.
IF I_STEP = 2. "after the popup
READ TABLE I_T_VAR_RANGE INTO 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)."将前4位付给low,比如200601的2006
L_S_RANGE-LOW+4(2) = '01'. 将01付给5,6位,就是用01替换以前的月份
L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW. "high value = input
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'. 操作是between
APPEND L_S_RANGE TO E_T_RANGE. 将修改后的变量付给出口。
ENDIF. ENDIF. ENDCASE.
posted @ 2013-01-10 11:33  hanmos  阅读(4449)  评论(0编辑  收藏  举报