No products in the cart.
ABAP
Simple ALV (ABAP List Viewer) report using the procedural approach
To create a simple ALV (ABAP List Viewer) report using the procedural approach, we typically use the Function Module REUSE_ALV_GRID_DISPLAY. This is the classic way to display structured data in a grid format in SAP.
Below is a complete, ready-to-use example that fetches data from the standard flight table (SFLIGHT) and displays it.
The ABAP Code
REPORT z_simple_alv_report.* 1. Data DeclarationTABLES: sflight.DATA: it_sflight TYPE TABLE OF sflight, ” Internal table to hold datawa_sflight TYPE sflight. ” Work area for the table* 2. Selection Screen (Optional – filter by Carrier)SELECT-OPTIONS: s_carrid FOR sflight-carrid.* 3. Data RetrievalSTART-OF-SELECTION.SELECT * FROM sflightINTO TABLE it_sflightWHERE carrid IN s_carrid.* 4. Display ALV ReportIF it_sflight IS NOT INITIAL.CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’EXPORTINGi_structure_name = ‘SFLIGHT’ ” Tells ALV the column names/typesTABLESt_outtab = it_sflight ” The data to be displayedEXCEPTIONSprogram_error = 1OTHERS = 2.IF sy-subrc <> 0.MESSAGE ‘Error displaying ALV’ TYPE ‘I’.ENDIF.ELSE.MESSAGE ‘No data found for the selected criteria.’ TYPE ‘I’.ENDIF.