Skip to content
Call: +91-8779272083
Email: info@sapify.in
Enquiry Now
SAPifySAPify
  • Home
  • About Us
  • Courses
  • Blogs
  • Contact Us
  • My Account
0
No products in the cart.
SAPifySAPify
  • Home
  • About Us
  • Courses
  • Blogs
  • Contact Us
  • My Account
  • Home
  • ABAP
  • Simple ALV (ABAP List Viewer) report using the procedural approach
ABAP

Simple ALV (ABAP List Viewer) report using the procedural approach

  • 28 Jan, 2026
  • Com 0

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 Declaration
TABLES: sflight.
DATA: it_sflight TYPE TABLE OF sflight, ” Internal table to hold data
wa_sflight TYPE sflight. ” Work area for the table
* 2. Selection Screen (Optional – filter by Carrier)
SELECT-OPTIONS: s_carrid FOR sflight-carrid.
* 3. Data Retrieval
START-OF-SELECTION.
SELECT * FROM sflight
INTO TABLE it_sflight
WHERE carrid IN s_carrid.
* 4. Display ALV Report
IF it_sflight IS NOT INITIAL.
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
EXPORTING
i_structure_name = ‘SFLIGHT’ ” Tells ALV the column names/types
TABLES
t_outtab = it_sflight ” The data to be displayed
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ‘Error displaying ALV’ TYPE ‘I’.
ENDIF.
ELSE.
MESSAGE ‘No data found for the selected criteria.’ TYPE ‘I’.
ENDIF.

Code Explanation

Here is the breakdown of how the program works:

  • DATA & TABLES: We define an internal table (it_sflight) that mimics the structure of the database table SFLIGHT. This acts as the temporary storage for the data while the program is running.
  • SELECT-OPTIONS: This creates a search field on the initial screen, allowing the user to filter the report by Airline Code (e.g., AA, LH).
  • START-OF-SELECTION: This is an event keyword. It tells the system to execute the code following it once the user clicks the Execute (F8) button.
  • SELECT * … INTO TABLE: This SQL query fetches all columns from the database and pours them into our internal table it_sflight.
  • REUSE_ALV_GRID_DISPLAY: This is the “magic” function.
    • i_structure_name: Since SFLIGHT is a standard dictionary table, we pass its name. The ALV uses this to automatically generate column headers (like “Price,” “Currency,” etc.).
    • t_outtab: This is where we pass our internal table containing the fetched data.

Key Benefits of Using ALV

  • Built-in Functionality: Users automatically get buttons to sort, filter, export to Excel, and calculate totals without you writing extra code.
  • Standardized Look: It ensures a consistent user experience across different SAP modules.
Share on:
The OO ABAP Editable ALV Code

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Latest Post

Thumb
The OOPS ABAP ALV Code
29 Jan, 2026
Thumb
Simple Editable ALV with Save Logic.
29 Jan, 2026
Thumb
Editable ALV using the procedural approach
29 Jan, 2026

Categories

  • ABAP (3)
  • ALV (3)
sapify (2)

We are a dedicated SAP technical training platform committed to building industry-

Add: Mumbai, Maharashtra, India.
Call: +91-8779272083
Email: info@sapify.in

Online Platform

  • About
  • Course
  • Instructor

Links

  • Contact Us

Contacts

Enter your email address to register to our newsletter subscription

Icon-facebook Icon-instagram Icon-youtube Icon-linkedin2
Copyright 2026 SAPify | All Rights Reserved
SAPifySAPify