ABAP Keyword Documentation → ABAP − Reference → SAP GUI User Dialogs → Classic Lists → Creating Lists → WRITE
WRITE - Output Length
When data is written using the statement WRITE
, the output is saved to the
list buffer and accessed from there for display when the list is called.
Each time a data object is produced by a WRITE
, an output length is defined, either implicitly (in accordance with the tables below), or
explicitly (if len
is specified after the addition AT
). The output length defines the following:
- The number of positions (or memory spaces) available for characters in the list buffer,
- The number of columns (or cells) available in the actual list.
Other versions: 7.31 | 7.40 | 7.54
Predefined Output Lengths
If the output length is not specified explicitly, it is set for built-in ABAP types as shown in the following tables:
Notes
- With all data objects, except those of type
string
, and with text field literals, it is possible that fewer characters are displayed in the list than are saved in the list buffer when predefined output lengths are used. With data objects of data typestring
and text field literals it is assumed that all characters should be displayed. For this reason the implicit output length is calculated using the characters contained in the data object so that it corresponds to the number of columns needed in the list. Any empty spaces added in the list buffer are removed during the writing of the actual list.
- For data objects whose data types are defined in reference to ABAP Dictionary, a different output length can be specified in the corresponding domains or using the built-in type. The output length specified here is used instead of the implicit output length from the table above.
Numeric Data Types
Data Type | Output Length |
---|---|
b |
3 |
s |
5 |
i |
11 |
int8 |
20 |
p |
2 x length of dobj (+ 1, if there is a decimal separator) |
decfloat16 |
24 |
decfloat34 |
46 |
f |
24 |
Notes
- The predefined output length specified in the table above for the type
s
is not sufficient to display the sign for a 5-digit number. If the typesi
andint8
are used, the length is sufficient for all possible numbers without decimal separators.
- If, in the case of type
p
, the number of decimal places is greater than the number of digits calculated from 2 x the length ofdobj
- 1, the predefined length is not enough. This is because the decimal separator is outside the string of digits and needs to be padded with zeroes.
Character-Like Data Types
Data Type | Output Length |
---|---|
c |
Length of dobj , maximum 255 |
string |
Number of columns required in the list. If this is greater than the number of characters in dobj , the surplus places are padded with blanks when written to the list buffer. The fillingtakes place to the right of left-justified outputs, to the left of right-justified outputs and by turns to the right and to the left of centered outputs. |
n |
Length of dobj , maximum 255 |
The output lengths of text field literals is set in the same way as those of data objects of the data type string
.
Note
For the data types SSTRING and STRING, it is not possible specify an output length in ABAP Dictionary and the lengths given in the table above always apply.
Byte-Like Data Types
Data Type | Output Length |
---|---|
x |
2 x length of dobj , maximum 255 |
xstring |
2 x number of bytes contained |
Note
For the data types RAWSTRING and GEOM_EWKB, it is not possible specify an output length in ABAP Dictionary and the lengths given in the table above always apply.
Date Types, Time Types, and Time Stamp Types
Data Type | Output Length |
---|---|
d |
8 |
t |
6 |
utclong |
30 |
Notes
- The predefined output lengths given in the table above for the types
d
andt
are not sufficient to display the correct separator.
- The output length for the data type
utclong
is specified such that the date and time data country-specific date and time formats can be output.
Enumerated Types
The output length of an enumerated type is 30.
Note
In the list output, an enumerated object is converted to the name of the enumerated value, which can have a maximum of 30 characters.
Output Length in List Buffer
If the output length is shorter than the length of the data format specified for the data object or
defined using int_format_options
,
the output is shortened in accordance with the
cutoff behavior described in
WRITE ... TO
.
If the output length is greater than the length of a predefined or user-defined format, this output length is filled in the list buffer and output is arranged there according to the predefined or user-defined alignment. Space that is not required is filled with blanks.
Output Length in the List
When displaying or printing a list, the content stored in the list buffer is passed to the list Each
character generally occupies one position in the list buffer. However, a character can occupy more than
one column in the list (this is particularly the case with East Asian characters). However, since the
list only contains the same number of columns as there are positions in the list buffer, this means
the list can only display fewer characters than are stored in the list buffer. The list output is then
shortened during the transfer from the list buffer to the list, left-justified outputs are shortened
from the right, right-justified outputs are shortened from the left. Centered outputs are shortened
by the alternative removal of the first empty space from both sides, starting with the side with the
most empty spaces, then other characters are removed from the right hand side. If characters are removed
when passed from the list buffer to the list, this is indicated on the left by the character <
and on the right by the character >
. On a displayed list, the entire list content can be displayed by choosing System → List → Unicode Display.
Class for Calculating Output Lengths
The methods of the system class CL_ABAP_LIST_UTILITIES can be used to calculate output lengths in the list buffer and in list display. The return values of these methods can be used to program a correct column alignment for ABAP lists, even if they contain characters that require more than one column.