ALV – ABAP List Viewers is a collection of predefine functions/method provided by standard SAP to generate standardized report output. Before the introduction of ALV’s in the SAP application software, reports were developed as classical report output using the WRITE statement. While WRITE provides the flexibility to the developer to design the layout and design of the report output, but at the same time, burden’s the developer with the necessity to build all the functions every time a report application is built. ALV application with a large set of predefined functions and features, reduce the development turn-a-round time and helps develop standardized report outputs.
The first set of ALV solutions was provided as function modules, all the ALV function modules use the naming convention REUSE_*. The most commonly used ALV function module to display a list output is REUSE_ALV_LIST_DISPLAY and we use REUSE_ALV_GRID_DISPLAY to generate grid report outputs. Apart for these to commonly preferred output for displaying report outputs, ALV also support other display outputs like Block display using REUSE_ALV_BLOCK_LIST_DISPLAY and hierarchical sequential list display using REUSE_HIERSEQ_LIST_DISPLAY.
With the introduction of OO-ABAP, ALV application solutions also was re-imagined using class based applications. Standard class solutions were brought up with class like CL_GUI_ALV_GRID were developed which can be used with the custom container object on module pool application to generate ALV output reports within screen developments.
Generating a simple ALV report output using the ALV grid display function module. We will be using the REUSE_ALV_GRID_DISPLAY for this example application. Tables used for output generation SPFLI.
Step1 : Fetch data from the SPFLI table :
SELECT * FROM SPFLI INTO TABLE IT_SPFLI.
Step2 : Generate the ALV output using the function module REUSE_ALV_GRID_DISPLAY
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
I_STRUCTURE_NAME = SPFLI
IT_OUTTAB = IT_SPFLI.