Use
Display an output table in the ALV Grid Control instance. In the call sequence, you must specify either a reference structure of the Data Dictionary or a suitable
field catalog. Before execution, you can use optional parameters to load a layout, sort the table by fields, set a filter for columns and define properties of the grid control.If you want to refresh the data displayed in the output table, use method
Report
BCALV_GRID_DEMO of development class SLIS illustrates the simplest way to call this method.Prerequisites
The output table must either be defined globally or be a public attribute of a class.
Features
CALL METHOD <
ref. var. to CL_GUI_ALV_GRID>->set_table_for_first_display EXPORTING
I_BUFFER_ACTIVE =
CHANGING
IT_OUTTAB =
Parameter |
Meaning |
I_BUFFER_ACTIVE |
Flag to be set by the application if the method call is static. This means the method is always called with the same field catalog. In this case, the field catalog can be held in a special buffer. This accelerates the display of small lists, in particular. |
I_STRUCTURE_NAME |
Name of the DDIC structure (for example, 'SFLIGHT') for the data in the output table. If you specify this parameter, the field catalog is generated automatically. |
IS_VARIANT |
Determines the layout to be used for displaying the output table. If you use this parameter, you must at least fill field REPORT of the structure of type DISVARIANT . |
I_SAVE |
Determines the options available to the user for saving a layout:
|
I_DEFAULT |
This parameter determines if the user is allowed to define default layouts:
If default layouts are allowed and if such a layout exists and no other layout is specified in IS_VARIANT , the default layout is automatically loaded when this method is called. |
IS_LAYOUT |
Determines properties of the grid control. The layout structure has nothing to do with the layout for saving filter, sort, and column properties. |
IS_PRINT |
Parameter for printing on the backend |
IT_SPECIAL_GROUPS |
If in the field catalog the columns were grouped together with field SP_GROUP , you must pass a table with texts for these groups. On the current layout window, it is then possible to use a list box to restrict column selection to one of these groups. |
IT_TOOLBAR_EXCLUDING |
This table contains function codes of the toolbar that you want to hide for the lifetime of the ALV Grid Control. The function codes are constant attributes and are prefixed with MC_FC_ . |
IT_HYPERLINK |
This table assigns a hyperlink address (field HREF of LVC_S_HYPE ) to each handle (field HANDLE of LVC_S_HYPE ). Using this handle, you can then include hyperlinks in the grid. |
IT_ALV_GRAPHICS |
Settings for displaying the ALV list as a diagram (for example, axis labels). The row type of the table has two fields (variables/value pairs): |
IT_OUTTAB |
Output table with the data to be displayed |
IT_FIELDCATALOG |
Determines the structure of the output table and the format of the data to be displayed |
IT_SORT |
Table with sort properties for columns that are to be sorted initially |
IT_FILTER |
Table with filter properties for columns for which a filter is to be set initially |
For an overview, see:
Methods of Class CL_GUI_ALV_GRID
Activities
During this call, the ALV Grid Control generates the field catalog for the output table
automatically before display, using a DDIC structure:DATA: GRID1 TYPE REF TO CL_GUI_ALV_GRID,
GT_SFLIGHT TYPE TABLE OF SFLIGHT.
<Instantiation of
GRID1 and integration into screen>CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
CHANGING IT_OUTTAB = GT_SFLIGHT.
Explicitly pass the field catalog:
DATA: GRID1 TYPE REF TO CL_GUI_ALV_GRID,
GT_SFLIGHT TYPE TABLE OF SFLIGHT,
GT_FIELDCAT TYPE LVC_T_FCAT.
<
Manual or semi-automatic generation of the field catalog >CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
CHANGING IT_FIELDCATALOG = GT_FIELDCAT
IT_OUTTAB = GT_SFLIGHT.