ABAP Keyword Documentation → ABAP − Reference → Program Layout → Modularization Statements → Source Code Modules → Macros
Macros
This example demonstrates how macros are created and included.
Other versions: 7.31 | 7.40 | 7.54
Source Code
REPORT DEMO_MACRO.
DATA: x TYPE i, y TYPE i, l TYPE i.
DEFINE write_frame.
x = sy-colno. y = sy-linno.
WRITE: '|' NO-GAP, &1 NO-GAP, '|' NO-GAP.
l = sy-colno - x.
y -= 1. SKIP TO LINE y. POSITION x.
ULINE AT x(l).
y += 2. SKIP TO LINE y. POSITION x.
ULINE AT x(l).
y -= 1. x = sy-colno. SKIP TO LINE y. POSITION x.
END-OF-DEFINITION.
SKIP.
write_frame 'In a frame!'.
Description
This example first defines and then uses the macro write_frame
, which draws a box around the placeholder &1
in a list.