*&---------------------------------------------------------------------**& Form frm_process_data*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** DO NOTHING EITHER.*----------------------------------------------------------------------*FORM FRM_PROCESS_DATA. CLEAR: DATA_NUM,GS_OUTPUT. LOOP AT GT_OUTPUT INTO GS_OUTPUT. DATA_NUM = DATA_NUM + 1. ENDLOOP.ENDFORM."frm_process_data*&---------------------------------------------------------------------**& Form frm_output*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** DO NOTHING EITHER.*----------------------------------------------------------------------*FORM FRM_OUTPUT. GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'."宽度自动优化 GS_LAYOUT-ZEBRA = ''."斑马线 M_ALV_FIELDCAT: 'ZSEL' '' '选择' 'X' 'X' '' '' 'X' 'X', 'BUKRS' '' '公司代码' '' '' '' '' '' 'X', 'WERKS' '' '工厂' '' '' '' '' '' 'X', 'LGORT' '' '库位' '' '' '' '' '' 'X', 'MATNR' '' '物料号' '' '' '' '' '' 'X', 'MAKTX' '' '物料描述' '' '' '' '' '' 'X', 'MEINS' '' '基本计量单位' '' '' '' '' '' 'X', 'STOCK' '' '当前库存' '' '' '' '' '' 'X'. IF A1 = 'X'. M_ALV_FIELDCAT: 'STNM1' '' '0-30天库龄数量' '' '' '' '' '' 'X', 'TRMB1' '' '0-30天金额' '' '' '' '' '' 'X'. ENDIF. IF A2 = 'X'. M_ALV_FIELDCAT: 'STNM2' '' '31-60天库龄数量' '' '' '' '' '' 'X', 'TRMB2' '' '31-60天金额' '' '' '' '' '' 'X'. ENDIF. IF A3 = 'X'. M_ALV_FIELDCAT: 'STNM3' '' '61-90天库龄数量' '' '' '' '' '' 'X', 'TRMB3' '' '61-90天金额' '' '' '' '' '' 'X'. ENDIF. IF A4 = 'X'. M_ALV_FIELDCAT: 'STNM4' '' '91-180天库龄数量' '' '' '' '' '' 'X', 'TRMB4' '' '91-180天金额' '' '' '' '' '' 'X'. ENDIF. IF A5 = 'X'. M_ALV_FIELDCAT: 'STNM5' '' '181-360天库龄数量' '' '' '' '' '' 'X', 'TRMB5' '' '181-360天金额' '' '' '' '' '' 'X'. ENDIF. IF A6 = 'X'. M_ALV_FIELDCAT: 'STNM6' '' '360天以上库龄数量' '' '' '' '' '' 'X', 'TRMB6' '' '360天以上金额' '' '' '' '' '' 'X'. ENDIF. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = SY-REPID I_CALLBACK_PF_STATUS_SET = 'FRM_SET_STATUS' I_CALLBACK_USER_COMMAND = 'FRM_USER_COMMAND' I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE' IS_LAYOUT = GS_LAYOUT IT_FIELDCAT = GT_FIELD I_DEFAULT = 'X' I_SAVE = 'A' TABLES T_OUTTAB = GT_OUTPUT EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2. IF SY-SUBRC <> 0.* Implement suitable error handling here ENDIF.ENDFORM."frm_output*&---------------------------------------------------------------------**& Form frm_user_command*&---------------------------------------------------------------------***----------------------------------------------------------------------*FORM FRM_USER_COMMAND USING RF_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD. DATA: L_OK_CODE TYPE SY-UCOMM, L_VALID(1) TYPE C. L_OK_CODE = RF_UCOMM. CLEAR: RF_UCOMM. CASE L_OK_CODE. WHEN '&ZALL'."全选 LOOP AT GT_OUTPUT INTO GS_OUTPUT. GS_OUTPUT-ZSEL = 'X'. MODIFY GT_OUTPUT FROM GS_OUTPUT. ENDLOOP. WHEN 'ZNONE'."取消全选 LOOP AT GT_OUTPUT INTO GS_OUTPUT. GS_OUTPUT-ZSEL = ''. MODIFY GT_OUTPUT FROM GS_OUTPUT. ENDLOOP. WHEN OTHERS. ENDCASE. RS_SELFIELD-REFRESH = 'X'.ENDFORM. "USER_COMMAND*&---------------------------------------------------------------------**& Form frm_set_status*&---------------------------------------------------------------------***----------------------------------------------------------------------*FORM FRM_SET_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB. SET PF-STATUS 'GS_1000' EXCLUDING RT_EXTAB.ENDFORM. "FRM_SET_STATUS*&---------------------------------------------------------------------**& Form TOP-OF-PAGE*&---------------------------------------------------------------------***----------------------------------------------------------------------*FORM TOP-OF-PAGE . DATA: L_LINE TYPE SLIS_LISTHEADER, L_T_HEADER TYPE SLIS_T_LISTHEADER, INFO TYPE STRING, C_DATA_NUM TYPE STRING. C_DATA_NUM = DATA_NUM. CONCATENATE '查询结果一共有:' C_DATA_NUM '条数据' INTO INFO. CLEAR L_LINE. L_LINE-TYP = 'H'. L_LINE-INFO = INFO. APPEND L_LINE TO L_T_HEADER. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING IT_LIST_COMMENTARY = L_T_HEADER.ENDFORM. "TOP-OF-PAGE