cancel
Showing results for 
Search instead for 
Did you mean: 

Passing value from one view to another view

Former Member
0 Kudos

Hi Experts,

I am newly learning Web dynpro.

I have created two views namely 'first' and 'second'.

In first page I am getting empid, which I need to pass in a query which is in second view.

How can I take the value.

I created common context and I shared the empid node in both the context.

What syntax or method or statement will help me to get the empid in second page.

Thanks and regards,

Venkat

Accepted Solutions (0)

Answers (6)

Answers (6)

former_member230839
Participant
0 Kudos

You can use the get_static_attributee method only. But just get the emp_id attribute from the structure by like the following

<structure_name>-<attribute_name> for example emp_id-empid

Regards,

Anil kumar G

Former Member
0 Kudos

Hi Venkat,

follow this thread

it might help you

thnks

Former Member
0 Kudos
data: l_node type ref to if_wd_context_node.

l_node = wd_context->get_child_node(  'NODENAME'  ).

l_node->get_attribute( exporting name = 'ATTRIBUTE NAME' 
                      importing value = l_value ).

You can also use the code wizard for reading your context nodes.

Regards,

Radhika.

Former Member
0 Kudos

Hi Radhika,

This method I tried already. But I didn't know what should be the data type of i_value ( importing parameter ). In get_attribute method it says the data type 'DATA'. What is 'DATA' data type.

Should I use field symbols. If so, what should be the data type declaration. Can you help me?

Thanks and regards,

Venkat

Former Member
0 Kudos

Hi,

If you want to use the same data across different view then it is wise to declare the context node in componentcontroller and mapped it to different views. So, that once that node is changed in one view, changes will be reflected in other views automatically.

If you want to pass the data between view navigation, then use Inbound and Outbound plug, with the help of plug parameters we can communicate between views. Create the navigation link in the window.

You can also declare one public attribute in componentcontroller and use it across view but it is not a good approach.

thanks,

Rahul

Former Member
0 Kudos

hi Venkat,

If the context nodes are mapped you just need to read that node in the view.

You may use the get_attribute or get_static_attributes methods to read the attributes or nodes respectively,

Use the code wizard to do this.

Regards,

Runal

former_member230839
Participant
0 Kudos

Hi Venkat,

You shared the EMPID node in both of the views what does it mean .? you created the context node at component controller level and using that node in these two views.

then you can get the empid in either of the views by like the following code

DATA lo_nd_emp_id TYPE REF TO if_wd_context_node.

DATA lo_el_emp_id TYPE REF TO if_wd_context_element.

DATA ls_emp_id TYPE wd_this->Element_emp_id.

lo_nd_emp_id = wd_context->get_child_node( name = wd_this->wdctx_emp_id ).

  • get element via lead selection

lo_el_emp_id = lo_nd_emp_id->get_element( ).

  • get all declared attributes

lo_el_emp_id->get_static_attributes(

IMPORTING

static_attributes = ls_emp_id ).

if the context node name is EMP_ID then in ls_emp_id you will get the structure values.

Regards,

Anil kumar G

Former Member
0 Kudos

Hi Anil,

your answer was very helpful to me. Finally I got solved my problem. But When I use the statement

DATA ls_emp_id TYPE wd_this->Element_emp_id.

it threw error. Instead I used the following statemet

DATA : i_value type ig_componentcontroller=>element_node_empid.

Thank you very much for you and Radhika.

Venkat