0% found this document useful (0 votes)
15 views1 page

Alv

This document is an ABAP report that retrieves data from the MARA table and displays it in an ALV (ABAP List Viewer) format. It selects up to 100 rows and builds a field catalog with specific fields such as Material No, Created On, and Created By. The report also includes layout options and handles potential errors during the display process.

Uploaded by

i46ny4l41
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Alv

This document is an ABAP report that retrieves data from the MARA table and displays it in an ALV (ABAP List Viewer) format. It selects up to 100 rows and builds a field catalog with specific fields such as Material No, Created On, and Created By. The report also includes layout options and handles potential errors during the display process.

Uploaded by

i46ny4l41
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

REPORT z_sample_alv_report.

TABLES: mara.

DATA: t_mara TYPE TABLE OF mara,


wa_mara TYPE mara.

DATA: it_fcat TYPE lvc_t_fcat, " Field catalog


wa_fcat TYPE lvc_s_fcat.

DATA: it_events TYPE slis_t_event, " Events table


wa_event TYPE slis_alv_event.

DATA: it_layout TYPE slis_layout_alv.

* Select data from MARA table


SELECT * FROM mara INTO TABLE t_mara UP TO 100 ROWS.

* Build field catalog


wa_fcat-fieldname = 'MATNR'.
wa_fcat-seltext_m = 'Material No'.
APPEND wa_fcat TO it_fcat.

wa_fcat-fieldname = 'ERSDA'.
wa_fcat-seltext_m = 'Created On'.
APPEND wa_fcat TO it_fcat.

wa_fcat-fieldname = 'ERNAM'.
wa_fcat-seltext_m = 'Created By'.
APPEND wa_fcat TO it_fcat.

* Set layout options


it_layout-colwidth_optimize = 'X'.

* Display ALV report


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'MARA'
is_layout = it_layout
TABLES
t_outtab = t_mara
t_fieldcat = it_fcat
t_events = it_events
EXCEPTIONS
program_error = 1
others = 2.

IF sy-subrc <> 0.
MESSAGE 'Error displaying ALV' TYPE 'E'.
ENDIF.

You might also like