关于TYPE-POOLS SLIS的ALV设置

先声明:

TYPE-POOLS: SLIS.

 

定义ALV的top_of_page显示数据

DATA : WA_TOP TYPE LINE OF SLIS_T_LISTHEADER ,
            IT_TOP TYPE SLIS_T_LISTHEADER.

赋值

wa_top-key = '' . wa_top-typ = 'H'. wa_top-info = '销售订单查询'. APPEND wa_top TO it_top . wa_top-key = '打印人:' . wa_top-typ = 'S'. wa_top-info = sy-uname. APPEND wa_top TO it_top .

调用,显示出图片

FORM top_of_page . CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = it_top i_logo = 'ENJOYSAP_LOGO' . ENDFORM.   

 

定义ALV的显示字段数据

DATA : IT_FIELDCAT TYPE TABLE OF SLIS_FIELDCAT_ALV ,
       WA_FIELDCAT LIKE LINE OF IT_FIELDCAT.

定义ALV显示字段宏

 DEFINE hout . wa_fieldcat-fieldname = '&1'. wa_fieldcat-seltext_l = &2 . append wa_fieldcat to it_fieldcat. END-OF-DEFINITION.

ALV字段赋值

  hout vkgrp '业务主办代号'. hout bezei '业务主办'. hout erdat '核发日期'.

 

定义ALV排序基础数据

data: it_sort type slis_t_sortinfo_alv with header line .

实现ALV排序

FORM it_sort . CLEAR it_sort . it_sort-fieldname = 'MATNR' . it_sort-spos = '1' . it_sort-up = 'X'. *it_sort-subtot = 'X'. APPEND it_sort . ENDFORM.

 

定义ALV布局数据

DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV .

赋值

wa_layout-zebra = 'X'. wa_layout-colwidth_optimize = 'X'. wa_layout-info_fieldname = 'LINE_COLOR'. * wa_layout-excp_fanme = 'X'. * WA_layout-totals_text = '总计'. * WA_layout-subtotals_text = '小计'. * WA_layout-group_change_edit = 'X'.

显示ALV

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' i_callback_program = sy-repid * I_CALLBACK_PF_STATUS_SET = ' ' * I_CALLBACK_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 = wa_layout it_fieldcat = it_fieldcat * IT_EXCLUDING = * IT_SPECIAL_GROUPS = it_sort = it_sort[] * IT_FILTER = * IS_SEL_HIDE = * I_DEFAULT = 'X' * I_SAVE = ' ' * IS_VARIANT = * IT_EVENTS = * 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 = itab_all * EXCEPTIONS * PROGRAM_ERROR = 1 * OTHERS = 2 .

 

 

程序流程:

START-OF-SELECTION. PERFORM get_data . PERFORM build_alv . PERFORM display-alv. PERFORM it_sort .


效果:

你可能感兴趣的:(关于TYPE-POOLS SLIS的ALV设置)