Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarative statemnts →  Classes and Interfaces →  ABAP Objects - Overview →  Classes →  Components of Classes 

Data Types and Constants

Other versions: 7.31 | 7.40 | 7.54

Data Types

Independent Types

You can use the TYPES statement to define any number of your own ABAP data types within a class. Types are not instance-specific and are only available 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 or static attributes also belong to the 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 generated.

Constants

Constants are special static attributes for which values are specified when they are declared. These values cannot be changed later. Use the CONSTANTS statement to declare constants. Constants are not instance-specific - they are only available once for all the objects in the class.

In particular, it is possible to declare constants in the public visibility section of global classes, which makes the use of type groups in this context obsolete.