2-level column headings in ALV list

﹥>﹥吖頭↗ 提交于 2019-12-06 14:13:05

Found my solution here. Use the top_of_list event to add custom header info before the standard header is printed. If you want to replace the standard header with your own you can turn off the standard header by passing is_layout-no_colhead = 'X' in the layout table.

* Get Event table
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
IMPORTING
et_events = it_evt.

* Add pointer to custom top_of_list event handler
READ TABLE it_evt INTO wa_evt
WITH KEY name = slis_ev_top_of_list .
wa_evt-form = 'MY_TOP_OF_LIST' .
MODIFY it_evt FROM wa_evt INDEX sy-tabix .

* Pass event table when printing ALV list
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
  EXPORTING
    i_callback_program = w_prog
    is_layout          = fs_layout
    it_fieldcat        = t_fieldcat
    it_events          = it_evt
  TABLES
    t_outtab           = t_spfli.

************************************
* Custom event handler to write group-level header
FORM MY_TOP_OF_LIST .
ULINE AT 1(43) .
FORMAT COLOR COL_HEADING .
WRITE: / sy-vline ,
       10 'SAP' ,
       22 sy-vline ,
       31 'VPPA' ,
       43 sy-vline .
ENDFORM.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!