To provide an input help containing a long list of constant values (more than 30 entries), you use the InputField UI element and create the Extended Value Selector (EVS).
The entries to be displayed in the input help list are retrieved from a simple data type's enumeration of value/description text pairs. To make use of the generic EVS input help, you declare the data binding between the UI element and a context attribute of data type simple type.
The Simple Value Selector (SVS) after selection displays the expected description part of the enumeration value. The EVS however displays the value (key) part of the enumeration, which may not be the one you actually want to show.
If you want the description part of the enumeration to be displayed, you have to modify the values. To achieve this, the context attribute that the InputField UI element is bound to, must be a calculated context attribute. This enables you to create an enhanced EVS input help referred to as EVS++.
By setting the read-only property of a calculated context attribute to false, both a getter and a setter method are provided with the attribute. With these methods you implement the modification of the selected key/description pair in the way that the description is displayed.
● In the Local Dictionary, a simple data type exists that contains the required value set as its enumeration definition.
More information: Creating Data Types
You can fill the simple type enumeration dynamically at runtime using the ISimpleTypeModifiable interface.
● In the view context of the view that is to contain the EVS++, two value attributes are declared with the following properties:
Property |
Attrib |
AttribCalc |
type |
simple type containing enumeration definition |
|
calculated |
false |
true |
read-only |
false |
true |
More information: Binding UI Element Properties to Dictionary Types
...
1. In the view layout, create an InputField UI element.
More information: InputField
2. Bind the value property of the UI element to the calculated attribute (AttribCalc in the table above) with the data type simple type containing the required value set for your input help.
The getter-method generated is called by the Web Dynpro Runtime for retrieving the calculated context attribute value during response rendering or when controller code accesses this attribute.
...
1. Access the IWDAttributeInfo API of the context attribute AttribCalc.
2. Access the ISimpleValueSet API provided by the value set contained in the context attribute's simple data type.
3. Check whether the key stored in context attribute Attrib is valid.
4. Return the display text for a valid key, otherwise return an empty string.
public java.lang.String getAttribCalc( IPrivateMyView.IContextElement element) { //@@begin getAttribCalc String attributeName = IPrivateMyView.IContextElement.ATTRIB;
IWDAttributeInfo attributeInfo = element.node().getNodeInfo().getAttribute(attributeName); ISimpleType simpleType = attributeInfo.getSimpleType(); ISimpleValueSet valueset = simpleType.getSVServices().getValues(); Object key = element.getAttributeValue(attributeName);
try { simpleType.checkValid(key); return valueset.getText(key); } catch (DdCheckException e) { return ""; } //@@end } |
The generated setter-method of the context attribute copies the key value entered by the user from the calculated attribute AttribCalc to the context attribute Attrib. This attribute actually stores the key value in the context.
public void setAttribCalc( IPrivateFormView.IContextElement element, java.lang.String value) { //@@begin setAttribCalc element.setAttrib(value); //@@end } |
A simple type definition has a Field Label property. You can use this value as label for your input help UI element.
...
1. Create a Label UI element.
More information: Label
2. In the labelFor property of this Label UI element, assign your InputField UI element. Leave the text property empty.