cancel
Showing results for 
Search instead for 
Did you mean: 

Error using valueSet.gettext()

Former Member
0 Kudos

I have a dropdown by key that is filled in the controller using the following code:

for (int i=0; i < wdContext.nodeZ360_Business_Unit().size(); i++)

{ valueSet.put(wdContext.nodeZ360_Business_Unit().getZ360_Business_UnitElementAt(i).getZzcode(),

wdContext.nodeZ360_Business_Unit().getZ360_Business_UnitElementAt(i).getZzdescription());

}

when I select the DD I want to set a context element with the text attribute from the DD. In the view of my Application onActionSelectedBusinessUnit(...) I have the following code:

IWDAttributeInfo attinfoBusUnit = wdContext.getNodeInfo().getAttribute("addBusUnit");

ISimpleTypeModifiable modinfoBusUnit = attinfoBusUnit.getModifiableSimpleType();

IModifiableSimpleValueSet vsBusUnit = modinfoBusUnit.getSVServices().getModifiableSimpleValueSet();

wdContext.currentContextElement().setBusUnitDescription(vsBusUnit.getText(wdContext.currentContextElement().getAddBusUnit()));

I get the following error when I select the the BusUnit DD:

com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(ParticipantListView.addBusUnit): must not modify the datatype of a mapped attribute

Could anyone help me solve this error?

thanks in advance

Anton

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Anton

To avoid the current exception that you are getting, you can do one thing. Create a method in your component controller , say "populateBusUnit" and in this method, cut and copy the code that you have written for "onActionSelectedBusinessUnit(...) ". Next, in the action handler method of the view ie "onActionSelectedBusinessUnit(...) ", make a call to this method ie "populateBusUnit".

This should solve your problem.

Actually, the problem was that you were trying to add value service to a mapped attribute. It should be done to the origin attribute.

I hope this helps you.

Regards

Kapil

Former Member
0 Kudos

How do I call the controller method "populateBusUnit" from the action handler method of the view?

I tried:

populateBusUnit();

but I get an error saying that the method is undefined.

Do I need to prefix this with something?

thanks

Answers (2)

Answers (2)

abhijeet_mukkawar
Active Contributor
0 Kudos

hi,

check out the datatype of "addBusUnit" and "BusUnitDescription".

are you adding the enumeration to "addBusUnit" using "sBusUnit" ?

Also the method getText() accepts the integer as a parameter.

when it takes integer parameter the corresponding

sid_sunny
Contributor
0 Kudos

Hi Anton,

You are modifiying the type of a mapped attribute which is not allowed.

Regards

Sid

Former Member
0 Kudos

I found that I have a RFC where I get the description already, so problem solved.

For future reference, how would I get the text attribute of a DDBK in this situation?

code sample would be appreciated.

thanks