on 06-16-2009 2:05 PM
Hi,
How do we acess a view context element from another view.
I mean in ViewA I had a context element, say grade.
I need to access this context element in another view say View B.
Regards
MQ
You need a tutorial
For Netweaver 2004: [Web Dynpro Java Sample Applications and Tutorials for SAP NetWeaver 2004|https://www.sdn.sap.com/irj/sdn/nw-wdjava?rid=/webcontent/uuid/503f22f6-b978-2a10-bf97-ddc21267e752] [original link is broken];
For NetWeaver 7.0: [Tutorials & Samples for Web Dynpro Java|https://www.sdn.sap.com/irj/sdn/nw-wdjava?rid=/webcontent/uuid/00b64d9f-fea2-2910-c988-ee2544047f8c] [original link is broken];
But to answer your question... you have to create a context element on the Component Controller, then bind it to the element context on both views. To bind it to the view open the diagram view and draw an arrow from the view to the controller and drag the elements.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can create a context attribute in the component controller.
Map this context attribute to both the contexts of view A and View B
Set some value in the context attribute in View A.
This value can be accessble in View B as well..
Regards,
Saleem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For example if you have a context attribute called "grade" in ViewA. And you want to access the same attribtue in the ViewB.
1.Create the same attribute in Component Controller and ViewB aswell.
2. Now go to the properties tab of ViewA and click on Add button. It shows the all the controllers. Here select your Component Controller.
3. Now right click on context attribute "grade" of View and select "Edit Context Mapping".
4. Here select the "grade" attribute of Component Controller earlier you created.
Repeat the steps 2,3,4 for ViewB also.
So you can access the value of context attribute "grade" in ViewB also.
(Or)
Create the context attribute "grade" in Component Controller first.
Now go to the DataModler diagram of Comopnent by right clicking on the Component.
Here drag the data link between the ViewA and Component Controller. And drag and drop the "grade" context attribute from Comp Controller to ViewA.
Similarly drag and drop from Comp Controller to ViewB also.
So you can access the value of context attribute "grade" in ViewB also.
Regards,
Charan
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
View is private. A View can't access the runtime data of another View directly without Compnent Controller.
Component Controller is public to all the Views in the Component.
Alternatively you can keep your value in client session. So that you can access that throughout the application within that session using the below code.
WDScopeUtil.put(WDScopeType.CLIENTSESSION_SCOPE,"KEY","Value");
WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE,"KEY").toString();
Regards,
Charan
Hi,
Use this below code:
wdThis.wdGetCompController().wdGetContext().currentContextElement().getGrade();
wdThis.wdGetCompController().wdGetContext().currentContextElement().setGrade("Value");
Before trying this code: Do this:
Go to the properties tab of View and click on Add button. It shows the all the controllers. Here select your Component Controller.
Regards,
Charan
Sri, the solution is ok, but i would suggest not to use the client session or application session variables untill there is no other optimal solution.
The use of these variables should be minimum and optimum.
I think it would be good to first understand what the exact requirement is.
Regards,
Nitin
Edited by: Nitin Mahajan on Jun 16, 2009 6:32 PM
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.