cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically Mapping Component Controller Context to a View Context

Former Member
0 Kudos

Hi all,

At Design Time we can very easily map Contexts between a View and its component controller.

How to do the same thing at runtime.

That is, if i have a model Node and attribute in the component controller at Design Time, how can i map these to a view controller thru programming.

And Again if i have a model Contexts then how to map model node to the Component controller thru code.

plz help

Rgds,

Vilish

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Do close the thread if your query is solved and reward points if the answer was helpful. ))

Regards,

Vijith

Former Member
0 Kudos

Hi Vijith,

I am really sorry. Yesterday SDN site was down so it got delayed. Now i have awarded the points.

Rgds,

Vilish

Former Member
0 Kudos

Before you do such things, please verify that this is really needed. What is your szenario and why can't you use context mapping at design time?

Remark to terminology: Mapping direction is from view controller to custom/component controller not vice versa.

Armin

Former Member
0 Kudos

Hi,

@Vijith, i am not able to open to that document. Do u have some other link.

@Armin, This is urgently required But i can't explain why

plz help

Rgds,

Vilish

Former Member
0 Kudos

You can't explain why? Why?

Armin

Former Member
0 Kudos

Hi all,

Thanks Vijith a lot. your help atriked a very good hint and now i have solved the problem.

Rgds

Vilish

Former Member
0 Kudos

Hi,

Do check if this link helps you.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/dy... creating, building, and mapping a context in web dynpro.pdf

It contains the mapping procedure.

Regards,

Vijith

Former Member
0 Kudos

Hi,

The link works perfectly fine so please try it again any way here is the code snippet and explanation as in document.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/dy... creating, building, and mapping a context in web dynpro.pdf

To create a context node in the View and then map this context node to the context node of Comp Controller, double click on the View in the project structure and then choose the Implementation tab page.

Enter the following lines of code in the method wdDoInit() , to dynamically create and map the context node. As you can see in the code, you get the nodeinfo of the context node in the Comp Controller, create a node in the view controller and then map this node to the context node of the Comp Controller.

Note that you are using addMappedChild(…) API for creating the context node in the view and not addChild(…). This is because you have to map this node to the context node in the Comp Controller.

In wdDoInit()

//Dynamically create a context node

IWDNodeInfo poNodeInfo = wdThis.wdGetPurchaseOrderCompInterfaceController() .wdGetAPI() .getContext() .getRootNode() .getChildNode("DynamicPurchaseOrder",IWDNode.LEAD_SELECTION) .getNodeInfo();

IWDNodeInfo localNodeInfo =wdThis.wdGetAPI().getContext() .getRootNodeInfo() .addMappedChild("DynamicPO", null, true, false, false, null, false, true);

//Dynamically map the context node

localNodeInfo.setMapping(poNodeInfo, true); localNodeInfo.addAttributesFromDataNode();

Regards,

Vijith