cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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!

Ingmar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ingmar,

Have two nodes, one for your first ALV, and another for the second ALV to display the selected elements. Have the nodes in the component controller and map them to the views. After selection, when you navigate to the second view (in the outbound plug handler or in a button event handler), do a get_selected_elements on your node. Then do add_elements to the second node. In the inbound plug handler of the second view, after initializing the component usage for the ALV, you only need to do a set_data of the second node. Hope this helps.

Regards

Nithya

Former Member
0 Kudos

Thanks Nithya for your answer!!

Could you please be more detailed at the step:

<i>Then do add_elements to the second node.</i>

I don' know what to do there and where exactly.

Do you have some example code for me?

Thanks a lot!!

Regards

Ingmar

Former Member
0 Kudos

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.

endloop.

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.

Regards

Nithya

Answers (2)

Answers (2)

Former Member
0 Kudos

hiii

create two custom containers in first custom container place first alv and in second container place second view maintane the layout as grid layout capture the rows which u click in coding so that it shouid fire second container.

Former Member
0 Kudos

hiii

create two custom containers in first custom container place first alv and in second container place second view maintane the layout as grid layout capture the rows which u click in coding so that it shouid fire second container.