Get Example source ABAP code based on a different SAP table
ABAP_ENUM , Use This example demonstrates the use of enumerated types>.
ABAP_SOURCE_CODE DEMO CL_DEMO_ENUMERATED_TYPES
ABAP_DESCRIPTION The class calls the method SHOW> of class CL_DEMO_WRAP_BROWSER>>. Two enumerated types are defined as follows in this class: TYPES: BEGIN OF ENUM size STRUCTURE sz, s, m, l, xl, END OF ENUM size STRUCTURE sz. TYPES: BEGIN OF ENUM format STRUCTURE fmt, l, p, END OF ENUM format STRUCTURE fmt.> The use of enumerated structures> means that the same name l> can occur twice. The method SHOW > wraps the method SHOW_HTML> of the class CL_ABAP_BROWSER>>: METH CL_DEMO_WRAP_BROWSER=>SHOW The input parameters size> and format format> of the method have the identically named enumerated types and can only contain their enumerated values. These are mapped to the corresponding constants of class CL_ABAP_BROWSER>. These constants are to be regarded as a workaround for real enumerated types, which did not exist when CL_ABAP_BROWSER> was developed. Enumerated values can be entered for the size and format when the class is executed. The internal transfer to the program takes place by deserializing the character-like values to the local enumerated variables size> and format>. The exception for invalid values is caught internally, whereby the enumerated variables are initialized, which corresponds to the values of the enumerated constants sz-s> and fmt-l>.