POSITION (ABAP Keyword)

POSITION is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details.

POSITION

Basic form
POSITION col.

Effect
The contents of the field col sets the output position (column) of the subsequent WRITE statement.

Notes
If
the column defined by POSITION lies in the part of the line already
described, it will be overwritten by any subsequent WRITE statement.
For vertical positioning (variable line), see SKIP TO LINE .

Example
The
routine LINEOUTPUT has three input parameters – COLUMN , LENGTH and
CHAR . Starting from COLUMN , it outputs a line comprising the
character CHAR with the length LENGTH :

FORM LINEOUTPUT USING COLUMN LENGTH CHAR.
DATA LINEPOS TYPE P.
LINEPOS = COLUMN.
DO LENGTH TIMES.
POSITION LINEPOS. WRITE CHAR.
ADD 1 TO LINEPOS.
ENDDO.
ENDFORM.

If you call the above FORM with

PERFORM LINEOUTPUT USING 5 10 ‘=’.
the output is: