ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Enumerated Objects
Enumerated Objects, Type Description
This example demonstrates type description in enumerated objects.
Other versions:
7.31 | 7.40 | 7.54
Source Code
DATA(out) = cl_demo_output=>new( ).
TYPES:
BEGIN OF ENUM size,
s, m, l, xl, xxl,
END OF ENUM size.
DATA(size) = VALUE size( ).
out->begin_section( 'DESCRIBE FIELD' ).
DESCRIBE FIELD size TYPE DATA(type)
LENGTH DATA(length) IN BYTE MODE
OUTPUT-LENGTH DATA(output_length).
out->write_data( type
)->write_data( length
)->write_data( output_length ).
out->next_section( 'CL_ABAP_ENUMDESCR' ).
DATA(enum_descr) = CAST cl_abap_enumdescr(
cl_abap_typedescr=>describe_by_data( size ) ).
out->write_data( enum_descr->kind
)->write_data( enum_descr->type_kind
)->write_data( enum_descr->base_type_kind
)->write_data( enum_descr->members ).
out->display( ).
Description
The statement DESCRIBE FIELD
and the type description class CL_ABAP_ENUMDESCR are applied to an enumerated variable size
of the enumerated type with the same name.