cancel
Showing results for 
Search instead for 
Did you mean: 

Select Multiple Rows in a Table without CTRL

Former Member
0 Kudos

Expecting the user to press "Ctrl" when selecting multple rows is very unfriendly and unintuitive. We'd like the row selection to work as in ALV where you just select multiple rows by clicking on them.

We've set the tables rowSelectable to true and selectionMode to 'multi' but we still cannot select multiple rows without the CTRL hotkey.

This issue apparently [arose before|] but wasn't resolved.

System Details

SAP_ABA 701 0006 SAPKA70106

SAP_BASIS 701 0006 SAPKB70106

SAP_AP 700 0019 SAPKNA7019

Accepted Solutions (1)

Accepted Solutions (1)

saravanan_narayanan
Active Contributor
0 Kudos

Hello Marc,

try the following

in the table properties

set 'selectionChangeBehaviour' to Manual

set 'selectionMode' to Multi

create an action for OnSelect event (create with the option 'Transfer UI event Parameters )

in the OnSelect event handler method

get the index of the NEW_LEAD_SELECTION element by calling new_lead_selection->get_index( )

set the selected index of the context by calling IF_WD_CONTEXT_NODE->get_selected( index = lv_index )

this will work like the 'ctrl' selection.

hope this helps.

BR, Saravanan

Former Member
0 Kudos

This looks like a promising approach. However now, when a second line is clicked, the first line is unselected. I presume if_wd_context_node->set_lead_selection_index( ) only sets a single item? We would also need logic for unselecting an item.

saravanan_narayanan
Active Contributor
0 Kudos

Hello Marc,

you need to call IF_WD_CONTEXT_NODE->set_selected(index = lv_index) sorry for the typo in my previous comment.

by calling IF_WD_CONTEXT_NODE->set_selected method wont remove the lead selection.

to unselect the records, you can call the same method by passing the FLAG value as abap_false.

so for your usecase the logic will be like this in the ON_SELECT event handler

1. get the index of the new_lead_selection

2. check whether this is already seleted in the context node by calling IF_WD_CONTEXT_NODE->IS_selected

3. if already selected then call IF_WD_CONTEXT_NODE->set_selected( flag = abap_false index = lv_index)

if not selected then call IF_WD_CONTEXT_NODE->set_selected( index = lv_index )

Hope this solved your problem.

BR, Saravanan

Edited by: Saraa_n on Jul 6, 2011 11:52 AM

Former Member
0 Kudos

Wonderful thanks!


  lv_index   = new_lead_selection->get_index( ).
  lo_node = NEW_LEAD_SELECTION->get_node( ).
  IF lo_node->is_selected( index = lv_index ) = 'X'.
    lo_node->set_selected( flag = abap_false index = lv_index ). " Deselect
  ELSE.
    lo_node->set_selected( lv_index ). " Select
  ENDIF.

I still think WDA should support this behaviour as an option for the table control!

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Marc,

In table properties if you select selectionmode to MULTI. In table at first starting column you get one menu type option. This is

for Select All and Deselect All.

OR

You can create one button for select all and write code to select all rows in taht table.

using set_selected method.

Cheers,

Kris.

Former Member
0 Kudos

We have already got a select all menu. What we need is select multiple without Ctrl. I don't know which planet the SAP developers live (and the HTML SELECT box developers) on but in the real world, nobody knows you need to press Ctrl to select multiple options. Maybe Thomas can feed this into the next release??!!

former_member199125
Active Contributor
0 Kudos

hi..

in webdynpro, in order to select multiple rows we must use Ctrl, even in alv table also.

work around is there, like add one more column to table, add chech box element to that column.. and perform operations based on checkbox selected rows.

Regards

Srinivas