Defines a section of source code (macro) that you can address
using the name macro. Source code saved as a DEFINE macro may only
consist of complete ABAP statements
All macro use is expanded fully in translation. Macros are a text substitute for the translation phase - not a modularization technique for runtime use.
You conclude a macro with the END-OF-DEFINITION statement.
When you define a macro, you can use placeholders (&n, where n = 1, 2, ..., 9). When the macro is expanded, &n is replaced with the n-th current parameter.
Suppose you define a macro "INCREMENT", which you then
use in your program.
DEFINE INCREMENT. ADD 1 TO &1. END-OF-DEFINITION. DATA: NUMBER TYPE I VALUE 1. ... INCREMENT NUMBER.
As a rule, you should use subroutines ( FORM,
) instead of macros. This is because subroutines - unlike macros -
are supported by all of the ABAP Workbench tools (debugging,
runtime analysis, runtime error handling, ...).