POSITION 语句
语法
POSITION pos.
作用:
这条语句的作用是将list cursor放在当前行的list buffer的 pos 位置。pos是整数类型I, 如果 pos <>
注:
- POSITION语句后的输出语句如果没有再次指定输出位置,不管剩余的空间是否充足,都将直接输出,如果空间不足则会截断输出的文本。
- 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. (不太理解,但基本上是如果输出位置与已经输出的区域重合,新的输出将覆盖原有的文本)
原文:
POSITION
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.'.