WRITE

Short Reference

Syntax

WRITE {[AT] [/][pos][(len|*|**)]} dobj
      [int_format_options]
      [ext_format_options]
      [list_elements]
      [QUICKINFO info].


Extras:

1. ... [AT] [/][pos][(len|*|**)]

2. ... QUICKINFO info

Effect

This statement writes the content of the data object dobj to the current page of the current list in the list buffer. All flat data types and the data type string are allowed for dobj; structures are treated as a data object of type c and must be character-like in Unicode systems. The data object dobj can be specified by a field symbol or a dereferenceddata reference (for release 6.10 and later). The format of the output is predefined ( see predefined output formats), but can be modified with the additions AT and int_format_options. The output that has been formatted in this way, can be formatted further with ext_format_options, and list_elements allows specific list elements to be displayed.

The output position is either determined by the list cursor, or specified with pos after AT. At the start of every output, the output position in the list buffer is the same as that in the list representation. In Unicode systems, the positions of individual characters within an output field can differ between the list representation and the list buffer. In both cases, though, the output length is the same.

The output length is determined through the data type of dobj or can be specified with len|*|** after AT. len specifies an absolute length , whereas * or ** ensure that characters in Unicode systems are not truncated by mistake.

If the last line of the current page is reached and a subsequent line is output, a new page is generated. The maximum number of lines is determined with the addition LINE-COUNT of the introductory statement or the statement NEW-PAGE. For the basics list, the END-OF-PAGE event is triggered when the area reserved for the page footer is reached, and a new page is subsequently generated.

After positioning of the list cursor with a previous output statement, if the output length is larger than the area available in the current line of the list buffer, the output goes to the next line. If this line is also not sufficient for a complete output, the output length is correspondingly shortened and the output is displayed in this line.

If the list cursor is positioned using the pos specification or a statement BACK, NEW-LINE, NEW-PAGE, POSITION or SKIP and not with a previous output statement, then the output is always displayed in the current line, and the output length is shortened, if necessary.

After the output is displayed, the list cursor is positioned by default in the second position after the output; the sy-colno and sy-linno system fields are set correspondingly.

If the data object dobj is declared with reference to a data type from the ABAP Dictionary, the field and input help defined there are available in the list displayed on the screen.

Note

In the default setting, the system does not place a new line in a list that contains only blank characters. Such a line is displayed only if the list cursor is directly positioned in an existing line, i.e. , not via a line break. You can change this setting with the statement SET BLANK LINES ON.

Addition 1

... [AT] [/][pos][(len|*|**)]

Effect

The output position and length for the current statement WRITE can be defined after AT. The output position of already existing outputs in the list buffer is overwritten with the output length of the new output. After overwriting an already existing output, the list cursor is placed at the next position, not two positions over.

The components of the position and length specification /, pos and len resp. * resp. ** must be listed with no spaces and in the specified sequence. If pos and len are not specified at all or are declared as numeric literals, the addition AT can be omitted.

Data type * **
c Number of columns needed in the list to display the entire content; no final blank characters are taken into account. In Unicode systems, this length can be greater than the implicit length. Doubled data object length.
string implicit length Doubled number of characters contained therein.
n, x, xtring implicit length implicit length
d 10 10
t 8 8
i, f, p Necessary length to output current value, including thousands separator; value determined after evaluating possible additions CURRENCY, DECIMALS, NO-SIGN, ROUND or UNIT. Necessary length to output maximum possible value, including thousands separator; value determined after evaluating possible additions CURRENCY, DECIMALS, NO-SIGN, ROUND or UNIT.

When a conversion routine is executed with reference to a data type in the ABAP Dictionary, when len is specified, it is carried out for the lengths specified therein, and when * or ** are specified, it is carried out for the output lengths specified in the ABAP Dictionary. When specifying * or **, the output length is then determined according to the aforementioned rules from the result of the conversion routine. The specification of * or ** when using formatting templates (USING EDIT MASK, DD/MM/YYYY etc.) is described in the respective section.

Notes

Example

This example outputs a text field text at different positions, with different output lengths.

DATA: text TYPE string VALUE '0123456789ABCDEF',
      col  TYPE i VALUE 25,
      len  TYPE i VALUE 5.

WRITE text.
WRITE /5(10) text.
WRITE AT col(len) text.

Addition 2

... QUICKINFO info

Effect

A Quickinfo is assigned to the output. If the mouse cursor is placed on the output area of dobj, the content of info appears in a colored rectangle. For info, a character-type data object of the length 40 is expected.

The addition QUICKINFO has no effect on ready-for-input fields and line elements. If a list output is overwritten by another output, then no Quickinfo for the overwritten field appears beginning from the position at which the overwriting starts.

Example

Additional information to output of date and time.

WRITE: (10) sy-datum QUICKINFO 'Date of list creation',
       (8)  sy-uzeit QUICKINFO 'Time of list creation'.