Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Multiple ALV Grid Controls per report - problem with default displ.variant

Hi,

I have a report with few screens called sequentialy. Each one of the screens has implemented own instance of ALV Grid Control within custom container, means:

- screen 100 has container Cont100 and grid control "grid100",

- screen 110 has container Cont110 and grid control "grid110"

- screen 120 has container Cont120 and grid control "grid120"

and so on...

Each one of the grid controls is initialized with own field catalog table, with own layout and variant structure definitions. My problem occurs when the user changes the display variant for some of the grid controls and save the layout variant using "default setting" checkbox. In this case next time the program is started all other grid controls behaves like they don't have their own variant definitions, but uses the default setting of the mentioned screen. This leads (usualy) to unsuable grid controls by default, because usualy different controls have no equal field-definition tables. I have the same behaviour even when there are more than 1 ALV grids on a single screen (for example - 2).

For now I don't provide variant variables at selection screen, but it seems there is no way to provide such variables for each one of the grid-controls.

Is anyone aware how to control this? Means no matter if there is default setting in use for some of the grid-controls, how to manipulate other grid-controls not to use this default setting?

Many thanks in advance.

Regards,

Ivaylo Mutafchiev

Tags:
Former Member
Former Member replied

When working with multiple ALV grids on the same screen or in the same program, you need to use the Handle feature to clearly define which variants/layouts go with each grid. I have gotten in the habit of always using this feature even if I only have one grid.

* Support ALV Layouts.

  gwa_variant    TYPE disvariant,

. . .


*   Set handle so that any ALV layouts created by the user will only
*    apply to the table they are created for.  

    gwa_variant-handle = ‘A100’.

. . .

*   Display via ALV.

    CALL METHOD gr_alv->set_table_for_first_display
        EXPORTING is_variant       = gwa_variant
                  is_layout        = gwa_layout
                  i_save           = 'A'
        CHANGING  it_outtab        = cpt_stat
                  it_fieldcatalog  = gt_fieldcat.

2 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question