Process documentationSaving Layouts Locate this document in the navigation structure

 

The standard function Change Layout can be accessed by users by clicking an icon in the toolbar. This icon allows users to adjust the current layout to their requirements for the lifetime of the control instance.

The application developer determines if users are allowed to save layouts and defines the saving options available.

Note Note

See also report BCALV_GRID_09 in development class SLIS.

End of the note.

Prerequisites

In the default setting, users can save a default layout. If such a default layout exists, it is loaded when method set_table_for_first_display is called. If you do not want to allow users to create default layouts, set parameter I_DEFAULT of this method to SPACE.

Process

  1. Declare a variable for determining the saving options available to the user, and a structure for identifying a layout:

    Syntax Syntax

    1. DATA:	X_SAVE, "for Parameter I_SAVE
      	GS_variant TYPE DISVARIANT. "for parameter IS_VARIANT
    End of the code.
  2. The structure of type DISVARIANT must contain the report ID as a minimum:

    Syntax Syntax

    1. G_REPID = SY-REPID.
      GS_variant-REPORT = G_REPID.
    End of the code.
  3. Determine the saving options available to the user:

    Syntax Syntax

    1. X_SAVE = 'U'. "layouts can only be saved as user specific ones
    End of the code.
  4. Pass both variables using call set_table_for_first_display:

    Syntax Syntax

    1. CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
      	EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
      		IS_VARIANT = GS_variant
      		I_SAVE = X_SAVE
      	CHANGING IT_OUTTAB = GT_SFLIGHT.
    End of the code.

    Caution Caution

    If you pass only the actual parameter for IS_VARIANT, users can only load layouts but not save new ones. If you use parameter I_SAVE, passing a layout structure with IS_VARIANT is a required step.

    End of the caution.

Result

The toolbar now includes a pull-down menu next to the layout icon that allows users to save and load layouts. Depending on the value of parameter I_SAVE, the following options for saving layouts are available:

Saving Options for Layouts

I_SAVE = SPACE

Layouts cannot be saved.

I_SAVE = 'U'

Only user-defined layouts can be saved.

I_SAVE = 'X'

Only global layouts can be saved.

I_SAVE = 'A'

Both user-defined and global layouts can be saved.