ARTICLE
Program structure
Each ABAP program starts with an
introductory statement that depends on the
program type .
The functions of an ABAP program are implemented in processing blocks.
Processing blocks are defined using
modularization statements . You
can use declarative statements in
processing blocks of the type
procedure 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. You
can only implement your class in the implementation part. The order of
the processing blocks or implementation sections is irrelevant for
program execution, but should be designed to make the program easy to
read.
Every ABAP program provides predefined data types,
data object and predefined functions .
Following the introductory statement, every program contains a global
declaration section, in which you implement the
definitions and declarations 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, you have to take into account that an ABAP statement can only
refer to existing definitions and declarations. For example, a reference
variable can only refer to a previously defined class, which in turn can
only implement a previously defined interface. Once a
procedure has been introduced, you can
declare data types and data objects that are visible within the
procedure. The declaration of data types also includes the
typing of objects that have an undetermined data type
when the program is created.
All the other statements of an ABAP program are implementation
statements, which can always be assigned to a
processing block . You use the
implementation statements 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 to statements that have
been replaced with improved language constructs, but which have not been
eliminated in order to ensure downward compatibility. In ABAP Objects -
that is, in the implementation of methods -, almost all of the obsolete
language elements will fail syntax checks. In general, you should no
longer use these language elements in new programs, but you may to
encounter them in older programs.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved