cancel
Showing results for 
Search instead for 
Did you mean: 

get_selected_elements doesn't work anymore after sorting the ALV

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

once you sort alv it take control over internal table index  created by node we lost.

Former Member
0 Kudos

And what can I do? I don't really know.

Former Member
0 Kudos

can you share your requirement.

Answers (0)