OLÁ,
veja este exemplo.
REPORT ZBHALV_LIST1.
TABLES:MARA.
SELECT-OPTIONS: MATNR FOR MARA-MATNR.
DATA:BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
ERSDA LIKE MARA-ERSDA,
MTART LIKE MARA-MTART,
MBRSH LIKE MARA-MBRSH,
END OF ITAB.
SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR
IN MATNR.
TYPE-POOLS SLIS.
DATA:FCAT TYPE slis_t_fieldcat_alv.
DATA:LAYOUT TYPE slis_layout_alv.
DATA:EVE TYPE slis_t_event WITH HEADER LINE.
DATA:HEAD TYPE slis_t_listheader WITH HEADER LINE.
DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
SORT-UP = 'X'.
SORT-SPOS = 1.
SORT-FIELDNAME = 'ERSDA'.
SORT-tabname = 'MARA'.
APPEND SORT.
SORT-SPOS = 2.
SORT-FIELDNAME = 'MTART'.
SORT-tabname = 'MARA'.
APPEND SORT.
EVE-NAME = 'TOP_OF_PAGE'.
EVE-FORM = 'TOPOFPAGE'.
APPEND EVE.
EVE-NAME = 'TOP_OF_LIST'.
EVE-FORM = 'TOPOFLIST'.
APPEND EVE.
EVE-NAME = 'END_OF_LIST'.
EVE-FORM = 'ENDOFLIST'.
APPEND EVE.
LAYOUT-ZEBRA = 'X'.
LAYOUT-no_hline = 'X'.
LAYOUT-NO_VLINE = 'X'.
LAYOUT-window_titlebar = 'DETALHES DO MATERIAL'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INCLNAME = SY-REPID
-
I_BYPASSING_BUFFER =
-
I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = FCAT
.
IF SY-SUBRC <> 0.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
-
I_INTERFACE_CHECK = ' '
-
I_BYPASSING_BUFFER =
-
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
<b> I_CALLBACK_PF_STATUS_SET = 'STATUS'</b>
I_CALLBACK_USER_COMMAND = 'UCOMM'