*&---------------------------------------------------------------------* *& Report Z2023015105 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT z2023015105. TYPE-POOLS:slis. DATA tables TYPE TABLE OF ztcustomer9. SELECT * INTO CORRESPONDING FIELDS OF TABLE tables FROM ztcustomer9. DATA layout TYPE slis_layout_alv. DATA field TYPE slis_fieldcat_alv. DATA fieldlist TYPE slis_fieldcat_alv OCCURS 0. field-col_pos = 1. field-fieldname = 'ZECUSTOMERID'. field-datatype = 'INT'. field-outputlen = '4'. field-seltext_m = '客户编号'. APPEND field TO fieldlist. field-col_pos = 2. field-fieldname = 'ZECOMPANYNAME'. field-datatype = 'CHAR'. field-outputlen = '100'. field-seltext_m = '客户名称'. APPEND field TO fieldlist. field-col_pos = 3. field-fieldname = 'ZECREATEDATE'. field-datatype = 'DATS'. field-outputlen = '8'. field-seltext_m = '客户名称'. APPEND field TO fieldlist. field-col_pos = 4. field-fieldname = 'ZESCOPE'. field-datatype = 'CHAR'. field-outputlen = '255'. field-seltext_m = '客户经营范围'. APPEND field TO fieldlist. field-col_pos = 5. field-fieldname = 'ZECNAME'. field-datatype = 'CHAR'. field-outputlen = '255'. field-seltext_m = '法人代表'. APPEND field TO fieldlist. layout-zebra = 'X'. layout-colwidth_optimize = 'X'. layout-f2code = '&ETA'. layout-detail_popup = 'X'. layout-detail_titlebar = '详细信息'. DATA lt_event TYPE TABLE OF slis_alv_event. DATA ls_event TYPE slis_alv_event. ls_event-name = 'PF_STATUS_SET'. ls_event-form = 'FORM_PF_STATUS_SET'. APPEND ls_event TO lt_event. ls_event-name = 'USER_COMMAND'. ls_event-form = 'FORM_USER_COMMAND'. APPEND ls_event TO lt_event. ls_event-name = 'TOP_OF_PAGE'. ls_event-form = 'FORM_TOP_OF_PAGE'. APPEND ls_event TO lt_event. DATA pgm like sy-repid. pgm = sy-repid. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' I_CALLBACK_PROGRAM = pgm I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET' I_CALLBACK_USER_COMMAND = 'USER_COMMAND' I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = ' ' * I_GRID_TITLE = * I_GRID_SETTINGS = is_layout = layout it_fieldcat = fieldlist * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * IT_SORT = * IT_FILTER = * IS_SEL_HIDE = * I_DEFAULT = 'X' * I_SAVE = ' ' * IS_VARIANT = it_events = lt_event * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES t_outtab = tables. * EXCEPTIONS * PROGRAM_ERROR = 1 * OTHERS = 2 . IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. FORM form_user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield. IF r_ucomm = 'ZADD'. MESSAGE '发起流程审批成功' type 'I'. ENDIF. ENDFORM. FORM form_pf_status_set USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'ZGUI05'. ENDFORM. FORM form_top_of_page. ENDFORM.
标签:layout,自定义,field,ls,ALV,带有,TYPE,event,APPEND From: https://www.cnblogs.com/hua900822/p/17225120.html