cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting all rows in ALV on a button click

Former Member
0 Kudos

Hi Experts

Hi,

I have a dynamic ALV table. I also have a button 'Select All Rows'. On clicking the button I want all the rows in the ALV table selected which is done by using set_selected method at the context node.

All the rows in the alv is selected after clicking select_all except for the first row.

Need your inpts to solve the same.

Regards

Karthick

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Thx for your opinions. The solution for this issue is selection mode "Multi_no_lead" which contradicts if u set initialize lead selection at context node...

Former Member
0 Kudos

Use the folowing code

*... get model

data:

lr_model type ref to cl_salv_wd_config_table.

lr_model ?= me->r_model.

*... get columns

data:

ls_column type salv_wd_s_column_ref,

lt_column type salv_wd_t_column_ref.

lt_column = lr_model->if_salv_wd_column_settings~get_columns( ).

data:

l_selected type abap_bool.

loop at lt_column into ls_column.

l_selected = abap_false.

read table value transporting no fields with key column = ls_column-id.

if sy-subrc eq 0.

l_selected = abap_true.

endif.

try.

me->if_salv_bs_model_column~set_selected(

column = ls_column-id

value = l_selected ).

catch cx_salv_bs_sc_object_not_found. "#EC NO_HANDLER

endtry.

endloop.

Former Member
0 Kudos

Hi Jaques

The icon doesnt appear in my alv table used in WD Abap application. Is there any settings tobe done at the alv comp. interface otherthan selection mode ? If yes kindly update..

My selection critearia at the context is at 0...n only but still the selection is set at the first element.

Thanks and Regards

Karthick

Former Member
0 Kudos

Hi Karthick,

Why are you using a separate button for select all?

By default, the ALV table has the select all option. There is an icon which appears at the top left corner of the table. Clicking on it provides you with 2 options - Select All and Delete selection. You can use this. But i your 'Selection' property of the context node bound the the table must be 0...n.

Regards

Wenonah