Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Classic Lists →  Create lists 

POSITION

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


POSITION pos. 

Effect

This statement places the list cursor at the position in the current line in the list buffer specified in pos. The program expects a data object of the type i for pos. If the value of pos is 0 or less or is greater than the page length in sy-linsz defined with the addition LINE-SIZE to the program initiating statement or NEW-PAGE, all subsequent output statements do not create any output until the list cursor is positioned within a line again.


Notes

  • An output statement that follows POSITION and does not have its own position specification pos after AT writes to the specified position regardless of whether or not sufficient space is available on the line, cutting off the output length accordingly, if necessary.
  • When an output position is output within existing output, please note that the item always refers to the characters stored in the list buffer. If characters that require more than one column in the list are displayed in a Unicode system, the output position displayed can differ from the specified output position, and the content displayed for output that has been partially overwritten, can move, depending on the character used to overwrite.

Example

Definition and use of a macro write_frame to draw frames around WRITE output. The POSITION statement positions the list cursor for subsequent output.

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. 
  ULINE AT x(l). 
  y = y + 2. SKIP TO LINE y. 
  ULINE AT x(l). 
  y = y - 1. x = sy-colno. SKIP TO LINE y. POSITION x. 
END-OF-DEFINITION. 

SKIP. 
WRITE       'Demonstrating'. 
write_frame 'dynamic frames'. 
WRITE       'in'. 
write_frame 'ABAP'. 
WRITE       'output lists.'.