Skip to Content

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

How to preselect all rows before displaying ALV report

I would like to select all rows before sending ALV Grid Display. User then can unselect couple of rows for further processing. How do I do that ?. Im using Method grid1->SET_TABLE_FOR_FIRST_DISPLAY for ALV Report Display. Any help appreciated.

Former Member
Former Member replied

Ok,

I've started the editor and check my code. I made few small mistakes (like with this exporting/importing), here's the sample - correctly working - code:


DATA: it_selected TYPE lvc_t_row,
      wa_selected TYPE lvc_s_row,
      wa_sflight TYPE sflight,
      ltp_layout TYPE lvc_s_layo.

     SELECT *
       FROM sflight
       INTO TABLE gi_sflight.

ltp_layout-stylefname = 'CELLTAB'.
ltp_layout-sel_mode = 'A'.

LOOP AT gi_sflight INTO wa_sflight.
      wa_selected-index = sy-tabix.
      APPEND wa_selected TO it_selected.
ENDLOOP.

*   * Load data into the grid and display them
     CALL METHOD go_grid->set_table_for_first_display
       EXPORTING i_structure_name = 'SFLIGHT'
                 is_layout            = ltp_layout
                 i_save = 'A'
       CHANGING  it_outtab        = gi_sflight.


CALL METHOD go_grid->set_selected_rows
      EXPORTING
        it_index_rows = it_selected.

This time it is 100% correct.

Edited by: Marcin Cudo on Apr 11, 2010 2:13 AM

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question