cancel
Showing results for 
Search instead for 
Did you mean: 

How to move selected values in a table in one view to another

Former Member
0 Kudos

Dear Experts,

In my application,I have a table populated with data.My requirement is to select a row in the table and move the selected values of the row to the next view.

Can anybody tell how to do this??

Regards,

Mamai.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mamai,

Use this code to get the selected entries in separate internal table..

lo_nd = wd_context->get_child_node('Table_name').

CALL METHOD lo_nd->get_selected_elements

RECEIVING

set = lit_detail.

IF lit_detail[] IS NOT INITIAL .

LOOP AT lit_detail INTO lfl_detail.

CALL METHOD lfl_detail->get_static_attributes

IMPORTING

static_attributes = lfl_select.

APPEND lfl_select TO lit_select.

CLEAR lfl_select.

ENDLOOP.

Regards,

Simi A M

Edited by: amsimi on Mar 6, 2011 12:55 PM

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Banerjee,

Go through this link you may understand.

http://wiki.sdn.sap.com/wiki/display/WDABAP/ExampleforpassingvaluesfromoneApplicationtoanotherApplicationinWebDynproABAP.

http://wiki.sdn.sap.com/wiki/display/WDABAP/Passingtableparameterfromoneviewtoanotherview+locally

Regards,

William.

Edited by: William_85 on Mar 7, 2011 10:04 AM

Former Member
0 Kudos

Hi Mamai,'

As you have said that you have a table populated with data , you must have some node to keep those data.

In Web Dynpro you can only keep data in a node.

Now create a node in componentcontroller as any node created in componentcontroller are visible to all the views created.

Now when you are accessing the view what you need to do is just in a particular action you have to populate the node with data you want and it in the other view you can fetch the data easily.

You have several event handler in table like On_Leadselect , On_Select, you can use these or you can have other action handler by using button ui element.

In particular event handler use code wizard to fetch the selected data and bind it to to the node you want ( as a table or as a structure ).

Also create outbound plug as your requirement.

Reply in case of any issue.

Regards,

Monishankar Chatterjee

former_member199125
Active Contributor
0 Kudos

Hi mamai,

First create a two internal tables ( nodes) itab1 & itab 2 with your required structure in component controller.

Then bind the itab1 with view1 controller context.

bind the itab2 with view2 controller context. and create a tables in both views and bind with itab1 and itab2 respectively.

after getting the itab1 data, use the below code in wddoinit method of view2.

data: count type i,

pos type i value 1.

Count = lo_nd_itab1->get_element_count( ).

do count times.

          • to copy the selected records

if lo_nd_itab1->is_selected( index = pos ) = abap_true.

lo_el_itab1 = lo_nd_itab1->get_element( index = pos ).

lo_el_itab1->get_Static_attributes( importing static_attributes = ls_itab1 ).

lo_el_itab2 = lo_nd_itab2->creat_element( ).

lo_el_itab2->set_static_attributes( exporting static_attributes = ls_itab1 )

lo_nd_itab2->bind_element( new-item = lo_el_itab2 set_initial_elements = abap_false ).

endif.

pos = pos + 1.

enddo.

Regards

Srinivas

former_member199125
Active Contributor
0 Kudos

Hi mamai,

First create a two internal tables ( nodes) itab1 & itab 2 with your required structure in component controller.

Then bind the itab1 with view1 controller context.

bind the itab2 with view2 controller context. and create a tables in both views and bind with itab1 and itab2 respectively.

after getting the itab1 data, use the below code in wddoinit method of view2.

data: count type i,

pos type i value 1.

Count = lo_nd_itab1->get_element_count( ).

do count times.

          • to copy the selected records

if lo_nd_itab1->is_selected( index = pos ) = abap_true.

lo_el_itab1 = lo_nd_itab1->get_element( index = pos ).

lo_el_itab1->get_Static_attributes( importing static_attributes = ls_itab1 ).

lo_el_itab2 = lo_nd_itab2->creat_element( ).

lo_el_itab2->set_static_attributes( exporting static_attributes = ls_itab1 )

lo_nd_itab2->bind_element( new-item = lo_el_itab2 set_initial_elements = abap_false ).

endif.

pos = pos + 1.

enddo.

Regards

Srinivas

Former Member
0 Kudos

HI,

using context mapping you can achieve this. First design your context node in such a way that in component controller you have the node which is binded to the table UI.

You could create a another node(B) with cardinality 1..1 and the same structure your table.

On_lead_select event of the table , get the lead selected element.

Bind this element to the node (b). Use the webdynpro code generator CTRL+f7.

In your other view, do the context mapping between the existing node if any otherwise drag node-b be to the context root node of the view-2.

Use plugs to navigate from view-1 to view-2 .

Former Member
0 Kudos

Hi mamai,

If you want to share data between views you have to share through COMPONENT CONTROLLER,

1. First create your CONTEXT in COMPONENTCONTROLLER.

2. Do CONTEXT MAPPING in both views.

3. Populate data in first view using any FM or other methods.

4. 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 ).

Cheers,

Kris.