cancel
Showing results for 
Search instead for 
Did you mean: 

Binding java.util.List to DropDownByKey UI element

Former Member
0 Kudos

Hello

I've imported into a Web Dynpro context a java bean data model that includes a property of type java.util.List.

How do I get a DropDownByKey UI element to map/use it?

Thanks

Lori A. Cook

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try using the DropDownByIndex instead. It will use a node of elements and you can bind the texts property to the attribute you want displayed in the drop down list. I've found that the DropDownByIndex is a bit easier to use for these cases.

Cindy

Former Member
0 Kudos

Tried it.

But when selecting the node that corresponds to a java.util.List, the dialog posts an error "Select an attribute of a multiple node. The attribute may be of any type."

Using a DropDownByKey the dialog posts "Select an attribute of any type".

Any ideas?

Thanks for your help!

Lori

Former Member
0 Kudos

Do you have a context attribute of Java native type java.util.List?

If yes, you cannot bind any UI element directly to this attribute because UI elements can only be bound to attributes of a DDIC type.

To bind a DropDownByIndex element against the list entries, you have to fill a context node (cardinality=0:N) with corresponding elements and bind the DropDownByIndex.texts property to a suitable attribute of this node.

Armin

Former Member
0 Kudos

Yes - the Java native type is java.util.List.

DDIC type? Can you explain (or point to documentation) about how to do this? How do you get complex Java objects into a Web Dynpro application?

Lori

Former Member
0 Kudos

You can bind UI element properties only to context attributes that have a type from the Java DDIC (data dictionary). This includes the basic types (string, integer, etc.), UI element types (Visibility, ButtonDesign etc.) and any user-defined DDIC types (e.g. string-based types with value set).

You cannot bind properties directly to context attributes with arbitrary Java native type like java.util.ArrayList etc.

To do so, declare a context node with suitable structure and bind the property according to its binding definition (e.g. DropDownByIndex.text must be bound to an attribute of a context node with cardinality *:N).

Armin

Former Member
0 Kudos

Hi,

Refer this link

https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-d...

DropDownByKey 8 | 16 (Tutorial)

Hope this gives you some good Idea

Regards,

RK

Former Member
0 Kudos

Armin

Can you give an example of how to do this?

None of the tutorials deal with this situation.

Thanks

Lori

Former Member
0 Kudos

Define a context node (cardinality 0:N) with an attribute that will store the text displayed in the drop-down list.

Define a supply function for the context node that creates the node element list from the java.util.List entries.

Armin

Answers (0)