Ansicht
Dokumentation
ABAPDATA_ENUM - DATA ENUM
PERFORM Short Reference PERFORM Short ReferenceThis documentation is copyright by SAP AG.
DATA, TYPE, LIKE enum
DATA enum_var ${ ${TYPE enum_type$}
$| ${LIKE enum_dobj$} $}
$[VALUE val$|${IS INITIAL$}$]
$[READ-ONLY$].
Effect
Declaration of an enumerated variable. An enumerated variable is declared by:
- TYPE reference to an enumerated type enum_type.
- LIKE reference to a data object with enumerated type. The following options are possible:
- Enumerated constants of an enumerated type
- Existing enumerated variables
The data type of an enumerated variable is its enumerated type. The enumerated type prescribes the enumerated values that an enumerated variable can contain. The assignment rules for enumerated types and the allowed operand positions for enumerated variables ensure that only allowed enumerated values can be assigned to an enumerated variable.
The technical type of the enumerated value in an enumerated variable is the base type of the enumerated type. It is always a flat elementary type with a maximum length of 16 bytes.
Note
For more information about using enumerated variables, see enumerated objects.
Example
In this example, three enumerated variables are declared:
- color1 by a TYPE reference to the enumerated type colors
- color2 by a LIKE reference to color1
- color3 by an inline declaration with reference to the enumerated type colors
Each enumerated variable is assigned a valid value. The output shows the name of the assigned enumerated
constant and the actual value for each enumerated variable. A special rule for the conversion operator CONV is used for the latter.
ABAP Short Reference ABAP Short Reference
This documentation is copyright by SAP AG.
Length: 3517 Date: 20240329 Time: 082349 sap01-206 ( 41 ms )