Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

select rows in alv and show them in another alv in another view

Hi experts,

I have an ALV and want to select a couple of rows in it. Then these selected rows should appear in a second view in another ALV. Folr example, if I have 10 rows in the first ALV, and select 3 of them, these 3 should then come up in the other alv in the second view. How can I do that?

Thanks a lot for your help!



Hi Ingmar,

Have a look at the sample code below:

data: lr_node1 type ref to if_wd_context_node,

lr_node2 type ref to if_wd_context_node,

lt_selected_elements type wdr_context_element_set,

lr_element type ref to if_wd_context_element,

stru type <your structure type>,

itab type table of <your structure type>.

lr_node1 = wd_context->get_child_node( 'NODE1' ).

lr_node2 = wd_context->get_child_node( 'NODE2' ).

lt_selected_elements = lr_node1->get_selected_elements( ).

loop at lt_selected_elements into lr_element.

lr_element->get_static_attributes( importing static_attributes = stru ).

append stru to itab.


lr_node2->bind_elements( itab ).

You have to get each row using get_static_attributes and append it to an internal table. Then bind the table to the other context node t display the selected elements only. Hope this helps.



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question