cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass selected records from one table to another ?

Former Member
0 Kudos

Hi,

In my view i have designed a table with certain records. I need to pass only specific records of this table to another table which been designed in another view. Can anybody please give sum idea for this.

Rgds

Sudhanshu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What you can do is create a global internal table i.e Attribute ( type of your table ) in the Component Controller. Make it Public.

Store the records that you want to display in the table in your second view in this internal table and bind this internal table to the node of your second view.

l_node = wd_context->get_child_node( 'NODE2' ).
l_node->bind_table( wd_comp_controller->lt_table ).

Regards,

Radhika.

Answers (3)

Answers (3)

Former Member
0 Kudos

hello All,

Thank you so much for your replies (specially Sourav)..closing this blog accordingly.

rgds

sudhanshu

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Maybe I am missing some aspect of what you are asking for, but it seems quite straight forward. You just loop through the records in your table and then append the records you want to pass into a second table.

Two views can't share data directly. You always have to pass back through the component controller or a custom controller to share data.

Perhaps if you describe more about the process you want to acomplish or where exactly you are having problems, we could post a more specific response.

Former Member
0 Kudos

hi,

Refer the below code:

1. I have selected some data from the table.

2. The selected data is moved to some other internal table.

3. Internal table is further binded to the node in which data is to be shown.

data : lo_nd type ref to if_wd_context_node,

lo_nd1 type ref to if_wd_context_node,

lt_temp type wdr_context_element_set,

wa_temp type ref to if_wd_context_element,

ls_node1 type sflight,

lt_node1 type STANDARD TABLE OF sflight.

lo_nd = wd_context->get_child_node('CN_MAIN'). <CN_MAIN is my node>

CALL METHOD lo_nd->get_selected_elements <here selected data is moved to lt_temp>

RECEIVING

set = lt_temp.

loop at lt_temp INTO wa_temp.

CALL METHOD wa_temp->get_static_attributes

IMPORTING

static_attributes = ls_node1. <Selected data in work area.>

APPEND ls_node1 TO lt_node1. < Data moved to internal Table>

CLEAR ls_node1.

ENDLOOP.

Finally Internal table is binded to the node required.

lo_nd1 = wd_context->get_child_node('CN_MAIN2').

lo_nd1->bind_table( lt_node1 ).

In your case , map this CN_MAIN2 with the Component Controller and from component controller you can access data in your second view also.

I hope it helps.

Thanx.

Saurav.