ABAP ALV增加抬头和图片:
##预览效果
实现步骤
- 实现参数 i_callback_top_of_page
FORM frm_display_data.
DATA: is_variant LIKE disvariant.
is_variant-report = sy-repid.
is_variant-handle = '2'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
is_layout_lvc = gs_layout
it_fieldcat_lvc = gt_fieldcat_m
i_save = 'A'
i_callback_top_of_page = 'FRM_TOP_OF_PAGE'
i_callback_pf_status_set = 'FRM_SET_STATUS1'
i_callback_user_command = 'FRM_USER_COMMAND1'
is_variant = is_variant
TABLES
t_outtab = gt_data_m
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
- 通过T-CODE OAOR上传LOGO
- 实现函数 FRM_TOP_OF_PAGE
FORM frm_top_of_page.
DATA: lt_header TYPE slis_t_listheader,
ls_header TYPE slis_listheader,
lv_namef TYPE char30,
lv_namel TYPE char30,
lv_week TYPE scal-week.
ls_header-typ = 'S'.
ls_header-key = text-068.
ls_header-info = gv_datum+0(4) && text-059 && gv_datum+4(2) && text-067.
APPEND ls_header TO lt_header .
CLEAR ls_header .
ls_header-typ = 'S'.
ls_header-key = text-069 .
ls_header-info = gv_bname."lv_namel && lv_namef.
APPEND ls_header TO lt_header .
CLEAR ls_header .
ls_header-typ = 'S'.
ls_header-key = text-070 .
ls_header-info = gv_datum+0(4) && text-059 && gv_datum+4(2) && text-067 && gv_datum+6(2) && text-071 .
APPEND ls_header TO lt_header .
CLEAR ls_header .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_header
i_logo = 'ZLOGO'
i_alv_form = 'X'.
ENDFORM.