cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with external context mapping

Former Member
0 Kudos

Hi ,

I am having the following problems with external context mapping from one WD component to another.

Problem description:

In the <i>Component Interfaces</i> I have defined a WD interface "InfA".

In the <i>interface controller</i> of this compoenent,I have ContextA and attributeA(cardinality 1..1).The contextA is marked as an "Input Element".

Now my webdynpro componentB adds InfA as used component.In componentB I decalre a contextB with attributeB and map it to contextA to set up the external context mapping.

Now I expect that if any webdynpro component implements this WD interface InfA ,he has access to contextA with the data getting filled from contextB.

After i have created the component for the used component I try to fill values in the source node contextB thru this code:

wdContext.currentContextB.setB(value);

But in the runtime I keep getting error nullPointerException for nodeContextB,suggesting that the mapping has not been completed.

Can anyone suggest due to what the error can come ,and, if its a webdynpro bug ,is there a workaround??

Thanks in advance for your help.

Best regards

Sourav

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi All,

Thnaks for the answers,but the problem still remains.

I tried both the methods that you mentioned ,

First ,I kept the name of the context nodes and attributes in the using controller same as that of the Interface controller.

Second,during mapping I chose each node and attribute to be mapped separately.

But I still get java.lang.NullPointerException when I try to access the nodeElement

although the cardinality of the node is 1..1.

@Abhijeet

Thanks for the link to the doc,but I think i have done all the things right as mentioned in the document.

Please let me know if I am going wrong anywer.

Best regards

Sourav

Former Member
0 Kudos

sorry ........

abhijeet_mukkawar
Active Contributor
0 Kudos

HI,

Valery : I personally checked by doing the example, if the names of value attribute are different in the child's interface and parents component controller then it throws the exception.

Sourav: NullPointer Exception is thrown when something is not properly initialised, if in the main component the cardinality of mapped origin is 1.1 then you need to access it element directly like:

wdContext.currentParentNodeElement().setFname("Abhijeet");

wdContext.currentParentNodeElement().setLname("M");

i will suggest just check out if you are declaring some element of value node and without initialising taking its use or what?

if this doesnt solve your problem, please post the expanded exception.

hope it helps

let me know if you face nay problem

regards

Former Member
0 Kudos

NW04s SP6 -- no exception. Checked personally.

For me this sounds like a bug -- using different names was possible for ages.

VS

Former Member
0 Kudos

Sourav,

In your outer component (componentB) where is contextB node defined? Component controller? Other controller?

If it's declared somewhere outside component controller, then try to "move" it to component controller. Probably this issue is related to lifecycle of controllers.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi,

@Abhijeet:I do access the elemnts as

"wdContext.currentUIAdjustmentObjectElement().setEnabled(editMode);"

in my code.

But the error is there as wdContext.currentUIAdjustmentObjectElement() returns null(checked in debugger).

@Valery:Checked in another thread and seems to be a bug.Workaround is suggested but not sure about the solution.

Please take a look here and suggest if you get the solution.

Former Member
0 Kudos

Valery,

Its in the component controller.

Thnaks

Sourav

Former Member
0 Kudos

Then the only trick I can suggest is to change cardinality to 0..1 (btw, is it 1..1 on both nodes???) and add element explicitly in wdDoInit of outer component (componentB).

VS

abhijeet_mukkawar
Active Contributor
0 Kudos

Hi,

try by creating new element ...

regards

abhijeet_mukkawar
Active Contributor
0 Kudos

Hi Sourav,

check out this document for <b>External Context Mapping</b> :

http://help.sap.com/saphelp_nw04/helpdata/en/d7/e551cf896c3a49bb87bb4ce38c99c8/content.htm

hope it will solve your issue

regards

abhijeet_mukkawar
Active Contributor
0 Kudos

Hi,

External mapping require "node attribute" in both parent and child node to be same. in your case childs of contextA and contextB should be same ,

and in main component, in used conmponent , in its interface controller have you added component of contextB as required component?

just check it out

regards

Message was edited by:

Abhijeet

Former Member
0 Kudos

<i>External mapping require the data attribute name in both parent and child node to be same</i>

Wrong. You may use any names, only types/cardinality matters.

The only glitch is that "automatic" mapping is not performed in designer when attributes has differenet name. I advise author to revisit his mapping -- select concrete attribute (not whole node) in component usage, then map it individually.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

abhijeet_mukkawar
Active Contributor
0 Kudos

Hi,

Thanks Champ...

Valery, what does this sentence means:

"External context mapping requires the node attribute in both the childs Interface controller and perents custom controller have the same name"-----taken from JA310 of SAP

regards

Message was edited by:

Abhijeet