Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

using cl_salv_table for ALV display

Former Member
0 Kudos

Hi gurus,

I am using cl_salv_table class for my alv display.

Does any one have idea how to make the ALV grid multi-line selectable?

Do we have to have a 'SEL' field for internal table ? anf if we have where can we mention that it is a selfield, as we do in classical ABAP.

Regards,

1 ACCEPTED SOLUTION

karsten_korte
Participant
0 Kudos

what about this:


DATA: 
      lr_selections TYPE REF TO cl_salv_selections.

* Selektion
      lr_selections = lr_alv_table->get_selections( ).
      lr_selections->set_selection_mode( lr_selections->MULTIPLE ).

8 REPLIES 8

karsten_korte
Participant
0 Kudos

what about this:


DATA: 
      lr_selections TYPE REF TO cl_salv_selections.

* Selektion
      lr_selections = lr_alv_table->get_selections( ).
      lr_selections->set_selection_mode( lr_selections->MULTIPLE ).

0 Kudos

yes, but for this should we have extra field say 'SEL' in alv internal table?

and should we mention that this field is selfield like in classic alv we do in layout? if so where to do that?

0 Kudos

no, you select a row by clicking anywhere in this row. For multiple selection hold down ctrl- or shift-key.

0 Kudos

i am sorry its stil not clear to me.

Once we set multiple selections, how do we pass this information to cl_salv_table ?

or can we do this?


DATA:
     lr_selections TYPE REF TO cl_salv_selections.
     lt_rows type SALV_T_ROW.
     l_rows like line of lt_rows.

* Selektion
     lr_selections = lr_alv_table->get_selections( ).
     lr_selections->set_selection_mode( lr_selections->MULTIPLE ).
   lt_rows = lr_selections->get_selected_rows ( ).


and this gives only row numbers from the table.

Where can we read the actual records selected !!!

neither i can do this


 my_salv_table->r_selections->set_selection_mode( if_salv_c_selection_mode~multiple ).

Edited by: Trivenn Mudivar on Aug 13, 2008 1:55 PM

Edited by: Trivenn Mudivar on Aug 13, 2008 1:55 PM

Edited by: Trivenn Mudivar on Aug 13, 2008 1:56 PM

0 Kudos

  my_salv_table->r_selections->set_selection_mode( if_salv_c_selection_mode~multiple ).

R_SELECTIONS is a private attribute of CL_SALV_TABLE and you don't have direct access to private attributes.

You can only reach the selections by:


     lr_selections = lr_alv_table->get_selections( ).

narin_nandivada3
Active Contributor
0 Kudos

Hi,

Please check this thread for solution..

Hope this would help you.

Good luck

Narin

0 Kudos

Narin!

I appreaciate for the posting, but it doesnot help in any sense. I am not using regular OO ALV display .i am not creating any grids or containers.

I am using CL_SALV_TABLE.

Regards,

0 Kudos

      cl_salv_table=>factory(
        IMPORTING
          r_salv_table   = gr_alv_table
        CHANGING
          t_table        = gt_data ).
...
        lr_selections    = gr_alv_table->get_selections( ).
        lt_rows = gr_selections->get_selected_rows( ).

lt_rows contains the row-indices of gt_data, so you can read from table with index (and loop to get all data):


  LOOP at lt_rows INTO lf_row.
    READ TABLE gt_data INTO gs_data
                   INDEX lf_row.
     ...
  ENDLOOP.

Edited by: Karsten Korte on Aug 13, 2008 5:05 PM