cancel
Showing results for 
Search instead for 
Did you mean: 

passing internal table data from one view to another view

former_member210804
Active Participant
0 Kudos

Hi sir,

I am facing a problem while passing internal table data from one view to another view. I want to get the internal table data

to different views through component controller.

Please guide me how to pass the data between different view,....

Thanks & regards,

Narasimha Rao Putturi.

Accepted Solutions (0)

Answers (8)

Answers (8)

former_member210804
Active Participant
0 Kudos

Thank you all ..........I solved this issue.

Former Member
0 Kudos

Mark it as answered

former_member210804
Active Participant
0 Kudos

Yeah....thanks

former_member210804
Active Participant
0 Kudos

Yeah....thanks

Former Member
0 Kudos

Hi Putturi..

   If you want to pass internal table data from one view to another, you have to create a context node simmilar to the internal table and populate that context node. You can map that context in view two where you will get the internal table data. For that you have to bind the internal table with the context.

In the following example I am trying show the list of employees working in a particular state.

For that I have created node- Node_Employee which contains all the fields to be displayed. And aother node- Node_State which contains a single attribute State.

Here main thing we have to see that the Cardinality, as we are getting values from an internal table the cardinality of the node should be 0-n, that means the node can either contain 0 values or n number of values.

Here the cardinality should be 1..1 because this is an input field it should not be empty.

then we are creating views.

In View_One we will map two context nodes. And in View_Two we map Node_Employee.

Now we are creating the lay outs for the views

In View one we have a button. We have to specify the action for the button.

Write the following code in the  ONACTIONSEARCH method of View_One.

   method ONACTIONSEARCH .

*-------------------------- Get the State Value -------------------------------------------*

DATA:
      node_node_state                     TYPE REF TO if_wd_context_node,
      elem_node_state                     TYPE REF TO if_wd_context_element,
      stru_node_state                     TYPE if_view_one=>element_node_state ,
      item_state                          LIKE stru_node_state-state.
*   navigate from <CONTEXT> to <NODE_STATE> via lead selection
    node_node_state = wd_context->get_child_node( name = if_view_one=>wdctx_node_state ).

*   get element via lead selection
    elem_node_state = node_node_state->get_element(  ).

*   get single attribute
    elem_node_state->get_attribute(
      EXPORTING
        name =  `STATE`
      IMPORTING
        value = item_state ).

*----------------------------End of Get State Value -----------------------------------------------------------*

TYPES: BEGIN OF s_emp,
         empid type string,
         name  type string,
         city  type string,
         state type string,
         country type string,
       END OF s_emp.

*------------------------ Fetching values into internal table --------------------------------------------*

DATA: it_emp  TYPE STANDARD TABLE OF s_emp,
      st_emp  TYPE    s_emp.

       SELECT empid name city state country
         INTO TABLE it_emp
         FROM ZEMP_TAB01
         WHERE state = item_state.

*------------------------------ Binding the internal table ----------------------------------------------------*

DATA: node_emp   TYPE REF TO if_wd_context_node.

         node_emp = wd_context->get_child_node( name = 'NODE_EMPLOYEE' ).
         node_emp->bind_table( it_emp ).

  wd_this->fire_ob_view2_plg(
  ).

In Window embed both views and give plug links. create WD application, activate and test.

Hope this will clarify your query

Thanks and regards

Pradeep

chengalarayulu
Active Contributor
0 Kudos

Narasimha,

you can do the same in two scenerios.

1. with Context mapping 2. Without context mapping.

1. With context mapping.

     its very simple, just create a node under component controller with required structure and maintain cardinality as 0..n.

     then map the created node to VIEW_1 as well to VIEW_2.

     now you will be able to set/read node level data at any of the both views. if you wanna set values at VIEW_1 and need to read those from VIEW_2. just bind the values at VIEW_1 level and read from VIEW_2. vice versa.

2. Without context mapping.

     it needs SE11 level structure/table type.

          create your required structure at SE11 level and as well TableType also. ex. ZTT_DEMO(Table type).

now come to ComponentController of your component and in Attributes tab, create an attribute(ex.GT_DEMO) with type of created of TableType(ZTT_DEMO).

now you can be able to read/set/assign the values from any controller of the component.

you can access that by WD_COMP_CONTROLLER->GT_DEMO.

Former Member
0 Kudos

Hi Narasimha ,

1.there are three ways which are mostly used . . for passing internal table data between views ..

create context in component controller and map this to view context using context mapping..

2 . create navigation plugs in both views, 

   create navigation links and fire the plugs in this for which view we are passing data in that view action         we have to write the quiery..

3.using interface controller for moving data but this much complicated than previous two ways....but  this is also usefull..

pls choose the path u wnat based on ur requirement...

Thanks And Regards..

Lokesh           

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Another way is to create the internal table in compenent controller and then access it in the views using wd_comp_controller->itab_name.

farooq_basha
Active Participant
0 Kudos

Hi Narasimha,

You need to make use of Context mapping and Navigation plugs and links. 

Add the data being used in first and second view in a Component controller node.

Map these component controller nodes with your view nodes.

Bind these nodes with your View UI elements.

Create outbound Plug in first View and Inbound in second View

On action of first View fire the plug and open second view.

Regards,

Farooq

Former Member
0 Kudos

Create a node in Context of component controller of same type as internal table and copy that to your views.

Former Member
0 Kudos

Hi,

Just create a common node on the component level and bind the data to that node. It will be available to all the views by node mapping.

Regards,

Fareez