cancel
Showing results for 
Search instead for 
Did you mean: 

How to expose DC Context to another DC ?

Former Member
0 Kudos

Hi, I have recently migrated few custom web dynpro java components from 7.0 to 7.3 release, as part of the migration and under new programming model some changes has happened as per this cheat sheet

http://help.sap.com/saphelp_nw73/helpdata/en/43/ef15aebf454ab4ab2481f698a1b9fe/content.htm

I have successfully migrated but there is some issue where some DC's share their context nodes and attributes with other DCs. In the old programming model (7.0) interface controller has been used to expose component controller nodes, attributes and methods.  Then is perfectly fine under old programming model.

However, with the new programming model interface controller has been moved under local component interface and there is not much I can do there to expose context of component controller.  Here is my scenario and please advice what is the best way to resolve under new programming model 7.3

I have two DCs comp-A and DC comp-B, I would like to use(share) some of Comp-A controller component context nodes, attributes and methods to Comp-B.  How do I do it?  Comp-A and Comp-B are completely independant Web Dynpro DCs, Comp-B is NOT a child DC of Comp-A.

I have tried following

1) Create new Component interface definition (CID) and added to public part(PP), but I cannot map component controller context to this CID.  I can only create new nodes and attributes in CID and then map CID context node to the component Controller, but with this approach I'm getting nullpointerexception with message as follows

Caused by: java.lang.NullPointerException: while trying to invoke the method com.xx.yy.wd.comp.xxx.wdp.IPublicXXXComp$IPersonDtlsElement.setCphone(java.lang.String) of an object returned from com.xx.yy.wd.comp.reg.wdp.IPublicXXXComp$IContextNode.currentPersonDtlsElement()

  ..

  ..

 

The programming code that throws above exception is

wdContext.currentPersonDtlsElement().setCphone(someClass.getValue()); // Where PersonDtls is the node at CID mapped to the component controller context, PersonDtls is null so unable to invoke any method like "setCPhone"

In the old programming model (i.e. 7.0) we could map component controller context to the interface controller and easily expose the interface controller when you create PP of component controller.  In the new programming model I couldn't use local interface contoller.

2) Add Comp-A component controller to the public part, and in comp-B assign Comp-A as dependency but then I don't see any context nodes or attribues of comp-A in comp-B.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

i don't think web dynpro has changed regarding that point in 7.3.

you can just copy and past the node from component controller to the interface controller

Former Member
0 Kudos

Hi Jun, thanks for the response.  If I try copy and paste context nodes/attributes from Component Controller or Custom Controller to local interface controller, the nodes and attributes are copied but I still have to map from interface controller to the component controller or custom controller, so I still got the same issue. 

In the old programming model, we can add custom controller, component controller as required controller for the interface controller, but in the new programming model it's not available unless I add component controller as used component.  And there is no option to add Custom controller as required controller to the local interface controller. 

Please let me know if there is any way to add custom controller as required controller to the local interface controller, so that I can add context from custom controller to the local interface controller.  Otherwise interface controller context nodes/attributes are treated as source and we still get null pointer exception.

Answers (1)

Answers (1)

Qualiture
Active Contributor
0 Kudos

Like Jun said, just copy the relevant context nodes, no need to map them explicitly anymore.

Same for any methods that need to be exposed

Former Member
0 Kudos

Hi Robin, thank you for you response.  Yes it worked if I don't map context nodes and attributes, as you said I just created required context nodes and attributes and method definition in the local interface controller.  The actual nodes, attributes and methods are defined from scratch on the custom controller. 

Thank you very much to Jun and you, it all works now.