REUSE_ALV_GRID_DISPLAY增加页眉和显示图片

here an image file in my computer desktop.

image
Execute transaction- OAER
image

Provide below details- here we provide the object key name as- FLIGHT_ALV this will be used in the ALV program and execute.

image

The below screen appears . here select Create tab and expand the tree and double click on SCREEN.

image

It open the pop up to select the image from the workstation to upload. Choose the image and select open.
image


*&---------------------------------------------------------------------*
*& Report ZPCYALVPICTURE
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZPCYALVPICTURE.

dATA: lt_spfli TYPE TABLE OF spfli.
DATA: ls_layout TYPE slis_layout_alv.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv.

START-OF-SELECTION.
PERFORM data_selection.
PERFORM build_layout.
PERFORM build_fieldcatalog.
PERFORM display_alv.


FORM data_selection .
SELECT * FROM spfli INTO TABLE lt_spfli.
ENDFORM. " DATA_SELECTION



FORM build_layout.
ls_layout-zebra = abap_true.
ls_layout-colwidth_optimize = abap_true.
ENDFORM. " BUILD_LAYOUT



FORM build_fieldcatalog .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
"I_INTERNAL_TABNAME =
i_structure_name = 'SPFLI'
CHANGING
ct_fieldcat = lt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.

ENDFORM. " BUILD_FIELDCATALOG


FORM display_alv .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'ALV_HEADER'
is_layout = ls_layout
it_fieldcat = lt_fieldcat
TABLES
t_outtab = lt_spfli
EXCEPTIONS
program_error = 1
OTHERS = 2.

ENDFORM. " DISPLAY_ALV

FORM alv_header.
DATA: lt_comment TYPE slis_t_listheader.
DATA: ls_comment TYPE LINE OF slis_t_listheader.
ls_comment-typ = 'H'.
ls_comment-info = 'Tip creep and tipflation are now further supplementing the income of many low-wage service workers.'.
APPEND ls_comment TO lt_comment.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_comment
i_logo = 'FLIGHT_ALV'.  " this is the object key in Tx- OAER
ENDFORM.

预览效果
image

posted @ 2026-08-05 15:52  虚拟过客之IT老男人  阅读(3)  评论(0)    收藏  举报