cancel
Showing results for 
Search instead for 
Did you mean: 

Pass values between views of different window

Former Member
0 Kudos

Hello Experts,

I am a newbie in ABAP Webdynpro. I have 2 views in 2 different windows. I want to pass values calculated from one view to the other view. But i cannot connect the views.

If the views were within the same window, I could connect them using inbound and oubound plugs with parameters. However in this case i am unable to establish the navigation link between these 2 views.

Has anyone of you experts come across such kind of requirement? If so, can you please guide how to connect the 2 views?

Thanks and regards,

Nitish.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Create attributes or nodes on component controller. Nodes and attributes will be 'globally' accessible.

former_member389677
Active Participant
0 Kudos

Hi,

If you want to pass valse from 1 view to another views in different or same window,

create attribute in component controller for that vales . This component controller is accessible for views .

Regards

Shaira

Former Member
0 Kudos

Hi shaira,

You are all correct. I had also this concept in mind.

The problem is that i want to populate the attribute of the component controller from a button click event.

I have only populate a node or attribute of component controller using the supply function. But here, its using an event of UI element.

Can you please indicate me how I can populate the attribute of the component controller apart from using supply function?

former_member262988
Active Contributor
0 Kudos

Hi,

The attributes of component controller can be updated any where as they are globally visible.....

if we have an attribute X type char1 @ component controller we can update it as

wd_comp_controller->x = '1'.

Thanks,

Shailaja Ainala.

former_member389677
Active Participant
0 Kudos

Hi ,

If you want to get the reference of the component controller in a button event use WD_COMP_CONTROLLER.

You can call the methods and attributes of the component controller by WD_COMP_CONTROLLER->

Hope this will solve your problem

Regards

Shaira.

Former Member
0 Kudos

Everyone,

I was finally able to connect the 2 views by using the component controller.

I created an attribute on the context of the component controller and read/set of the attribute of component controller on the button click event.

To access the attribute of the component controller, please find below a code snippet which was useful to me:

    • Data declaration for accessing the component controller

DATA:

lo_component type REF TO if_wd_component,

lo_context type REF TO if_wd_context,

lo_controller type REF TO if_wd_controller,

lo_node type ref to if_wd_context_node,

lo_child type REF TO if_wd_context_node.

DATA lo_el_test_depts TYPE REF TO if_wd_context_element.

    • get component controller API

lo_component = wd_comp_controller->wd_get_api( ).

lo_controller ?= lo_component.

    • accessing the context of the component controller

CALL METHOD lo_controller->get_context

RECEIVING

context = lo_context.

    • lo_context is the required context, from here we can manipulate its components

    • get to the root node in context of component controller

lo_node = lo_context->root_node.

using lo_node i was able to read and write to the attribute i created in component controller.

Thank you all for your help.

Nitish.

Edited by: Nitu_0105 on Apr 8, 2011 3:29 PM

Former Member
0 Kudos

HI Nitu ,

You can make a attribute in component controller and then store the data into it .

Since component controller is a global controller so any of your view can access this data .

As per your scanrio , store the data from the first view into attribute in component controller

and you can use this attribute value in your second view .

Regards

Kuldeep

Former Member
0 Kudos

Windows have plugs too. Create plugs in the windows. Use the window controller inside the view to fire the window plug .