Today we will learn BW enhancement for tcode RSRT/Bex Query running use BADI RSR_OLAP_BADI for demo.
Purpose:
在BW BEX出具报表时,有时一些信息需要动态展示出来,无法预先存储在数据模型中。比如用户在人员分析报表的时候,希望看到员工当前的状态。
Steps:
BADI: RSR_OLAP_BADI
Implementation: ZIM_RSR_OLAP_BADI
Method: IF_EX_RSR_OLAP_BADI~DEFINE
描述:相关字段定义和读取。
读取0EMPLOYEE YC_BEGDA2 YC_YISDL用来计算FOR CALCULATIONO
新建字段 YC_VIR01,用来展示FOR DISPLAY 。
Method: IF_EX_RSR_OLAP_BADI~ INITIALIZE
描述:通用代码,获取字段位置,复制即可。
Method: IF_EX_RSR_OLAP_BADI~ COMPUTE
描述:获取员工当前的实时状态。
Method: IF_EX_RSR_OLAP_BADI~ INITIALIZE
通用代码
DATA: l_global_name TYPE string.
FIELD-SYMBOLS: <l_global> TYPE i,
<l_s_sfc> TYPE rrkg_s_sfc,
<l_s_sfk> TYPE rrkg_s_sfk.
CLASS cl_exm_im_rsr_olap_badi DEFINITION LOAD.
* get field postions for characteristics in structure
LOOP AT i_th_sfc ASSIGNING <l_s_sfc> WHERE user_exit NE rrke_c_mode-none.
CONCATENATE ‘P_CHA’ <l_s_sfc>-chanm INTO l_global_name SEPARATED BY ‘_’.
UNASSIGN <l_global>.
ASSIGN (l_global_name) TO <l_global>.
CHECK <l_global> IS ASSIGNED.
<l_global> = cl_exm_im_rsr_olap_badi=>get_field_position_d( i_fieldnm = <l_s_sfc>-keyreturnnm i_s_data = i_s_data ).
ENDLOOP.
* get field positions for key figures in structure
LOOP AT i_th_sfk ASSIGNING <l_s_sfk>.
CONCATENATE ‘P_KYF’ <l_s_sfk>-kyfnm INTO l_global_name
SEPARATED BY ‘_’.
UNASSIGN <l_global>.
ASSIGN (l_global_name) TO <l_global>.
CHECK <l_global> IS ASSIGNED.
<l_global> = cl_exm_im_rsr_olap_badi=>get_field_position_d(
i_fieldnm = <l_s_sfk>-value_returnnm
i_s_data = i_s_data ).
ENDLOOP.
Method: IF_EX_RSR_OLAP_BADI~DEFINE
lw_chanm-chanm = ‘YC_VIR01’.
lw_chanm-MODE= RRKE_C_MODE-READ . “/ NO_SELECTION.
APPEND LW_CHANM TO C_T_CHANM.
Method: IF_EX_RSR_OLAP_BADI~ COMPUTE
In this method, with different query,
we assign different value to c_s_data.
我的微信公众号【 hot583 】 或者在这个链接联系我
本文链接 :http://www.hot583.com/2022/06/24/rsr_olap_badi/
本文为作者原创,如果这篇文章对您有用,欢迎转载,
转载请务必注明来源《今日热点在看》http://www.hot583.com/
微信原文《全文完》