Show TOC

Defining TokensLocate this document in the navigation structure

Use

A token can can be used to assign a value to an attribute. The value entered is validated by the application, and if necessary, a validation text is added. The value is displayed as the token together with the text. The advantage of this is that the key can be validated by the user immediately.

Procedure
  1. Use attribute type TOKEN. In structure WDR_SO_S_ATTRIBUTE, fields DATAELEMENT, REF_TABLE/FIELD, and RTTI_TYPE define the type of the attribute that is used in the saved searches and for data exchange with the application in structure WDR_SO_S_VALUES.
  2. Fill WDR_SO_S_ATTRIBUTE-TOKEN. The external key is optional. As the VALIDATING_INSTANCE an instance must be specified that implements the application. You can find more information about interface IF_WD_SELOPT_20_TOKEN in the online documentation for the interface. If no external key is specified, only method VALIDATE_VIA_INT_KEY has to be implemented.

You can find an implementation example in CL_WDR_TEST_SEL_OPT_AUTO_20. The associated application is WDR_TEST_SEL_OPT_AUTO_20. Choose the link "Test Case: Tokenizer".

External Key

For some selection scenarios the user must select a value that is not normally shown to the user (for example, a GUID). The user only knows this key under a different number or descriptive text. However, these are not suitable for selections in the database. These attributes can be mapped as tokens with external keys.

In this case, an attribute evaluation consists of three fields:

Table 1:
Field Description
INTERNAL_KEY In the data exchange with the application, the internal key is used with methods GET_INPUT_COMPLETE, RESET, and so on.
EXTERNAL_KEY If this is specified, this is the user input for language-dependent keys or GUIDs. In this case, INTERNAL_KEY is never seen by the user. F4 help must return this value. The external key must be unique.
DESCRIPTION Contains the description displayed by the token.

The internal key is used within the data exchange with the application in structure WDR_SO_S_VALUES. The external key is used only within interface methods IF_WD_SELOPT_20_TOKEN-> VALIDATE_VIA_INT_KEY and IF_WD_SELOPT_20_TOKEN-> VALIDATE_VIA_EXT_KEY. A type description for the external key must be specified in WDR_SO_S_ATTRIBUTE-TOKEN- EXTERNAL_KEY.

String parts cannot be input because the internal key cannot be identified for an incomplete external key. Therefore, operators ( starts_with, contains ) cannot be used.