cancel
Showing results for 
Search instead for 
Did you mean: 

Must not modify the datatype of a mapped attribute

Former Member
0 Kudos

Hi,

I have a value attribute in a component controller context, mapped to a view Context attribute, and then bind it to a DropDownByKey.

<b>When putting the values (key, value) to the view context, using the following code:</b>

<i>IWDAttributeInfo attrInfo = wdContext.getNodeInfo().getAttribute(IPublicSearch.IContextElement.STATE);

ISimpleTypeModifiable type = attrInfo.getModifiableSimpleType();

IModifiableSimpleValueSet valueSet = type.getSVServices().getModifiableSimpleValueSet();</i>

<b>I’m getting the Report Exception:</b>

<i>com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(ListaMensagensInterface.Estado): must not modify the datatype of a mapped attribute</i>

The i found the following solution in the SDN:

“…1. You have some context attribute in custom/component controller.

2. You map this attribute to attribute in view controller.

3. You are trying to modify simple type of attribute in view controller.

Step 3 is wrong -- move your code that modifies simple type of attribute to custom/component controller, where attribute was defined. Mapped attribute in view controller will get modified type automatically. …”

The problem is that the attribute of Component Controller is mapped to an attribute of Interface Controller of a Used Web Dynpro Component. This means that all contexts are mapped.

Component1 Controller Attribute X mapped to Component1 View Controller Attribute X

Component1 Controller Attribute X mapped to Component2 Interface Controller Attribute X

Component2 Interface Controller Attribute X mapped to Component2 Controller Attribute X

Component2 Controller Attribute X mapped to Component2 View Controller Attribute X

How to solved it?

Is the only solution, create two attributes? One to bind to UI and other to pass the information from Component1 to Component2?

Thanks and regards,

John

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

John,

Seems that you are citing my reply.

Actually, it doens't matter whether it is view or interface controller, the key point here is that you must modify only "origin" node attribute, not mapped one.

So either modify "origin" in used component, or create separate attribute in owning controller, alter it, and then copy elements back and force.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Hi,

Thanks by the quick answers.

I understand that all modifications should be done in the place where the context attribute was originally defined, but when one component uses another component and they have a context mapping defined between them, and in each one, there is also a context mapping between Component Controller and View Controller.

Resuming the solution and also the problem:



1 - Context Definitions:
Component One
Component Controller
Context
State » String (Context Mapping to State attribute of Component Two Interface Controller)
View Controller
Context
State » String (Context Mapping to State attribute of Component One Controller)

Component Two
Component Controller
Context
State » String
View Controller
Context
State » String (Context Mapping to State attribute of Component One Controller)
Interface Controller
Context
State » String

2 – Design:
The Attribute State in the View Controller of Component One is used as SelectedKey of the DropDownByKey UI Element created in Layout of Component One View Layout.

3 – Information flow:
The selected state in the dropdown of Component One should be passed along to the Component Two. Reason by which there is a context mapping between Component One and Component Two Interface Controller.

4 – Problem itself:</b>

Because all attributes State are mapped between them, and the original place (Component One Controller) has a context mapping to Component Two Interface Controller, I’m not able to set the values for the DropDownBox.

Like Valery is mentioning, i think the only solution is to create a second attribute at Component One Controller:

- First attribute with a context mapping between component one controller and component one view controller;

- Second attribute with a context mapping between component one controller and component two interface controller;

- Every time the first attribute state is changed, the second must be programmatically updated.

Is this true?

Regards,

John

Answers (2)

Answers (2)

Former Member
0 Kudos

I was trying to modify an attribute from the view, mapped to a controller attribute (gave me that error). Try to modifiy the attribute from the component controller instead of the view.

Former Member
0 Kudos

Hi,

If the attribute is already mapped why the need for modification?

You should do all modifications in the place where the context attribute was originally defined.

Regards,

Satyajit.