ABAP Keyword Documentation → ABAP − Reference → Declarations → Declaration Statements → Classes and Interfaces → ABAP Objects - Overview → Classes → Components of Classes
Data Types and Constants of ClassesOther versions: 7.31 | 7.40 | 7.54
TYPES statement can be used
to define any number of self-defined ABAP data types within a class. Types are not instance-specific and only exist once for all the objects in the class.
In particular, it is possible to define data types in the public visibility section of global classes, which makes the use of type groups in this context obsolete.
Bound data types
Bound data types that
occur as properties of instance attributes or static attributes are also considered to be static attributes
of a class. After a
LIKE addition, the class name can be used to access the
properties of instance attributes (exceptions to this rule are the statements ASSIGN
... CASTING and
SELECT-OPTIONS ... FOR). In addition, a reference variable can be used with an object component selector without the object having previously been created.
Constants are special static
attributes, whose values are specified when they are declared and which cannot be changed later.
Constants are declared using the statement
CONSTANTS. Constants are not instance-specific and exist only once for all the objects in a class.
In particular, it is possible to define constants in the public visibility section of global classes, which makes the usage of type groups in this context obsolete.