Entering content frame

Positioning WRITE Output on the List Locate the document in its SAP Library structure

You can position the output of a WRITE statement on the list by making a format specification before the field name as follows:

Syntax

WRITE AT [/][pos][(len)] f.

where

        the slash '/' denotes a new line,

        pos is a number or variable up to three digits long denoting the position on the screen,

        len is a number or variable up to three digits long denoting the output length.

If the format specification contains only direct values (that is, no variables), you can omit the keyword AT.

Example

WRITE 'First line.'.

WRITE 'Still first line.'

WRITE /'Second line.'

WRITE /13 'Third line.'

This generates the following output on the screen:

First Line. Still first line.
Second line.
            Third line.

If you specify a certain position pos, the field is always placed in that position regardless of whether or not there is enough space available or whether other fields are overwritten.

Example

DATA: len TYPE i VALUE 10,
      pos TYPE i VALUE 11,
      text(10) TYPE c  VALUE '1234567890'

WRITE 'The text ------------ appears in the text.'.

WRITE AT pos(len) text.

This produces the following output:

The text -1234567890- appears in the text.

If the output length len is too short, fewer characters are displayed. Numeric fields are truncated on the left and prefixed with an asterisk (*). All other fields are truncated on the right, but no indication is given that the field is shorter.

Example

DATA: number   TYPE i VALUE  1234567890,
      text(10) TYPE c VALUE 'abcdefghij'.

WRITE: (5) number, /(5) text.

This produces the following output:

*7890

abcde

In the default setting, you cannot create empty lines with the WRITE statement. You can learn more about empty lines and how to change the default setting under Inserting Blank Lines in the section 'Creating Lists'.

Example

WRITE:   'One',
       / '   ',
       / 'Two'.

This produces the following output:

One
Two

The system suppresses lines that contain nothing but blanks.

 

Leaving content frame