ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Character String and Byte String Processing → Statements for Character String and Byte String Processing → WRITE - TO
WRITE - Predefined Formats
The predefined output format of the statements WRITE
... TO and
on the data type and user-specific settings. It is partly dependent on the length available. In the
WRITE ... TO, this is the length of the target variable; in the case of
WRITE, this is the
output length. If the length is not sufficient, the variables are truncated as specified in the predefined
Other versions: 7.31 | 7.40 | 7.54
The following table shows the predefined alignment for the predefined ABAP types.
|Numeric data types||Right-aligned|
|Character-like data types||Left-aligned|
|Byte-like data types||Left-aligned|
Numeric Data Types
- In the numerical data types (
s), i , and
p, the last position on the right is reserved for the plus/minus sign (this also applies to
b, even though these numbers are always positive). Negative values are given a minus "-" here in the result and positive values a blank. The thousand separators defined in the user master record are inserted if there is enough length available. With data type p, decimal places are respected (regardless of the program property fixed point arithmetic). A decimal separator is inserted where necessary (see below).
- If enough length is available, decimal floating point numbers with the data types
decfloat34are displayed in mathematical notation and with the thousand separators defined in the user master data. If there is not enough length for the fractional portion of the number, it is rounded commercially to the number of positions available. If there is not enough length for the whole part of the number, the value is formatted in scientific notation without thousand separators. Negative numbers are prefixed with a minus sign in both cases. An exponent is always displayed with a sign, but with no leading zeros. Trailing zeros in the fractional portion are not shown.
- A binary floating point number with the type
fis formatted in scientific notation, prefixed with a sign (empty if the number is positive), a position before the decimal separator, a maximum of 16 decimal places, the character "E", and a three-figure exponent, including sign.
- If there is not enough space to display a number using these rules, an exception is raised for decimal floating point numbers only. Other numerical types are truncated and flagged with "*".
- Note that, for the data types
s, the predefined output lengths for lists ignore the place that is reserved for the sign. This can produce unexpected results.
- For information about the number format with regards to decimal and thousands separators, see below.
Character-Like Data Types
Data objects with character-like data types are formatted in accordance with the code page. For information about character-like date fields and time fields, see below.
Byte-Like Data Types
Byte-like data objects are formatted in hexadecimal format, where one byte is represented by two characters.
Number, Date, and Time Formats
With one exception, numbers, date formats, and time formats are defined by the current
formatting setting of the
which can be configured using
The predefined number format for the output of numerical fields (which decimal and thousands separators are selected) is defined by the current formatting setting. The formats available correspond to the country-specific number formats. Thousands separators are inserted only if there is enough length available.
The predefined date format for the output of character-like date fields of type
d and time stamps is defined by the current
formatting setting. The formats available correspond to the
country-specific date formats. Separators are inserted only if there is enough length available. A character-like date field is formatted regardless of its content.
Character-like time fields of type
t and times specified in time stamps are
by default always displayed in 24-hour format with colons as separators. Separators are inserted only
if there is enough length available. To use a 12-hour format defined in the current formatting settings,
ENVIRONMENT TIME FORMAT must be used. A character-like time field is formatted regardless of its content.
Time Stamp Output
The output of time stamps for which the addition
TIME ZONE is specified is constructed from a date output and a time output in the current format, separated by a blank. The 12-hour
time format is not possible and the decimal separator for fractions of seconds is always a comma (