ABAP Keyword Documentation → ABAP − Reference
Program Layout
- Each ABAP program starts with an introductory statement that is specified by the program type.
- The functions of an ABAP program are implemented in processing blocks. Processing blocks are defined using modularization statements. Declarative statements in processing blocks of the type procedure can be used to define local data types and data objects. The other processing blocks do not have a local data area and any declarative statements apply to the program globally. The most important processing blocks in ABAP objects are methods. They can only be implemented in the implementation part of their class. The order of the processing blocks or implementation parts is irrelevant for program execution, but should be designed to make the program easy to read.
- Each ABAP program can make use of predefined data types, data objects, and predefined functions.
- Following the introductory statement, every program contains a global declaration part, in which definitions and declarations are implemented that are valid and visible in the entire program. This includes the declaration of data types and data objects, as well as the definition of interfaces or the declaration section of classes in ABAP Objects. The definitions of interfaces and classes contain the declarations of their components. While the order of the individual definitions and declarations is not specified, it should be noted that an ABAP statement can only reference existing definitions and declarations. For example, a reference variable can only reference to a previously defined class, which in turn can only implement a previously defined interface. Once a procedure is introduced, data types and data objects that are visible within the procedure can be declared. The declaration of data types also includes the typing of objects that have an undetermined data type when the program is created.
- All other statements of an ABAP program are implementation statements, which can always be assigned to a processing block. The implementation statements are used to implement the functions of a processing block. The functions of all processing blocks are largely implemented using the same statements.
- Since ABAP is a language that has grown over time, it contains several obsolete additions of statements that have been replaced with improved language constructs, but which have not been eliminated to ensure downward compatibility. In ABAP Objects, that is in the implementation of methods, almost all of the obsolete language elements fail syntax checks. In general, these language elements should no longer be used in new programs, but they may still be encountered in older programs.
Other versions: 7.31 | 7.40 | 7.54