FORM ALV_DISPLAY.
DATA L_LAYOUT TYPE SLIS_LAYOUT_ALV.
DATA L_TAB_EVENT TYPE SLIS_T_EVENT.
DATA L_TAB_EXIT TYPE SLIS_T_EVENT_EXIT.
DATA L_VARIANT LIKE DISVARIANT.
DATA L_TITLE TYPE LVC_TITLE.
* 取得ALV表格
PERFORM ALV_FILL_FIELDCAT CHANGING P_TAB_FIELDCAT.
* 取得ALV layout
PERFORM ALV_FILL_LAYOUT CHANGING L_LAYOUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ''
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = P_TAB_FIELDCAT
IS_LAYOUT = L_LAYOUT
IT_EVENTS = I_EVENTS[]
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
I_CALLBACK_PF_STATUS_SET = 'ALV_STATUS' "自定义工具栏
I_CALLBACK_USER_COMMAND = 'ALV_USER_COMMAND' "自定义工具栏的事件
TABLES
T_OUTTAB = TAB_DATA1.
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. "ALV_DISPLAY
*&---------------------------------------------------------------------*
*& Form TOP-OF-PAGE
*&---------------------------------------------------------------------*
* ALV表头内容
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
FORM TOP-OF-PAGE.
DATA: L_LINE TYPE SLIS_LISTHEADER,
L_T_HEADER TYPE SLIS_T_LISTHEADER.
CLEAR L_LINE.
L_LINE-TYP = 'H'.
L_LINE-INFO = TEXT-003.
APPEND L_LINE TO L_T_HEADER.
CLEAR L_LINE.
L_LINE-TYP = 'S'.
L_LINE-KEY = '币种:'.
L_LINE-INFO = F_SANTWH.
APPEND L_LINE TO L_T_HEADER.
L_LINE-TYP = 'S'.
L_LINE-KEY = '币种单位:'.
L_LINE-INFO = G_CURRUNIT.
APPEND L_LINE TO L_T_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = L_T_HEADER.
ENDFORM. "TOP-OF-PAGE
ALV 输出抬头
最新推荐文章于 2023-05-24 11:24:45 发布