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 an inputfield in my WD with extended value help (countryKey and CountryName, coming from R/3). The selected country should be passed to a bapi import parameter mapped in a model, but the problem is that an exception occurs stating that I cannot change the data type of the context attribute because it is mapped to a model.

How is this usually done?

Thanks,

faB

-


ContextException: AttributeInfo(SearchView.Iv_Land1): must not modify the datatype of a mapped attribute

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

1. Create sub-node under your model node with cardinality 1..1 (non-singleton used in sample below)

2. In this sub-node create calculated attribute with the same primitive type as desired attribute has (say, string).

3. In setter / getter write code that will modify original attribute:


/* getter */
return element.node().parentElement().getAttributeValue("OriginalModelAttr");
/* setter */
element.node().parentElement().setAttributeValue("OriginalModelAttr", value);

4. Rebind your input field to newly created attribute, and apply any value set modifications to it.

VS

Former Member
0 Kudos

Thanks Valery.

You put in me in right direction, although your example seemed to complicated for such a newbie. I ended up just having the inputfield assigned to a normal value attribute and then onActionXxx it's copied to the model attribute.

Cheers,

faB

Former Member
0 Kudos

a related question:

please tell me what's wrong:

within a view context I can get/set value attributes only when they directly belong to the root node. If I group them in a node, I only get nullpointer exceptions.

Have I forgotten to initialize or bind something?

faB

Former Member
0 Kudos

Verify cardinality of your node to be 1..1 or provide a supply function that binds single element.

Also do not access elements below your element with calculated attributes

VS