Skip to Content
0
Former Member
May 08, 2013 at 12:16 PM

get_selected_elements doesn't work anymore after sorting the ALV

32 Views

Hi all,

everything works fine if I select more than one row in an alv table. But if I sort the alv before by clicking on a column header the get_selected_elements doesn't work any more and lt_selected_elements is empty. What can I do? Any ideas? Here is the code:

DATA:

lo_nd_t_rusmnt_rau TYPE REF TO if_wd_context_node,

lo_selected_element TYPE REF TO if_wd_context_element.

DATA:

lt_selected_elements TYPE wdr_context_element_set.

DATA:

ls_ui_rusmnt_rau TYPE ztpzp_s_ui_rusmnt_rau.

* Initialisation

CLEAR: pet_ui_rusmnt_rau.

* Get selected rows in employee list...

lo_nd_t_rusmnt_rau = wd_context->get_child_node( name = wd_this->wdctx_t_rusmnt_rau ).

lt_selected_elements = lo_nd_t_rusmnt_rau->get_selected_elements( ).

LOOP AT lt_selected_elements INTO lo_selected_element.

lo_selected_element->get_static_attributes( IMPORTING static_attributes = ls_ui_rusmnt_rau ).

APPEND ls_ui_rusmnt_rau TO pet_ui_rusmnt_rau.

ENDLOOP.

The context node has the Cardinality 0..n, Selection also 0..n and the Initialization Lead Selection is empty.

In the wd_init I defined multi_no_lead:

lr_cmdl->if_salv_wd_table_settings~set_selection_mode( cl_wd_table=>e_selection_mode-multi_no_lead ).

Thanks, Susanne