WRITE - Output to a list


Basic form

WRITE f.

Additions



1. ... AT pl (position and length specification,
before the field)
2. ... option (formatting option)
3. ... ofmt (output format by field)
4. ... AS CHECKBOX (output as checkbox)
5. ... AS SYMBOL (output as symbol)
6. ... AS ICON (output as icon)
7. ... AS LINE (output as line)

Effect

Outputs the field f in the correct format for its type to the current list. The field f can be:

Examples

TABLES SPFLI. DATA N TYPE I VALUE 123. ... WRITE N. WRITE SPFLI-FLTIME. FIELD-SYMBOLS <CF>. ASSIGN 'NEW YORK' TO <CF>. WRITE <CF>. WRITE: '---->', SPFLI-DISTANCE. WRITE: TEXT-001, SPFLI-ARRTIME.
or
WRITE: 'Time:'(001), SPFLI-ARRTIME.

Text symbols can be addressed in two different ways (TEXT-001 or'Time:'(001)) .

Notes

If no explicit position is specified for a field on a new line, it is output on the left (in column 1). Otherwise, output is one column removed from the previously output field. If a field does not fit on one line, a new line is started.
You can perform explicit positioning with a position and length specification (see addition 1) or with ABAP/4 statements (e.g. POSITION ). In this case, the field is always output at the defined position, even if the line is not quite long enough for it to fit completely.
If a field is too long to fit completely on the line, the excess characters are truncated.
Each field occupies a number of characters in the list. If this number is not explicitly defined (see addition 1), the system uses a type-specific standard length or the output length specified in the ABAP/4 Dictionary .

Type-specific output: (len = field length)
TypeStandard output lengthOutput
Clen left-justified
D8 left-justified
F22 right-justified
I11 right-justified
Nlen left-justified
P2*len or 2*len+1 right-justified
T6 left-justified
X2*len left-justified
Number fields (types P , I and F ) are always output right-justified, but all other types are left-justified; if required, blanks are used for padding. With number fields, leading zeros are replaced by blanks. If there is enough space, types P and I have thousands separators. To accommodate the decimal point, the output length of type P fields is 1 byte longer.

Addition 1

WRITE AT pl (position and length
specification before the field)

Effect

You can use the position and length specification pl to define the precise output position and length of a field. The specification consists of:

/ New line
c Output position (1-3 character number or variable)
(l) Output length (1-3 character number or variable)

Combinations are possible.

Examples

DATA: WORD(16), VALUE '0123456789ABCDEF', COL TYPE I VALUE 5, LEN TYPE I VALUE 10. WRITE AT / WORD. "new line WRITE AT 5 WORD. "column 5 WRITE AT (10) WORD. "output length 10 WRITE AT /5(10) WORD. "new line, column 5, length 10 WRITE AT COL WORD. "column = contents of COL WRITE AT (LEN) WORD. "output length = contents of LEN WRITE AT /COL(LEN) WORD. "new line, column = contents of COL "output length = contents of LEN

Note

The position and length specification must appear before the field. If the position and length specification contains only constants, you the introductory AT is unnecessary. (In the first four of the above examples, you can therefore omit AT .) Always write the position and length specification without gaps and in the specified order. Leave at least one space between the position and length specification and the field name. For dynamic positioning, see also POSITION . No output results from positioning to the right of the far right edge of the page. With explicit column specifications, the field is output from this column, even if it no longer completely fits on the line or overwrites another field. If the output length is too short, number fields (types P , I and F are prefixed with an asterisk ('*'), while all other types are truncated on the right. If you want the abbreviated output of a variable, you should always use WRITE (10) T100-TEXT rather than WRITE T100-TEXT(10) (sub-field access).
On the one hand, the first form is always allowed and the second form can be forbidden for certain data types (e.g. TYPE P ). On the other hand, only the first form guarantees the identity of the variables for GET CURSOR ... FIELD and F1 help.

Addition 2

... option (formatting option)

Effect

You can modify the output of the field f by using one of the special formatting options .

Addition 3

... ofmt (output format by field)

Effect

Outputs the field with the specified output formats (color, intensity, ready for input, ...).
You can use the same output options as for FORMAT . If no specifications are made, the field is output with the standard formats or with the format set by a preceding FORMAT statement.

Example

DATA F. FORMAT INTENSIFIED OFF INPUT. WRITE F INPUT OFF INVERSE COLOR 3.

Note

The format specifications with WRITE apply only for output of the field f . They modify the currently valid format for this field. This means that, in the above example, the non-highlighted output remains for the field F . When f has been output, the system reverts to the old format.

Addition 4

... AS CHECKBOX (output as checkbox)

Addition 5

... AS SYMBOL (output as symbol)

Addition 6

... AS ICON (output as icon)

Addition 7

... AS LINE (output as line)

Note

General notes on outputting boxes to lists

When you output a list, this is sometimes combined with vertical and horizontal lines to form closed boxes:


Index
© SAP AG 1996