Naming Conventions and Namespaces
Naming Conventions
The following conventions apply for the names of all definable objects within ABAP programs, such as data types, data objects, classes, macros, or procedures:
- A name can be up to 30 characters in length.
- Permitted are letters from "A" to "Z", numbers from "0" to "9" and underscores (_). Outside of ABAP objects and non-
Unicode programs, the name can start with other characters. If, however, characters are used that are not available in all
code pages supported by SAP, it might not be possible to run certain programs when using a different code page to the one in which they were created.
- The name must start with a letter or an underscore (_). Only outside of ABAP objects can the name also start with a different character.
- The name can have a namespace prefix. A namespace prefix consists of at least three characters that are delimited by two backslashes
(/.../). The entire length of prefix and name cannot exceed 30 characters.
- For data types and data objects, you cannot use the names of predefined ABAP types or predefined data objects.
- Using IDs that are reserved for ABAP words and so on for your own definitions is not actually forbidden, but we do strongly advise against doing this.
- Field symbols are special in that their names have to be enclosed in parentheses (<>).
Namespaces
Outside of class declarations, different objects have separate namespaces, so it is possible that data
types, data objects or procedures can have the same name. Classes and interfaces thus lie within the
same namespace as data types. The namespace is valid for the respective context. Within a context, the
names of the same objects must be unique. For example, there can only be one subprogram of a name in an ABAP program and only one function module of a name in the entire
ABAP system.
Within a class declaration, the name of every class component (data type, attribute, method, event, or alias name) must be unique.
Notes
- All types possible in ABAP are in a namespace. Data types and object types do not have separate
namespaces. A global class, for example, cannot be created with a name that is already being used for a data type in the ABAP Dictionary.
- If names of data types are being used at the same time as names of data objects, it should always
be clear what is meant when they are used in operand positions. This means that it is possible to give a number variable the same name as its data type in clearly-written programs or procedures.
DATA i TYPE i.
On the other hand, declarations like the one below should never be made, and will be picked up by the
extended program check:
DATA d TYPE t.