cancel
Showing results for 
Search instead for 
Did you mean: 

wdContext.getNodeInfo() .getAttribute(...)

Former Member
0 Kudos

Hi!

I've got a problem with calling the method

<b>wdContext.getNodeInfo().getAttribute(...)</b>

on a Model Attribute as it always returns null.

I'm using the automatically created <i>IController.INodeElement.ATTRIBUTE</i> constant for specifying the attribute.

When I try to get the attribute of the Root-Context, it works.

Has anybody got an idea why?

Regards,

Thomas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thomas,

Could you post original code with relevant context outline?

What type of model are you using? Adaptive RFC?

VS

Former Member
0 Kudos

Thomas,

will you test whether this code works for you or not:

IWDAttributeInfo attInfo = wdContext.getNodeInfo().getChild("MyModelNode").getAttribute("myModelAttribute");

OR this one

IWDAttributeInfo attInfo1 = wdContext.node<Your Model Node>().getNodeInfo().getAttribute("myAttribute");

Shubhadip

Message was edited by: Shubhadip Ghosh

Former Member
0 Kudos

Hi, Valery!

I've used Adaptive RFC to import the Bapi BAPI_HELPVALUES_GET and mapped it to following context structure in the controller of IPrivateApplicantCompView:

Application

|_Title (Model Attribute)

I bound this element to an input field and then wanted to implement EVS for it as follows:

IWDAttributeInfo attributeInfo =

wdContext.getNodeInfo().getAttribute(

IPrivateApplicantCompView.IApplicationElement.TITLE

);

ISimpleTypeModifiable attributeType =

attributeInfo.getModifiableSimpleType();

a.s.o.

And the first method return null!

Thanks!

Thomas

Former Member
0 Kudos

Try to change

wdContext.getNodeInfo().getAttribute(
IPrivateApplicantCompView.IApplicationElement.TITLE
);

to

wdContext.nodeApplication().getNodeInfo().getAttribute(
IPrivateApplicantCompView.IApplicationElement.TITLE
);

VS

Former Member
0 Kudos

Instead of wdContext.getNodeInfo().getAttribute() use

wdContext.node<ModelNode>().getNodeInfo().getAttribute();

check whether this also returns null or not...

Former Member
0 Kudos

Hi, Valery!

I changed the code, which obviously worked perfect as I now get the message:

-


<i>com.sap.tc.webdynpro.progmodel.context.ContextException:

AttributeInfo(ApplicantCompView.Application.Title):

must not modify the datatype of a mapped attribute

at

com.sap.tc.webdynpro.progmodel.context.

AttributeInfo.getModifiableSimpleType

at com.snapconsult.portal.applicant.

ApplicantCompView.setValueHelpForInputElement</i>

-


Following the example for ESV, I do have to change the attribute in order to implement value help. How could ESV then be implemented for mapped attributes otherwise?

Thanks!

Regards,

Thomas

Former Member
0 Kudos

Hi Thomas,

I guess you are trying to modify datatype of the context which is already mapped to some component's controller.

So, you can't change its attributes here.

You have to change in component or controller itself.

Regards,

Bhavik

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Thomas,

if you're doing the EVS tutorial, you're supposed to use "getAttribute" on a value attribute you created in the context. Don't use the one that you mapped to the bapi output. Create a new one.

When you assign the values though (inside the "for" statement), use the one from the bapi output. This way you're not directly changing the mapped attribute.

Thanks!