cancel
Showing results for 
Search instead for 
Did you mean: 

DropDownByKey and SimpleType

Former Member
0 Kudos

Hi,

I already searched the forum for a question like mine, but i didn't found any help so i thought it might be good to open a new topic.

Anyway - following problem: I've built a Web Dynpro application which consists of a search and a detail view. In the detail view, there are two DropDownByKey Elements holding the values "days" (key 0) and "hours" (key 1), cultivated through a SimpleType which holds this enumeration.

When i select values in my DropDownByKey and hit the save Button of my application, everything works fine and the correct values get written in my DB. When i now navigate back to the search view and call the previously save record, all values are shown correct - but my two DropDownByKey Elements aren't set on the right Elements.

The context works fine, both value attributes hold the values which were previously saved into the DB.

My question: When i have a variable bound to a DropDownByKey, which is bound to a SimpleType Enumeration and from the DB i get a "0" for those field, why isn't the DropDownByKey set correctly and shows a blank instead of "days". And how can in solve the problem.

Thanks in advance for your help.

Regards,

Patrick

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Since everything is working fine except display of drop down value, please check whether Simple type Enumeration value matches to data retrieved from DB in all aspects such as data type, whteher casting necessary before setting.

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks a lot folks - the problem is solved now.

The DB value was a boolean, whilst the context an enumeration value was a string, which didn't fit right together.

Anyway, another problem occured so we changed our architecture in that way and solved the whole thing without that enumeration.

Thanks again to all for your fast replies and helpful answers.

Former Member
0 Kudos

Please check if the context attribute to which the "selectedKey" property is bound contains the correct value.

Armin

Former Member
0 Kudos

Hi,

You want to display blank in your DropDownByKey when you go back and see the saved data. But i feel that showing the data which is retrieved from the database into your DropDownByKey is more appropriate.

You can show the blank DropDownByKey when you are adding a new record.

Anyhow to display a blank you can add one row into the enumeration of your simpleType as value "BLANK" and description as empty.

Now while going back to see the saved data, you can set the attribute mapped to your DropDownByKey to "BLANK".

Hope this will solve your problem.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi Patrick,

If you're calling the BAPI again when you go back to your first screen, then get the value from BAPI and assign it to your value attribute.

wdContext.current<Node>Element().setDropdownValue(wdContext.current<BAPIRet>Element.getSomeValue());

Then the dropdown will show "0" instead of a blank value.

Cheers,

Rajit