Skip to Content
0
Former Member
Dec 04, 2008 at 07:03 AM

Map _attributes_ dynamically. How to?

23 Views

Good day.

I'm struggling with a following problem.

I need to dynamically create and map attributes. I've read the document "Dynamically Creating, Building and Mapping a Context in Web Dynpro", it was a bit helpful but it doesn't fit all my requirements.

What I've done:

1) Created an attribute in my controller:

wdThis.wdGetContext().getNodeInfo().addAttribute("Attr1", "com.sap.dictionary.string");

BTW, I can see, that the method addAttribute is overloaded and we can pass the IDataType, but I couldn't find how to replace "com.sap.dictionary.string" with IDataType. Is it possible?

2) Now, I want to map that attribute with an attribute in my view:

IWDNodeInfo custNodeInfo = wdThis.wdGetInitializationController()

.wdGetAPI()

.getContext().getRootNodeInfo();

IWDAttributeInfo localNodeInfo = wdThis.wdGetAPI().getContext()

.getRootNodeInfo().addMappedAttribute("Attr1", "com.sap.dictionary.string");

BTW, what do the parameters of the addMappedAttribute mean? Am I right?

And there is a question - in the docs said that we should use IWDNodeInfo, but addMappedAttribute return IWDAttributeInfo and I can't get how to link attribute in the controller and in the view. It is the main question, hope for your help.