SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Program structure → Modularization Statements → Source Code Modules → Macros →Syntax
DEFINE macro.
... &1 ... &9 ...
END-OF-DEFINITION.
Effect
The statement DEFINE defines a macro macro. The following naming conventions macro apply and ABAP words cannot be used. Macros can be defined in all program types, particularly in type groups.
Any number of ABAP statements can come between the statements DEFINE and END-OF-DEFINITION, except for DEFINE, END-OF-DEFINITION, and program-initiating statements. These statements form a source code section that can included under the name macro. The definition of a macro is not bound to the limits of processing blocks.
The validity of a macros is determined buy its position in the compilation unit. It can be inserted at any point after END-OF-DEFINITION in the same compilation unit. If another macro is defined with the same name, it overwrites the previous macro from its new position.
Within a macro, you can use up to nine placeholders &1 ... &9 instead of ABAP words and operands. These placeholders must be replaced by fixed words when the macro is inserted.
Programming Guideline
Only use macros in exceptional cases.
Notes
Example
See Inserting Macros and Macros.