Show TOC Start of Content Area

Function documentation set_table_for_first_display  Locate the document in its SAP Library structure

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.

Note

If you want to refresh the data displayed in the output table, use method refresh_table_display. Method set_table_for_first_display must only be called a second time if the structure of the output table changes.

Report BCALV_GRID_DEMO of development class SLIS illustrates the simplest way to call this method.

Prerequisites

Caution

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       =
<any type (ANY)>
            I_STRUCTURE_NAME      =
<string of type DD02L-TABNAME>
            IS_VARIANT            =
<structure of type DISVARIANT>
            I_SAVE                =
<var. of type CHAR01>
            I_DEFAULT             =
<var. of type CHAR01>
            IS_LAYOUT             =
<structure of type LVC_S_LAYO>
            IS_PRINT              =
<structure of type LVC_S_PRNT>
            IT_SPECIAL_GROUPS     =
<internal table of type LVC_T_SGRP>
            IT_TOOLBAR_EXCLUDING  =
<internal table of type UI_FUNCTIONS>
            IT_HYPERLINK          =
<internal table of type LVC_T_HYPE>
            IT_ALV_GRAPHICS       =
<internal table of type DTC_T_TC>

      CHANGING
            IT_OUTTAB             =
<internal table>
            IT_FIELDCATALOG       =
<internal table of type LVC_T_FCAT>
            IT_SORT               =
<internal table of type LVC_T_SORT>
            IT_FILTER             =
<internal table of type LVC_T_FILT>

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:

      'X':         global saving only

      'U':         user-specific saving only

      'A':         corresponds to 'X' and 'U'

      SPACE:   no saving

I_DEFAULT

This parameter determines if the user is allowed to define default layouts:

      'X':       Default layouts allowed (default setting)

      SPACE: Default layouts not allowed

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

One of the fields of the structure LVC_S_PRNT is PRINT_CTRL, which you use to provide the print parameters.

If you use PRINT_CTRL, make sure you first initialize the parameters by using the UNSET_PRINTPARAMETER function module.

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):

      PROP_ID: Assign a constant attribute of the class CL_ALV_GRAPHICS_CU with prefix CO_PROPID_ to this field to determine the changes to be made to the graphic. Use the CL_ALV_GRAPHICS_CU=>CO_PROPID_TITLE attribute, for example, to refer to the title of the diagram.

      PROP_VAL: The value of the relevant topic, for example, 'My Title'.

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

Example

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.

Example

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 >
<Instantiation of
GRID1 and integration into screen>

CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
     CHANGING  IT_FIELDCATALOG = GT_FIELDCAT
               IT_OUTTAB       = GT_SFLIGHT.

 

 

 

 

 

 

 

 

 

 

End of Content Area