Skip to Content

Sorting criteria doesn't save with layout variant on ALV GRID CONTROL

Hi all,

I have problem with ALV GRID from CL_GUI_ALV_GRID. After setting and saving layout (sort column, filter values etc.), layout criteria seems no to be saved. When I start report once again and choose my layout, sorting criteria doesn't work.

I am passing parameters in method set_table_for_first_display while creating ALV GRID:
is_variant = g_variant
i_save = 'A'
i_default = ''

I've tested all configuration of parameters and problem still exist. If somebody has ever had this kind of issue please help.
In other way I will be forced to use cl_salv_table to create ALV report.


Thanks for any help
Jakub

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Feb 13 at 04:45 AM

    hi

    for saving layout in oops alv.

    u have to pass values to method set_table_for_first_display like below

    DATA:GV_HANDLE TYPE DISVARIANT-HANDLE,
    GV_LOG_GROUP TYPE DISVARIANT-LOG_GROUP.

    CLEAR:GV_HANDLE,GV_LOG_GROUP.
    GV_HANDLE = '9999'. " this is any value
    GV_LOG_GROUP = '9999'. " this is any value

    CLEAR LS_DISVARIANT.
    LS_DISVARIANT-REPORT = SY-REPID.
    LS_DISVARIANT-HANDLE = GV_HANDLE.
    LS_DISVARIANT-LOG_GROUP = GV_LOG_GROUP.

    CALL METHOD GO_ALV->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    IS_VARIANT = LS_DISVARIANT " this is mandatory
    I_SAVE = 'X' " this is mandatory

    I_DEFAULT = 'X' " this is mandatory
    IS_LAYOUT = LS_LAYOUT
    CHANGING
    IT_OUTTAB = GT_FINAL
    IT_FIELDCATALOG = GT_FIELDCAT
    EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR = 2
    TOO_MANY_LINES = 3
    OTHERS = 4.

    Add comment
    10|10000 characters needed characters exceeded