cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically Remove Lead Selection in Table

Former Member
0 Kudos

Hi,

in a method, I want to remove all selected elements, including the Lead Selection of my table. My Context specifies that selection is 0..n. The method IF_WD_CONTEXT_NOTE->CLEAR_SELECTION( ) unselect all selected elements, except the lead selection. I would like to do like if user hold Control and press on his lead selection line.

Thanks

Davy

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Davy,

On the Button click event write the following code.

  • This is for Flight Node

data lo_nd_flight type ref to if_wd_context_node.

data lo_el_flight type ref to if_wd_context_element.

data ls_flight type wd_this->element_flight.

  • navigate from <CONTEXT> to <FLIGHT> via lead selection

lo_nd_flight = wd_context->get_child_node( name = wd_this->wdctx_flight ).

lo_nd_flight->CLEAR_SELECTION( ).

  • This will reset the lead selection.

lo_nd_flight->SET_LEAD_SELECTION_INDEX( '-1' ).

Reward Point if this answers your question.

With Kind Regards,

Arjun

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Davy,

Try out this code, for me it works fine:

lr_allsu_node = wd_context->get_child_node( name = wd_this->wdctx_all_offerred_su ).

CALL METHOD lr_allsu_node->get_element

" EXPORTING

" index = USE_LEAD_SELECTION

receiving

node_element = lr_allsu_elem

.

CALL METHOD lr_allsu_elem->set_selected

EXPORTING

flag = abap_false.

I hope this solves your problem.

Thanks

Aditya

Edited by: Aditya Kumar on Dec 21, 2007 5:53 AM

Edited by: Aditya Kumar on Dec 21, 2007 6:01 AM

Former Member
0 Kudos

Hello Aditya,

I already tried this and it does not work. It's like calling the clear_selection(). It only concerns the "Additionnal" selection, but it seems that the Lead Selection has a special rules that does not appy to this.

Any other idea?

Regards,

Davy

Former Member
0 Kudos

Hi,

Do this on your button action

data :

lo_nd_node TYPE REF TO if_wd_context_node,

lo_el_node TYPE REF TO if_wd_context_element,

ls_node TYPE wd_this->element_node.

data:

lo_element TYPE REF TO if_wd_context_element,

lt_elements TYPE wdr_context_element_set.

lo_nd_node = wd_context->get_child_node( name = 'NODE" ).

lo_el_node = lo_nd_node->get_element( ).

This Mehod Will Take all the selected element

CALL METHOD lo_nd_node->get_selected_elements

RECEIVING

set = lt_elements.

Here It will Remove

LOOP AT lt_elements INTO lo_element.

lo_element->remove_element( element = lo_el_node ).

endloop.

Former Member
0 Kudos

Hi Varun,

you did not exactly answered to my question. I don't want to delete the actual element in Lead Selection, I just want to UNSELECT it. It's easy to unselect the selected elements, but to unselect the lead selection seems quite tricky.

Any other hints?

Regards,

Davy

Former Member
0 Kudos

Sorry, I had taken in worng way.......

Former Member
0 Kudos

hi davy......

in cl_wd_table.... you have a method set_on_lead_select. try passing null valu to this.

---regards,

alex b justin

Former Member
0 Kudos

Hello Alex,

I think that the method set_on_lead_select is there to define the method to be called when the Lead Selection change. It is not to actually set/unset the lead selection.

Regards,

Davy