REPORT ZSDR020.
INCLUDE ZSDR020TOP.
TABLES: ZRLB_H,ZRLB_I,KNA1,/ATU/STOREMASTER,MARA,knvv. DATA: ls_data_out type ZSXSFX, lt_data_out like TABLE OF ZSXSFX WITH HEADER LINE, lt_data_sum like TABLE OF ZSXSFX WITH HEADER LINE, lt_data_tmp like TABLE OF ZSXSFX WITH HEADER LINE. FIELD-SYMBOLS : <dyn_table> TYPE table, <dyn_wa> TYPE ANY, <dyn_field> TYPE ANY. DATA lt_tmp LIKE TABLE OF ZSXSFX WITH HEADER LINE. DATA:BEGIN OF T_STORE OCCURS 0, KUNNR LIKE KNA1-KUNNR, NAME1 LIKE KNA1-NAME1, END OF T_STORE. DATA:LT_STORE LIKE TABLE OF T_STORE WITH HEADER LINE.
INCLUDE ZSDR020SCR.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001. SELECT-OPTIONS: s_BUDAT FOR ZRLB_H-BUDAT DEFAULT sy-datum TO sy-datum, "营业日期 S_3ADCCU FOR KNA1-J_3ADCCU NO INTERVALS, s_KUNNR FOR KNA1-KUNNR NO INTERVALS, s_KTYPE FOR /ATU/STOREMASTER-/ATU/STORETYPE NO INTERVALS, s_KATR2 FOR KNA1-KATR2 NO INTERVALS, s_BRSCH FOR KNA1-BRSCH NO INTERVALS, s_SPART for MARA-SPART NO INTERVALS, s_EXTWG for MARA-EXTWG NO INTERVALS, s_MATNR for MARA-MATNR no INTERVALS, s_SIZE for ZRLB_I-J_3ASIZE no INTERVALS, s_ZMATNR for ZRLB_I-ZMATNR no INTERVALS, s_vkgrp for knvv-vkgrp NO INTERVALS, s_UDATE FOR ZRLB_H-UDATE. "上传日期 SELECTION-SCREEN END OF BLOCK blk1. SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002. PARAMETERS: p_3ADCCU AS CHECKBOX DEFAULT 'X', "总店 p_kunnr AS CHECKBOX DEFAULT 'X', "子店 p_type AS CHECKBOX , "门店类型 p_KATR2 AS CHECKBOX , " p_vkgrp AS CHECKBOX DEFAULT 'X', p_zmatnr AS CHECKBOX DEFAULT 'X', "大货 p_matnr AS CHECKBOX, "小货 p_PRDHA AS CHECKBOX DEFAULT 'X', "产品层次 p_PRDHB AS CHECKBOX, "大类 "p_MATKL AS CHECKBOX, "物料组 p_budat AS CHECKBOX, "营业日期 p_SPART AS CHECKBOX, p_EXTWG AS CHECKBOX, p_SDABW AS CHECKBOX, p_FORMT AS CHECKBOX. SELECTION-SCREEN END OF BLOCK blk2. SELECTION-SCREEN BEGIN OF BLOCK blk3 WITH FRAME TITLE text-003. PARAMETERS: p_qty RADIOBUTTON GROUP a DEFAULT 'X', p_val1 RADIOBUTTON GROUP a, p_val2 RADIOBUTTON GROUP a. SELECTION-SCREEN END OF BLOCK blk3. START-OF-SELECTION. PERFORM FRM_GET_DATA. PERFORM FRM_SHOW_ALV.
INCLUDE ZSDR020O01.
FORM set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS '1100'. ENDFORM.
INCLUDE ZSDR020I01.
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield. CASE r_ucomm. WHEN 'ZRB'. "日报 PERFORM frm_process USING '正在进行日报格式处理,请稍候……'. PERFORM FRM_SET_DATA_SUM USING 'RB'. PERFORM FRM_create_date_table. PERFORM frm_filled_date_table. PERFORM FRM_SHOW_SUM_ALV. WHEN 'ZXB'. "旬报 PERFORM frm_process USING '正在进行旬报格式处理,请稍候……'. PERFORM FRM_SET_DATA_SUM USING 'XB'. PERFORM FRM_create_date_table. PERFORM frm_filled_date_table. PERFORM FRM_SHOW_SUM_ALV. WHEN 'ZYB'. "月报 PERFORM frm_process USING '正在进行月报格式处理,请稍候……'. PERFORM FRM_SET_DATA_SUM USING 'YB'. PERFORM FRM_create_date_table. PERFORM frm_filled_date_table. PERFORM FRM_SHOW_SUM_ALV. WHEN 'ZJB'. "季报 PERFORM frm_process USING '正在进行季报格式处理,请稍候……'. PERFORM FRM_SET_DATA_SUM USING 'JB'. PERFORM FRM_create_date_table. PERFORM frm_filled_date_table. PERFORM FRM_SHOW_SUM_ALV. WHEN 'ZNB'. "年报 PERFORM frm_process USING '正在进行年报格式处理,请稍候……'. PERFORM FRM_SET_DATA_SUM USING 'NB'. PERFORM FRM_create_date_table. PERFORM frm_filled_date_table. PERFORM FRM_SHOW_SUM_ALV. ENDCASE. ENDFORM.
INCLUDE ZSDR020F01.
FORM FRM_GET_DATA. DATA: LT_RLB LIKE TABLE OF ZSRLB WITH HEADER LINE. CALL FUNCTION 'ZSD_POS_GET_RLB_LIST' EXPORTING IV_MODE = 'A' IV_SHOWPROPERTY = 'X' TABLES IT_BUDAT = S_BUDAT IT_3ADCCU = S_3ADCCU IT_KUNNR = S_KUNNR IT_MATNR = S_MATNR IT_ZMATNR = S_ZMATNR IT_UDATE = S_UDATE IT_BRSCH = S_BRSCH IT_SPART = S_SPART IT_EXTWG = S_EXTWG IT_KTYPE = S_KTYPE IT_VKGRP = S_VKGRP ET_DATA = LT_RLB. PERFORM FRM_SET_DATA TABLES LT_RLB. ENDFORM. "FRM_GET_DATA *&---------------------------------------------------------------------* *& Form FRM_SET_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->LT_DATA text *----------------------------------------------------------------------* FORM FRM_SET_DATA TABLES LT_DATA STRUCTURE ZSRLB. DATA: LT_KUNNR LIKE TABLE OF ZSKUNNR2 WITH HEADER LINE. DATA: BEGIN OF LT_VKGRP OCCURS 0, KUNNR LIKE /ATU/STOREMASTER-/ATU/STORE_ID, NAME1 LIKE KNA1-NAME1, VKGRP LIKE KNVV-VKGRP, BEZEI LIKE TVGRT-BEZEI, KATR2 LIKE KNA1-KATR2, KATR2TXT LIKE TVK2T-VTEXT, END OF LT_VKGRP. DATA:LV_TABIX LIKE SY-TABIX. DATA: LV_STR1(20) type C, LV_STR2(20) type C, LV_STR3(20) type C. CLEAR: LT_STORE,LT_STORE[]. LOOP AT LT_DATA. CLEAR LT_KUNNR. LT_KUNNR-KUNNR = LT_DATA-KUNNR. APPEND LT_KUNNR. ENDLOOP. SORT LT_KUNNR BY KUNNR. DELETE ADJACENT DUPLICATES FROM LT_KUNNR COMPARING KUNNR. IF LT_KUNNR[] IS NOT INITIAL. SELECT A~/ATU/STORE_ID B~NAME1 V~VKGRP K~BEZEI B~KATR2 K2~VTEXT FROM /ATU/STOREMASTER AS A INNER JOIN KNA1 AS B ON B~KUNNR = A~KUNNR INNER JOIN KNVV AS V ON A~/ATU/STORE_ID = V~KUNNR AND A~VKORG = V~VKORG AND A~VTWEG = V~VTWEG AND A~SPART = V~SPART INNER JOIN TVGRT AS K ON V~VKGRP = K~VKGRP AND K~SPRAS EQ '1' INNER JOIN TVK2T AS K2 ON B~KATR2 = K2~KATR2 AND K2~SPRAS EQ '1' INTO TABLE LT_VKGRP FOR ALL ENTRIES IN LT_KUNNR WHERE A~/ATU/STORE_ID = LT_KUNNR-KUNNR. SORT LT_VKGRP BY KUNNR. ENDIF. LOOP AT LT_DATA. CLEAR: ls_data_out. MOVE-CORRESPONDING LT_DATA to ls_data_out. READ TABLE LT_VKGRP WITH KEY KUNNR = ls_data_out-KUNNR BINARY SEARCH. IF SY-SUBRC = 0. ls_data_out-NAME1 = LT_VKGRP-NAME1. ls_data_out-VKGRP = LT_VKGRP-VKGRP. ls_data_out-VKGRPTXT = LT_VKGRP-BEZEI. ls_data_out-KATR2 = LT_VKGRP-KATR2. ls_data_out-KATR2TXT = LT_VKGRP-KATR2TXT. ENDIF. if p_PRDHB eq 'X'. SEARCH ls_data_out-PRDHATXT FOR '_'. if sy-subrc = 0. SPLIT ls_data_out-PRDHATXT AT '_' INTO LV_STR1 LV_STR2 LV_STR3. ls_data_out-PRDHBTXT = LV_STR3. else. ls_data_out-PRDHBTXT = ls_data_out-PRDHATXT. endif. endif. IF P_3ADCCU EQ 'X'. LT_STORE-KUNNR = ls_data_out-J_3ADCCU. COLLECT LT_STORE. ENDIF. IF P_3ADCCU NE 'X'. clear ls_data_out-J_3ADCCU. ENDIF. IF P_KUNNR NE 'X'. clear: ls_data_out-KUNNR, ls_data_out-NAME1. ENDIF. if p_vkgrp NE 'X'. clear: ls_data_out-VKGRP, ls_data_out-VKGRPTXT. endif. IF p_KATR2 NE 'X'. clear: ls_data_out-KATR2, ls_data_out-KATR2TXT. ENDIF. IF P_TYPE NE 'X'. clear: ls_data_out-STORETYPE. ENDIF. IF P_ZMATNR NE 'X'. clear: ls_data_out-ZMATNR, ls_data_out-J_3ASIZE. ENDIF. IF P_MATNR NE 'X'. clear: ls_data_out-MATNR. ENDIF. IF P_PRDHA NE 'X'. clear: ls_data_out-PRDHA, ls_data_out-PRDHATXT. ENDIF. IF P_SPART NE 'X'. clear: ls_data_out-SPART, ls_data_out-SPARTTXT. ENDIF. IF P_EXTWG NE 'X'. clear: ls_data_out-EXTWG, ls_data_out-EXTWGTXT. ENDIF. IF P_SDABW NE 'X'. clear: ls_data_out-SDABW. ENDIF. IF P_FORMT NE 'X'. clear: ls_data_out-FORMT. ENDIF. "为日报准备的内表 clear LT_DATA_TMP. LT_DATA_TMP = ls_data_out. COLLECT LT_DATA_TMP. IF P_BUDAT NE 'X'. clear: ls_data_out-BUDAT. ENDIF. "销售分析输出的内表 COLLECT ls_data_out into lt_data_out. ENDLOOP. IF LINES( LT_STORE ) > 0. SELECT KUNNR NAME1 INTO TABLE LT_STORE FROM KNA1 FOR ALL ENTRIES IN LT_STORE WHERE KUNNR = LT_STORE-KUNNR. SORT LT_STORE by KUNNR. LOOP AT LT_STORE. LV_TABIX = SY-TABIX. LT_DATA_OUT-ZD_NAME1 = LT_STORE-NAME1. MODIFY LT_DATA_OUT TRANSPORTING ZD_NAME1 WHERE J_3ADCCU = LT_STORE-KUNNR. ENDLOOP. ENDIF. ENDFORM. "FRM_SET_DATA *&---------------------------------------------------------------------* *& Form FRM_SHOW_ALV *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM FRM_SHOW_ALV. DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV, LS_LAYOUT TYPE SLIS_LAYOUT_ALV. SET TITLEBAR '1100' WITH s_BUDAT-low s_BUDAT-high s_matnr-low s_kunnr-low. CLEAR LS_LAYOUT. LS_LAYOUT-EDIT = ''. LS_LAYOUT-EDIT_MODE = SPACE. LS_LAYOUT-ZEBRA = 'X'. LS_LAYOUT-COLWIDTH_OPTIMIZE = ''. DEFINE ADD_FIELD. CLEAR: LS_FIELDCAT. LS_FIELDCAT-FIELDNAME = &1. LS_FIELDCAT-REPTEXT_DDIC = &2. LS_FIELDCAT-INTLEN = &3. LS_FIELDCAT-DO_SUM = &4. LS_FIELDCAT-NO_ZERO = &5. LS_FIELDCAT-KEY = &6. LS_FIELDCAT-FIX_COLUMN = &7. LS_FIELDCAT-NO_OUT = &8. APPEND LS_FIELDCAT TO IT_FIELDCAT. END-OF-DEFINITION. IF P_3ADCCU EQ 'X'. ADD_FIELD 'J_3ADCCU' '总店' 10 '' '' '' '' ''. ADD_FIELD 'ZD_NAME1' '总店名称' 20 '' '' '' '' ''. ENDIF. IF P_KUNNR EQ 'X'. ADD_FIELD 'KUNNR' '门店编号' 10 '' '' '' '' ''. ADD_FIELD 'NAME1' '门店名称' 20 '' '' '' '' ''. ENDIF. if p_vkgrp eq 'X'. ADD_FIELD 'VKGRPTXT' '主管' 10 '' '' '' '' ''. endif. IF P_TYPE EQ 'X'. ADD_FIELD 'STORETYPE' '门店类型' 8 '' '' '' '' ''. ENDIF. IF P_KATR2 EQ 'X'. "ADD_FIELD 'KATR2' '店铺类型' 8 '' '' '' '' ''. ADD_FIELD 'KATR2TXT' '店铺类型' 8 '' '' '' '' ''. ENDIF. IF P_BUDAT EQ 'X'. ADD_FIELD 'BUDAT' '营业日期' 10 '' '' '' '' ''. ENDIF. IF P_PRDHA EQ 'X'. ADD_FIELD 'PRDHA' '产品层次' 10 '' '' '' '' ''. ADD_FIELD 'PRDHATXT' '产品层次描述' 10 '' '' '' '' ''. ENDIF. if p_PRDHB eq 'X'. ADD_FIELD 'PRDHBTXT' '商品大类' 10 '' '' '' '' ''. ENDIF. IF P_SPART EQ 'X'. ADD_FIELD 'SPART' '品牌' 10 '' '' '' '' ''. ADD_FIELD 'SPARTTXT' '品牌描述' 18 '' '' '' '' ''. ENDIF. IF P_EXTWG EQ 'X'. ADD_FIELD 'EXTWG' '系列' 8 '' '' '' '' ''. ADD_FIELD 'EXTWGTXT' '系列描述' 18 '' '' '' '' ''. ENDIF. IF P_FORMT EQ 'X'. ADD_FIELD 'FORMT' '货品高新标识' 8 '' '' '' '' ''. ENDIF. IF P_SDABW EQ 'X'. ADD_FIELD 'SDABW' '库存类别' 8 '' '' '' '' ''. ENDIF. IF P_ZMATNR EQ 'X'. ADD_FIELD 'ZMATNR' '小货号' 18 '' '' '' '' ''. ENDIF. IF P_MATNR EQ 'X'. ADD_FIELD 'MATNR' '大货号' 18 '' '' '' '' ''. ENDIF. ADD_FIELD 'QTY' '数量' 10 'X' '' '' '' ''. ADD_FIELD 'RVAL' '吊牌金额' 10 'X' '' '' '' ''. ADD_FIELD 'VAL' '折后金额' 10 'X' '' '' '' ''. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = SY-REPID IT_FIELDCAT = IT_FIELDCAT[] IS_LAYOUT = LS_LAYOUT i_callback_pf_status_set = 'SET_PF_STATUS' i_callback_user_command = 'USER_COMMAND' I_SAVE = 'A' TABLES T_OUTTAB = LT_DATA_OUT. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. "FRM_SHOW_ALV FORM frm_process USING p_info . CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' EXPORTING percentage = 100 text = p_info EXCEPTIONS OTHERS = 1. ENDFORM.
INCLUDE ZSDR020F02. "日报,旬报,月报,季报,年报
ENDFORM. FORM frm_filled_date_table. DATA fieldname(20). LOOP AT lt_data_sum. CLEAR <dyn_wa>. ASSIGN COMPONENT 'J_3ADCCU' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-J_3ADCCU. ASSIGN COMPONENT 'ZD_NAME1' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-ZD_NAME1. ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-KUNNR. ASSIGN COMPONENT 'NAME1' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-NAME1. ASSIGN COMPONENT 'STORETYPE' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-STORETYPE. ASSIGN COMPONENT 'BUDAT' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-BUDAT. ASSIGN COMPONENT 'PRDHA' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-PRDHA. ASSIGN COMPONENT 'SPART' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-SPART. ASSIGN COMPONENT 'EXTWG' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-EXTWG. ASSIGN COMPONENT 'FORMT' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-FORMT. ASSIGN COMPONENT 'SPARTTXT' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-SPARTTXT. ASSIGN COMPONENT 'EXTWGTXT' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-EXTWGTXT. ASSIGN COMPONENT 'PRDHATXT' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-PRDHATXT. ASSIGN COMPONENT 'PRDHBTXT' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-PRDHBTXT. ASSIGN COMPONENT 'VKGRP' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-VKGRP. ASSIGN COMPONENT 'VKGRPTXT' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-VKGRPTXT. ASSIGN COMPONENT 'SDABW' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-SDABW. ASSIGN COMPONENT 'ZMATNR' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-ZMATNR. ASSIGN COMPONENT 'MATNR' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-MATNR. ASSIGN COMPONENT 'J_3ASIZE' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-J_3ASIZE. ASSIGN COMPONENT 'KATR2' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-KATR2. ASSIGN COMPONENT 'KATR2TXT' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-KATR2TXT. if p_qty eq 'X'. ASSIGN COMPONENT lt_data_sum-statdate OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-qty. ASSIGN COMPONENT 'SUMALL' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-qty. elseif p_val1 eq 'X'. ASSIGN COMPONENT lt_data_sum-statdate OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-RVAL. ASSIGN COMPONENT 'SUMALL' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-RVAL. elseif p_val2 eq 'X'. ASSIGN COMPONENT lt_data_sum-statdate OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-VAL. ASSIGN COMPONENT 'SUMALL' OF STRUCTURE <dyn_wa> TO <dyn_field>. <dyn_field> = lt_data_sum-VAL. endif. COLLECT <dyn_wa> into <dyn_table>. ENDLOOP. ENDFORM. FORM FRM_SHOW_SUM_ALV. DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV, LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV, LS_LAYOUT TYPE SLIS_LAYOUT_ALV. CLEAR LS_LAYOUT. LS_LAYOUT-EDIT = ''. LS_LAYOUT-EDIT_MODE = SPACE. LS_LAYOUT-ZEBRA = 'X'. LS_LAYOUT-COLWIDTH_OPTIMIZE = ''. DEFINE ADD_FIELD. CLEAR: LS_FIELDCAT. LS_FIELDCAT-FIELDNAME = &1. LS_FIELDCAT-REPTEXT_DDIC = &2. LS_FIELDCAT-INTLEN = &3. LS_FIELDCAT-DO_SUM = &4. LS_FIELDCAT-NO_ZERO = &5. LS_FIELDCAT-KEY = &6. LS_FIELDCAT-FIX_COLUMN = &7. LS_FIELDCAT-NO_OUT = &8. APPEND LS_FIELDCAT TO IT_FIELDCAT. END-OF-DEFINITION. IF P_3ADCCU EQ 'X'. ADD_FIELD 'J_3ADCCU' '总店' 10 '' '' '' 'X' ''. ADD_FIELD 'ZD_NAME1' '总店名称' 20 '' '' '' 'X' ''. ENDIF. IF P_KUNNR EQ 'X'. ADD_FIELD 'KUNNR' '门店编号' 10 '' '' '' 'X' ''. ADD_FIELD 'NAME1' '门店名称' 20 '' '' '' 'X' ''. ENDIF. if p_vkgrp eq 'X'. ADD_FIELD 'VKGRPTXT' '主管' 10 '' '' '' 'X' ''. endif. IF P_TYPE EQ 'X'. ADD_FIELD 'STORETYPE' '门店类型' 8 '' '' '' 'X' ''. ENDIF. IF P_KATR2 EQ 'X'. "ADD_FIELD 'KATR2' '店铺类型' 8 '' '' '' '' ''. ADD_FIELD 'KATR2TXT' '店铺类型' 8 '' '' '' 'X' ''. ENDIF. IF P_PRDHA EQ 'X'. ADD_FIELD 'PRDHA' '产品层次' 10 '' '' '' 'X' ''. ADD_FIELD 'PRDHATXT' '产品层次描述' 10 '' '' '' 'X' ''. ENDIF. IF P_PRDHB EQ 'X'. ADD_FIELD 'PRDHBTXT' '商品大类' 10 '' '' '' 'X' ''. ENDIF. IF P_SPART EQ 'X'. ADD_FIELD 'SPART' '品牌' 10 '' '' '' 'X' ''. ADD_FIELD 'SPARTTXT' '品牌描述' 18 '' '' '' 'X' ''. ENDIF. IF P_EXTWG EQ 'X'. ADD_FIELD 'EXTWG' '系列' 8 '' '' '' 'X' ''. ADD_FIELD 'EXTWGTXT' '系列描述' 18 '' '' '' 'X' ''. ENDIF. IF P_FORMT EQ 'X'. ADD_FIELD 'FORMT' '货品高新标识' 8 '' '' '' 'X' ''. ENDIF. IF P_SDABW EQ 'X'. ADD_FIELD 'SDABW' '库存类别' 8 '' '' '' 'X' ''. ENDIF. IF P_ZMATNR EQ 'X'. ADD_FIELD 'ZMATNR' '小货号' 18 '' '' '' 'X' ''. ENDIF. IF P_MATNR EQ 'X'. ADD_FIELD 'MATNR' '大货号' 18 '' '' '' 'X' ''. ENDIF. if lt_tmp[] is not INITIAL. LOOP AT lt_tmp. add_field lt_tmp-statdate lt_tmp-statdatetxt 10 'X' '' '' '' ''. ENDLOOP. add_field 'SUMALL' '汇总' 10 'X' '' '' '' ''. endif. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = SY-REPID IT_FIELDCAT = IT_FIELDCAT[] IS_LAYOUT = LS_LAYOUT I_SAVE = 'A' TABLES T_OUTTAB = <dyn_table>. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM.