Start of Content Area

Background documentation Fixed Values of Attributes  Locate the document in its SAP Library structure

The limited set of all values allowed for an input field is called fixed values. Some UI elements that accept user input must be supplied with such fixed values depending on the related context. This implies that the attribute, to which the UI element is bound, is assigned to a set of fixed values from which the user selects one as the input. The fixed values for these possible input values provided by the context attribute are bound to the UI element property SelectedKey. See also Data Binding Using Index and Key.

Fixed Values of attributes are needed for the two UI controls

      DropDownByKey and

      RadiobuttonGroupByKey.

For the UI element

      Inputfield

the context attribute to which the element is bound can also be preset with a set of fixed values. These fixed values are then proposed to the user as input by the F4 input help. In addition, the input check then refers to the set of existing fixed values.

Attribute with DDIC Type with Fixed Values

If a context attribute is of a DDIC type whose Domain already has Fixed Values these are automatically defined in the associated node info (see below).

Attribute Without DDIC Type with Fixed Values

However, if the attribute is not of a DDIC type with fixed values, then you must provide the fixed values in a different way and store them in the node info.

Interface IF_WD_CONTEXT_NODE_INFO

The interface IF_WD_CONTEXT_NODE has already been explained in Reference Variable WD_CONTEXT. This interface has a method GET_NODE_INFO, which returns meta information on the respective node. This information is of type IF_WD_CONTEXT_NODE_INFO.

 

method WDDOINIT .

 

data:     l_snode_21    type ref to IF_WD_CONTEXT_NODE.

          

                 

NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ).

NODE_INFO = NODE_INFO->GET_CHILD_NODE( 'NODE1' ).

To be able to store the fixed values for the attribute in the node info, two additional variables are necessary:

          

data:    LT_VALUESET type WDR_CONTEXT_ATTR_VALUE_LIST 

      L_VALUE type WDR_CONTEXT_ATTR_VALUE.

 

WDR_CONTEXT_ATTR_VALUE is a data type defined in the DDIC. It contains two components KEY and VALUE, both of type STRING.

WDR_CONTEXT_ATTR_VALUE_LIST is a table type stored in the DDIC, whose rows are of type WDR_CONTEXT_ATTR_VALUE.

The two variables created in the source text example are used to accept the value pairs that will later be passed to the node info.

          

L_VALUE-VALUE      = 'V1'.

L_VALUE-TEXT    = 'yesterday'.

     INSERT L_VALUE into table LT_VALUESET.

 

L_VALUE-VALUE      = 'V2'.

L_VALUE-TEXT    = 'today'.

     INSERT L_VALUE into table LT_VALUESET.

 

L_VALUE-VALUE      = 'V3'.

L_VALUE-TEXT    = 'tomorrow'.

     INSERT L_VALUE into table LT_VALUESET.

 

Caution In such an application, the value should be programmed language-dependent.

          

NODE_INFO->SET_ATTRIBUTE_VALUE_SET (

             NAME = 'ATTRIBUTE1'

        VALUE_SET = LT_VALUESET ).

 

endmethod.

 

Caution Setting these fields applies for all nodes bound to this node info. Even in existing nodes the value set is reset when setting the node info attributes.

A manipulation of the node info must not be implemented in a supply function, because the exact time the method is called is not explicitly known. For this reason, always edit the node info using method WDDOINIT.

If an attribute is attached to DDIC fixed values, the value list can be changed using the node info. An example would be the additional restriction of the value list.

 

 

End of Content Area