SAP DATA ENUM ABAP Statements



Get Example source ABAP code based on a different SAP table
  



DATA, TYPE, LIKE enum
Short Reference

ABAP_SYNTAX
DATA enum_var ${ ${TYPE enum_type$}
$| ${LIKE enum_dobj$} $}
$[VALUE val$|${IS INITIAL$}$]
$[READ-ONLY$].

What does it do?
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.



Latest notes:

NON_V5_HINTS
For more information about using enumerated variables, see enumerated objects.
ABAP_HINT_END

ABAP_EXAMPLE_VX5
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.
ABEXA 00171
ABAP_EXAMPLE_END

Return to menu