Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Program structure →  Modularization Statements →  Source Code Modules →  Macros 

Macros

The example shows how to use and include macros.

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 = y - 1. SKIP TO LINE y. POSITION x.
  ULINE AT x(l).
  y = y + 2. SKIP TO LINE y. POSITION x.
  ULINE AT x(l).
  y = 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 frame around the placeholder &1 on a list.