Start of Content Area

Background documentation Data Binding Using Index and Key  Locate the document in its SAP Library structure

For Dropdown listboxes and RadioButtonGroups there are different ways of data binding: data binding using an index (index binding) and data binding using a key (key binding). The names of the UI elements indicate the respective data binding variant.

        Index Binding

        DropDownByIndex

        RadioButtonGroupByIndex

        Key Binding

        DropDownByKey

        RadioButtonGroupByKey

Index Binding

Index binding is based on multiple nodes. The texts property is bound to an attribute within a context node, which contains several elements (cardinality = 0..n). The number of elements defines the possible entries in the list, and the lead selection defines the selected element; for example, with a RadioButtonGroupByIndex one radio button is displayed for each element. The selected radio button is specified by the lead selection of the context node. If the user selects a different element, the lead selection changes accordingly. It is possible to bind this element in a table. Each instance can then contain a different selected set.

Note

When you  toggle the selection, the lead selection is changed.  If a singleton node is contained in the selection, it will be invalidated.

Example

For examples, refer to the system in the Web Dynpro component WDR_TEST_EVENTS in the views DropDownByIdx and RadiobtngrpByIdx.

Key Binding

With this kind of binding, the values are determined using attribute information in the node information. If the attribute type is a type from the ABAP Dictionary, then the texts are automatically retrieved from the Dictionary, which means that the respective domain values are retrieved from the Dictionary for the display. This is the default.

However, it is also possible to determine the value set yourself and to build the list dynamically (see also Fixed Values of Attributes):
IF_WD_CONTEXT_NODE_INFO=>SET_ATTRIBUTE_VALUE_SET
If the data type already has a value set, all you can do is restrict this set.

The value of the attribute is the key from the attribute info. The related text (value) is displayed. The value of the attribute changes by selection. Keys and texts (values) are specified for the value set so that the displayed value does not have to correspond to the value in the context (important for translatability). The structure of the value set thus is predefined as a collection of key-value pairs. In contrast to index binding, the UI elements bind against a context attribute and not against an attribute of a multiple node.

Example

Example for data binding where the property of a UI element, which is to display the content, is bound against the attribute.

With a RadioButtonGroupByKey the property selectedKey is bound to a context attribute that has a value set, for example, domain values from the ABAP Dictionary. With a RadioButtonGroupByKey one radio button is displayed for every single key. If a radio button is selected, then the related value is returned to the context attribute.

For examples, refer to the system in the Web Dynpro component WDR_TEST_EVENTS in the views DropDownByKey and RadiobtngrpByKey.

In contrast to index binding, where always different texts are listed in a table column, with this kind of data binding also identical texts can appear in the column.

 

 

End of Content Area