cancel
Showing results for 
Search instead for 
Did you mean: 

Compare two selections

Former Member
0 Kudos

Hi experts,

I have a selectionable table and I need to compare the selections, ie: I select one row and my program selects also others rows of my table that has the same 'number EM' (it is a column of my table). When I unmark a row of my table, automatically I have to deselect all the rows that have the same 'number EM'. Is there a method that I can to use for to know when a user has deselected this row? Or is possible to store the precedent selection, so I can to compare?

Tks a lot.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

The node to which table is bound is of type if_wd_context_node in this interface there is a method to get the elements

that are selected.. GET_SELECTED..

This method returns the elements(rows) that are selected...BY doing this you can get the unselected ones..

If the selection mode is MULTI (then you can have more than one element being selected right)...

Now loop through these elements and get the records and do the processing..

lt_elementset = lr_node->get_selected( ). "please refer to the above interface.
loop at lt_elementset into ls_element.
ls_element->get_static_attributes
exporting
static_attributes = ls_table.

* do the processing as you have the record content in ls_table...
endloop.

Can you be more clear in your requirement for better understanding

Regards,

Lekha.

Edited by: Lekha on Nov 27, 2009 8:07 PM

Former Member
0 Kudos

Uhm, I used the method GET_LEAD_SELECTION for retrieve the current element, after I check if this element is selected or not (with the method IS_SELECTED). But I noticed that this method returns always that the element is selected, also if the element is NOT selected. Why? I have a table with the selection mode is MULTI and the property selectionChangeBehaviuor is "auto". Can you help me to understand why the element returns always selected with the IS_SELECTED method also if it is not selected,please?

Tks a lot in advance...

Former Member
0 Kudos

get_lead_selection always retuns you the lead selection inthe case on SINGLE mode.

If you have the set the selection mode of table as MULTI then in the relevant handler, use the above GET_SELECTED method of if_wd_context_node to get the selected ones...

MULTI NO LEAD option mode doesnot have any lead selection use can select more than one row.

MULTI has by default a lead selection set...but user can select more than 1 row. In this case getleadselection retruns the lead selection row..

Where are you going wrong.

Former Member
0 Kudos

Ok, but if I use the GET_SELECTED method I have problems because I dont'know how can to understand which are the rows that the user has deselected. How can I do for retrieve the rows (or row) that the user has DESELECTED?

TKS!

Former Member
0 Kudos

Hi,

First try to gget the elements that are selected GET_SELECTED_ELEMENTS of if_wd_context_node.

Do your table has any primary key....

If not, you need to get the element count using get_elenment_count of if_wD_context_node and loop through them

and use the is_selected method of iif_wd_context_element.

Now this will have all the records and also using this is_selected you can have the selected element..

if is_selected is true then store them to other internal table and false store them to other Internal table

Now you have got both of them.

Try this out...

Regards,

Lekha.

Edited by: Lekha on Nov 30, 2009 4:31 PM

Former Member
0 Kudos

otherwise is it possible to have the list of the row deselected? Is there a method?

Tks a lot...