Entering content frame

Process documentationSaving Layouts Locate the document in its SAP Library structure

Purpose

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

See also report BCALV_GRID_09 in development class SLIS .

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 Flow

  1. Declare a variable for determining the saving options available to the user, and a structure for identifying a layout:
  2. DATA: X_SAVE,                     "for Parameter I_SAVE
          GS_variant TYPE DISVARIANT. "for parameter IS_VARIANT

  3. The structure of type DISVARIANT must contain the report ID as a minimum:
  4. G_REPID = SY-REPID.
    GS_variant-REPORT = G_REPID.

  5. Determine the saving options available to the user:
  6. X_SAVE = 'U'.    "layouts can only be saved as user specific ones

  7. Pass both variables using call set_table_for_first_display :

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.

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.

 

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.

 

 

 

 

 

 

Leaving content frame