本文主要是介绍BW QUERY 变量增强,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
*&---------------------------------------------------------------------**& 包含 ZXRSRU01*&---------------------------------------------------------------------*DATA: l_s_range TYPE rsr_s_rangesid.DATA: loc_var_range type rrrangeexit.data: v_date type sy-datum.CASE i_vnam.WHEN 'ZFISCPER_OLAP_001'. "OLAP里面,上一个期间if i_step = 0.l_s_range-sign = 'I'.l_s_range-opt = 'EQ'.clear:v_date.CALL FUNCTION 'FIMA_DATE_CREATE'EXPORTINGi_date = sy-datumi_months = '-1'i_set_last_day_of_month = 'X'IMPORTINGe_date = v_date.CONCATENATE v_date+0(4) '0' v_date+4(2) INTO l_s_range-low.APPEND l_s_range TO e_t_range.endif.when 'ZVAR_S_CALMONTH_002'. "年初月份_选择月份* DATA: L_DATE2 TYPE SY-DATUM.if i_step = 2.READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZVAR_S_CALMONTH_001'.IF SY-SUBRC = 0.l_S_range-sign = 'I'.l_S_range-opt = 'EQ'.CONCATENATE loc_var_range-LOW(4) '01' into l_S_range-low.APPEND l_s_range TO e_t_range.ENDIF.endif.when 'ZVAR_I_CALMONTH_001'. "本年累计_选择月份* DATA: L_DATE2 TYPE SY-DATUM.if i_step = 2.READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZVAR_S_CALMONTH_001'.IF SY-SUBRC = 0.l_S_range-sign = 'I'.l_S_range-opt = 'BT'.CONCATENATE loc_var_range-LOW(4) '01' into l_S_range-low.l_S_range-high = loc_var_range-LOW.APPEND l_s_range TO e_t_range.ENDIF.endif.when 'ZVAR_I_CALMONTH_002'. "截止上月本年累计_选择月份* DATA: L_DATE2 TYPE SY-DATUM.if i_step = 2.READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZVAR_S_CALMONTH_001'.IF SY-SUBRC = 0.l_S_range-sign = 'I'.l_S_range-opt = 'BT'.CONCATENATE loc_var_range-LOW(4) '01' into l_S_range-low.clear:v_date.CONCATENATE loc_var_range-LOW '01' into v_date.CALL FUNCTION 'FIMA_DATE_CREATE'EXPORTINGi_date = v_datei_months = '-1'i_set_last_day_of_month = 'X'IMPORTINGe_date = v_date.l_S_range-high = v_date(6).APPEND l_s_range TO e_t_range.ENDIF.endif.when 'ZVAR_I_CALMONTH_003'. "上年本年累计_选择月份* DATA: L_DATE2 TYPE SY-DATUM.if i_step = 2.READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZVAR_S_CALMONTH_001'.IF SY-SUBRC = 0.l_S_range-sign = 'I'.l_S_range-opt = 'BT'.clear:v_date.v_date(4) = loc_var_range-LOW(4) - 1.CONCATENATE v_date(4) '01' into l_S_range-low.CONCATENATE v_date(4) loc_var_range-LOW+4(2) into l_S_range-high.APPEND l_s_range TO e_t_range.ENDIF.endif.when 'ZVAR_S_CALMONTH_003'. "上年12月_选择月份* DATA: L_DATE2 TYPE SY-DATUM.if i_step = 2.READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZVAR_S_CALMONTH_001'.IF SY-SUBRC = 0.l_S_range-sign = 'I'.l_S_range-opt = 'EQ'.clear:v_date.v_date(4) = loc_var_range-LOW(4) - 1.CONCATENATE v_date(4) '12' into l_S_range-low.APPEND l_s_range TO e_t_range.ENDIF.endif.when 'ZVAR_S_CALYEAR_001'. "选择年_选择月份* DATA: L_DATE2 TYPE SY-DATUM.if i_step = 2.READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZVAR_S_CALMONTH_001'.IF SY-SUBRC = 0.l_S_range-sign = 'I'.l_S_range-opt = 'EQ'.l_S_range-low = loc_var_range-LOW(4).APPEND l_s_range TO e_t_range.ENDIF.endif.when 'ZVAR_S_CALMONTH_004'. "去年同期月份if i_step = 2.READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZVAR_S_CALMONTH_001'.IF SY-SUBRC = 0.clear:v_date.v_date(4) = loc_var_range-LOW(4) - 1.CONCATENATE v_date(4) loc_var_range-LOW+4(2) into l_S_range-low.l_S_range-sign = 'I'.l_S_range-opt = 'EQ'.APPEND l_s_range TO e_t_range.ENDIF.endif.when 'ZVAR_S_CALMONTH_005'. "下月_选择月份if i_step = 2.READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZVAR_S_CALMONTH_001'.IF SY-SUBRC = 0.l_S_range-sign = 'I'.l_S_range-opt = 'EQ'.clear:v_date.CONCATENATE loc_var_range-LOW '01' into v_date.CALL FUNCTION 'FIMA_DATE_CREATE'EXPORTINGi_date = v_datei_months = '1'i_set_last_day_of_month = 'X'IMPORTINGe_date = v_date.l_S_range-low = v_date(6).APPEND l_s_range TO e_t_range.ENDIF.endif.when 'ZVAR_I_CALMONTH_004'. "下月累计_选择月份if i_step = 2.READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'ZVAR_S_CALMONTH_001'.IF SY-SUBRC = 0.l_S_range-sign = 'I'.l_S_range-opt = 'EQ'.CONCATENATE loc_var_range-LOW(4) '01' into l_S_range-low.clear:v_date.CONCATENATE loc_var_range-LOW '01' into v_date.CALL FUNCTION 'FIMA_DATE_CREATE'EXPORTINGi_date = v_datei_months = '1'i_set_last_day_of_month = 'X'IMPORTINGe_date = v_date.l_S_range-high = v_date(6).APPEND l_s_range TO e_t_range.ENDIF.endif.ENDCASE.
作者:wudongfei1
来源:CSDN
原文:https://blog.csdn.net/wudongfei1/article/details/41351971
版权声明:本文为博主原创文章,转载请附上博文链接!
这篇关于BW QUERY 变量增强的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!