Advanced List Viewer
The ALV Grid control is a flexible tool for displaying lists.
The ALV Grid control is used to build non-hierarchical, interactive, and modern-design lists.
The ALV Grid control provides typical list functions as sorting, filtering, summing, etc.,
while also gives the opportunity to develop user functions where needed.
It presents numerous interfaces like Excel Inplace and Crystal Reports.
The wrapper class implemented to encapsulate ALV Grid functionality is "CL_GUI_ALV_GRID".
While preparing a list to be displayed via an ALV grid control, we have some basic components to prepare. These are;
i. List data: Obviously, this is the data in an internal table to be listed. Standard ALV functions except sorting makes just read access to the list data. However, sorting changes state of the internal table. The internal table holding list data may be of any flat type. Deep types are only allowed when set for some functionalities of ALV Grid.
ii. Field Catalog: We use another internal table to define specifications on how the fields of our list will be displayed. This internal table is called the
"field catalog". The field catalog must comprise some technical and additional information about display options for each column to be displayed. There are three procedures to generate the field catalog as "Automatic generation", "Semi-automatic generation", and "Manual generation". The internal table for the field catalog must be referenced to the dictionary type "LVC_T_FCAT".
iii. Layout Structure: We fill a structure to specify general layout options for the grid. With this structure we can set general display options, grid customizing, totals options, color adjustments etc... The layout structure must be of type "LVC_S_LAYO".
iv. Event Handler: We should define and implement an event handler class if we want to handle events triggered by the ALV Grid instance. After creating ALV Grid instance, we must register an instance of this event handler class to handle ALV Grid events.
v. Additional Data: To trigger some additional features of ALV Grid we can have some additional data to pass as parameters. For example, initial sorting criteria, buttons to be deactivated
Now lets start with a simple example program .
Create an object of class CL_GUI_CUSTOM_CONTAINER.
Create an object of class CL_GUI_ALV_GRID.
Populate the internal table that you want to display on the GRID.
Call the screen that contains the CUSTOM CONTAINER, in which you want to display the list .
Call the screen.
Create a custom container.
Call the method SET_TABLE_FOR_FIRST_DISPLAY of class CL_GUI_ALV_GRID and pass the required parameters.