cancel
Showing results for 
Search instead for 
Did you mean: 

How to get attribute values from one view to another

Former Member
0 Kudos

HI all,

Thx in Advance..

I have 2 view like v1,v2.In v1 i used one attribute values from "get single attribute" method.And i need the same values in v2 screen.For this i did in v1 outbound plugs , i mentioned the parameter name . How can i get the same values in v2.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Way1

Component controller has the same node with attribute of the view1. Now context binding to View1 component controller and view2. So now whenever you change the attribute in view1 it will reflect to view2 also.

Way2.

Create an parameter in the outbound plug of the view1. Now when fire the outbound plug of view1 to navigate to view2. pass the parameter vale with the attribute value.

Now in view2 get the value forms the inbound plug parameter.

Former Member
0 Kudos

Hello Saurav,

Good to see you active on SDN.

Whatever options u have shared are not effecient and would hamper the performance.

If you read my earlier posts, you would realize i have suggested an alternate.

Context Mapping does make life of a developer easier but not from performace perspective.

You could maintain an attribute at view level and access the same in another view without mapping thats by taking reference in code.

Regards

Anurag

Former Member
0 Kudos

Thx..

Former Member
0 Kudos

Hi Chandramohan,

I doubt if passing data through navigation plug is the efficient way,

You could always maintain a parameter in attribute tab or as a attribute under context in one view and refer it thorugh another view.

Regards

Anurag Chopra

Former Member
0 Kudos

Hi - Chandramohan250 , Chinnaiya P answer is correct also do not forget to create the link between the plugs at the window level by draging outbound plug into inbound plug "drag n drop".

But if you have both view in the same component (V1, V2 under 1 WDC) then you can easily create an attribute at the componentcontroller make that attribute public and in V1 you do:

wd_comp_controler->GA_YOUR_GLOBAL_ATTRIBUTE_NAME = 'ABCD".

and in V2 you do:

lv_my_value_from_GA = wd_comp_controler->GA_YOUR_GLOBAL_ATTRIBUTE_NAME.

thanks!

Jason PV

Former Member
0 Kudos

Hi chandru ,

you said you declare the parameters in the Outbound Plug of V1. now go to view V2 inbound plug Tab and creat one inbound plug

double click on the plug name .it will navigate you to the event handeler method . Now add the outbound parameter variables in the

parameters

For example : V1firing the navigation plug 
a type string " defined in parameter 
  wd_this->fire_out_to_view2_plg(
    a =      'ABCD'                           " string
  ).

you can retrive the value freely in v2 inbound event handeler 

a type string " defined in parameter 

*   set single attribute
    lo_el_context->set_attribute(
      name =  `TEXT`
      value =  a )." here you will get the 'ABCD'.

regards

Chinnaiya P

Edited by: chinnaiya pandiyan on Jun 23, 2010 7:12 PM

Former Member
0 Kudos

Thx Chinnaia...

But how do i bind these inbound and outbound plugs.And also In v2 i used table,In this i create a label and i set the values from v1 which will get from v1 outbound plug..

How do achieve this..

Former Member
0 Kudos

Hi,

Create a navigation link in the corresponding window(in which your views V1 and V2 are embedded) by dragging outbound plug of V1 to inbound plug of v2.

Regards,

Srilatha

Former Member
0 Kudos

If you have V1 and V2 in 2 different webdynpro components then the outbound plug and inbound plug is the way to do it...see this link http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/308ebfe9-a07a-2c10-e494-9849d50ef...

but if your V1 and V2 are under the same component then just create a global attribute in your component controller like I explained you in my last post here and forget the plugs.

Please give points if is helpful,

Jason PV

Former Member
0 Kudos

in your component controller create an attribute (do not forget to make the attribute public so V1 and V2 has access to it) the type of your attribute will be the same type of your table structure (you can create a table type of your structure).

then you just get the value of the table and pass the value to the Global Attribute (GA).

wd_comp_controler->GA_YOUR_GLOBAL_ATTRIBUTE_NAME = LT_YOUR_TABLE.

and in V2 you do:

lv_my_value_from_GA = wd_comp_controler->GA_YOUR_GLOBAL_ATTRIBUTE_NAME.

Jason PV

Former Member
0 Kudos

Hi Jason,

Plugs are meant for navigation, having attribute attached to it(In some cases where u want to enable navigation to multiple views, it could be a better way) would not be an effecient way.

Even when the views doesnt fall in the same component, you could still do it by taking references.

Regards

Anurag Chopra

Former Member
0 Kudos

Anurag - totally agree with you. You still need to use the plugs to go from V1 to V2 but you not necessary need to pass the attribute within the plug. You can only use the plugs for navigation and store data in componentcontroller attribute that way if you are going back from V2 to V1 and you need the same data you just make reference to the componentcontroller global attribute.

is a cleaner way to store data and not passing data within the plugs and is easier for maintenance if a new developer is not familiar with webdynpro. that's my humble opinion/experience.

thanks!

Jason PV

Former Member
0 Kudos

Thanks and Regards

Anurag