DEFINE (ABAP Keyword) introduction and details and syntax
Defines a program component (macro) under
the name macro . It must consist only of ABAP/4 statements and is expanded at
A macro should always be concluded with the
In the definition, you can use &n to
reference positional parameters (n = 0 .. 9). When the macro is called, &n
is replaced by the n-th actual parameter.
Define a macro
called “++” for use in the program.
ADD 1 TO
DATA: NUMBER TYPE I VALUE 1.
In general, it is better to use subroutines
(FORM , FUNCTION ) rather than macros because subroutines – unlike macros – are
supported by all the ABAP/4 Development Workbench tools (including debugging,
runtime analysis, runtime error handling, …).
You cannot nest macro