【转】SAP Study Notes: BW Queriy-Variables(变量)

SAP BW 查询变量详解
本文详细介绍了SAP BW查询中的变量概念及其多种类型,包括Characteristics、Text、Hierarchy等,并深入探讨了如何通过Customer Exit Variables自定义变量逻辑,以及SAP Exit变量的查看方法。
SAP Study Notes: BW Queriy-Variables(变量)

转自:http://chenweiqin1981.spaces.live.com/blog/cns!1675D48BEA05A462!1634.trak

 
About Variable:
1.Variable 是和InfoObject绑定的,可用于任何含有该IO的query中。
2.Variable有以下几种类型:
  • Characteristic:用于限制Char。
  • Text:用于在报表动态显示文本。
  • Hierarchy:用于限制Hierarchy。
  • Hieararchy Node:用于限制Hierarchy Node。
  • Formula: 可以在公式中使用变量,让用户输入一个数,读取某个Char.的属性(例如Prduct的price属性)等来用于计算。
Offset的应用:设置偏移量
SAP BI Content内置了很多标准变量。当其无法满足需求时,有时仅仅需要设置下偏移量就可以满足需求了。
例如系统已经有了当前月份的变量,通过偏移就可以获得上N个月和下N个月的变量,无需增强。
 
定义Customer Exit Variables(BW 3.x ,BI7 类似)
客户出口变量可以通过程序来处理变量逻辑。定义过程如下:
1.在query designer中,右键单击要建立变量的characteristic,选择New variable.
2.设置为customer exit类型
3.进入CMOD,修改:Enhancement   Exp  RSR00001 BI: Enhancements for Global Variables in Reporting-->Function exit    EXIT_SAPLRRS0_001-->INCLUDE ZXRSRU01 。该Function Module 将在query运行时被调用多次。
3-1:调用前,系统将其他变量的当前值保存在内表 I_T_VAR_RANGE中。The table type is RRS0_T_VAR_RANGE, and row type RRS0_S_VAR_RANGE references structure 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

 3-2:每次调用时,系统会传递参数值给Function Module。其中,比较重要的参数如下:

I_STEP 标识了该调用发生的时机:

  •   I_STEP = 1: Call is made directly before variable entry.
  • 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.
  • 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.
  •   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标识了当前要处理的变量。

3-3:完成变量的处理之后,应将变量的值写入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 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)."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.

 

 

 

查看SAP Exit变量
SAP Exit变量为我们编写customer exit变量提供了很好的参考。
1. SE16 查看表 RSZGLOBV 可以得到系统全部变量的列表,选择process type=SAP Exit,即可获得所有的SAP Exit变量列表
2. SE37 查看 RREX_VARIABLE_EXITRSVAREXIT_ * 可以找到SAP Exit变量的代码
 
在 Android 的 `bugreport.txt` 文件中,你提到的两行内容: ``` ---- State variables set externally ---- ---- State variables calculated internally ---- ``` 通常出现在 **Dumpsys 输出的某个系统服务状态中**,例如 `dumpsys notification`、`dumpsys activity` 或其他服务模块中。它们用于区分 **状态变量的来源**。 --- ### 🔍 行 5782: `---- State variables set externally ----` 这行表示接下来列出的变量是 **由外部设置的**,即: - 由用户设置(如在设置中更改通知优先级) - 由应用配置(如调用 `setImportance()`) - 由系统策略(如设备管理员设置) **示例内容:** ```txt importance=2 soundEnabled=true vibrateEnabled=false ``` --- ### 🔍 行 5789: `---- State variables calculated internally ----` 这行表示接下来列出的变量是 **系统内部计算得出的**,即: - 根据当前设备状态(如是否在“请勿打扰”模式)动态计算 - 受其他服务状态影响(如 Do Not Disturb 状态、设备焦点状态) **示例内容:** ```txt effectiveImportance=3 suppressedVisualEffects=true showInQuietMode=false ``` --- ### 🧠 举例说明(以 Notification 服务为例) ```txt ---- State variables set externally ---- importance=2 soundUri=content://settings/system/notification_sound bypassDnd=false ---- State variables calculated internally ---- effectiveImportance=3 suppressedVisualEffects=true ``` - `importance=2` 是用户设置的优先级。 - `effectiveImportance=3` 是系统根据当前 Do Not Disturb 模式计算出的实际优先级。 - `suppressedVisualEffects=true` 表示视觉效果(如通知灯)被系统策略屏蔽。 --- ### 📌 实际用途 | 场景 | 用法 | |------|------| | **调试通知行为异常** | 查看 `effectiveImportance` 是否被系统策略覆盖 | | **排查声音/震动不生效** | 对比 `soundEnabled`(用户设置)和 `effectiveSoundEnabled`(实际效果) | | **分析通知是否被屏蔽** | 查看 `suppressedVisualEffects` 和 `showInQuietMode` | | **确认用户设置是否生效** | 检查 `set externally` 块中的变量是否被正确保存 | --- ### 🧰 如何查看这些状态变量? 你可以使用以下命令查看特定服务的状态: ```bash adb shell dumpsys notification adb shell dumpsys activity adb shell dumpsys window ``` 然后在输出中搜索: ```bash grep -A 10 "State variables set externally" bugreport.txt grep -A 10 "State variables calculated internally" bugreport.txt ``` ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值