WRITE - Output Length
When data is written with a WRITE statement, the output is stored in the
list buffer and accessed from there for display when the list is called.
Each time a data object is output with a WRITE statement, an output length is defined, either
implicitly 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
Output Length in the List Buffer
If the output length is shorter than the length of the format specified for the data object or defined with
int_format_options, the output is shortened as follows when it is written to the list buffer:
- In data objects of the numeric data types i and
p, the thousand separators are removed from left to right and the object is then cut off on the left. These objects are marked with an asterisk ("*") in the first position.
- In data objects of the type f, the number of
decimal places is reduced and the number is rounded accordingly. If the output length is too short for
scientific notation, asterisks ("*") are displayed instead of the numbers.
- All other data types are cut off on the right and not marked, although the separators are removed
first in the data types d and t.
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 transferred to the list as follows:
- In non-Unicode systems, each character
requires the same amount of space in the list buffer as columns in the list. In single-byte systems,
a character occupies one byte in the list buffer and one column in the list, while a character that
occupies several bytes in the list buffer in multi-byte systems also occupies the same number of columns
in the list. For this reason, all the characters stored in the list buffer are displayed in the list in non-Unicode systems.
- In Unicode systems, each character usually 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 shortened accordingly, and the page formatted according to the alignment specified, and assigned an indicator
(> or <).
To display the entire content of a list, choose 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.