Skip to Content

Column selection in ALV not working


I have a strange problem with an OO alv.

When I select one or more columns and press one of the standard alv functions like sort or summarize, the selected columns are not recognized as selected, and a popup says "Select at least one column".

The column is clearly selected as you can see:

What is wrong with my coding:

ls_layout-cwidth_opt = 'X'.

ls_layout-sel_mode = 'A'.

ls_layout-zebra = 'X'.

ls_layout-stylefname = 'CELLTAB'.

ls_layout-no_rowmark = 'X' .

CALL METHOD cr_alv_grid->set_table_for_first_display


is_layout = ls_layout

is_variant = ls_variant

i_save = 'A'


it_outtab = ct_output[]

it_fieldcatalog = ct_fcat.

Best regards

Snap1.jpg (49.5 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Dec 11, 2013 at 11:31 AM


    I narrowed the problem down to this code called in an event handler for event data_changed_finished

    gs_stbl-row = 'X'.

    gs_stbl-col = 'X'.

    CALL METHOD gr_main_alv_grid->refresh_table_display


    is_stable = gs_stbl.

    The purpose of this code was to refresh totals and sub totals of an input column after change of one of the input values.

    This works, but at the same time it seems to de-select the columns before the standard functions are called. 😔

    Add a comment
    10|10000 characters needed characters exceeded

    • Found a solution.

      For some reason event data_changed_finished is raised for every action even when no data is changed.

      So my solution is to use the event data_changed to set a flag that data was changed.

      Then in the data_changed_finished, I only call refresh_table_display if data was actually changed.

      With this solution it is not possible to change data and use one of the SAP standard ALV functions at the same time, but that is not a major problem in my scenario.

      Probably the workaround suggested by Byju is even better, but I'm happy with my own.

  • Posted on Dec 11, 2013 at 12:01 PM

    Hi Thomas,

    When generating fieldcatalog try to activate the do_sum catalog property, like this:

    loop ct_fcat Into wa_fieldcat.

    if wa_fieldcat-fieldname = 'your_fieldname'.

    wa_fieldca-do_sum = 'X'.




    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 11, 2013 at 12:29 PM


    If we want to select the multiple columns in the alv by using ooabap

    so in the class CL_GUI_ALV_GRID it is having one method SET_TABLE_FOR_FIRST_DISPLAY

    it is having one importing parameter IS_LAYOUT of type lvc_s_layo type

    and this structure contains one field SEL_MODE and set that field value as 'A'.

    then we can select the multiple rows in alv grid



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.