Ansicht
Dokumentation

ABENWRITE_TRUNCATIONS - WRITE TRUNCATIONS

ABENWRITE_TRUNCATIONS - WRITE TRUNCATIONS

ABAP Short Reference   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.
SAP E-Book

WRITE, Truncation Behavior

This section describes the truncation behavior of the system, if the target field length for the statement WRITE TO or the output length for the statement WRITE is smaller than the length required for the predefined format or the format defined using format_options.

The following sections explain the steps involved in truncating data. The result is truncated until it is short enough to fit the available space.

If the individual formatting options deviate from the rules shown here, these deviations are described for the relevant option.

WRITE TO, Truncation Behavior

Numeric Data Types

Whole Numbers and Packed Numbers

For data objects of numeric data types (b, s), i, int8, and p, the truncation behavior is as follows:

  1. The thousands separators are omitted from left to right.
  2. For positive values, the position for the plus/minus sign on the right is omitted. If the value is negative, the minus sign is retained.
  3. (b, s), i, int8, and p are truncated on the left and an asterisk ("*") is inserted in the first place for identification purposes.

The type int8 produces a syntax check warning (which can be hidden by a pragma), if it is known statically that the output length is less than the predefined length 20.

Decimal Floating Point Numbers

For data objects of type decfloat16 and decfloat34, the truncation behavior is as follows:

  1. In mathematical notation, the thousands separators are omitted from left to right.
  2. In mathematical notation, the decimal points are rounded commercially. In scientific notation, the mantissa is rounded commercially.
  3. If there is not enough space for the places before the decimal separator in mathematical notation, the system automatically switches to scientific notation.
  4. The catchable exception CX_SY_CONVERSION_OVERFLOW occurs
  • if the length is not sufficient for the display of at least one whole number place in mathematical notation or one position of the mantissa in scientific notation,

  • if the length is not sufficient for mathematical notation when the output format SIGN_AS_POSTFIX is used for commercial notation,

  • if the length is not sufficient for the output format SCALE_PRESERVING or SCALE_PRESERVING_SCIENTIFIC (where the scaling is preserved),

The predefined output lengths of 24 or 46 are sufficient for the mathematical notation of 16 or 34 place numbers with a plus/minus sign, a decimal separator and a corresponding number of thousands separators.

Binary Floating Point Numbers

For data objects of type f, the truncation behavior is as follows:

  1. The number of places is reduced, and the number is rounded accordingly.
  2. If the output length is too short for scientific notation, asterisks ("*") are displayed instead of the numbers.

Character-Like and Byte-Like Data Types

For data types c, string, n, d, t, x and xtring, the truncation behavior is as follows:

  1. In a 12-hour format set using ENVIRONMENT TIME FORMAT for data type t, first the space is removed and then the format is changed to the 24-hour format.
  2. For data fields and time fields of type d and t, all separators are removed, unless an addition such as DD/MM/YY or MM/DD/YY is specified for d.
  3. The right side is cut off.

Time Stamp

  • All separators in date and time are removed. The separators in the date are only not removed if a date formatting mask DD/MM/YY or similar is also specified.

  • The space between date and time is removed.

  • The right-hand side is cut off.

Example

This example shows the different truncation behavior for time stamps in packed numbers in list output using the statement WRITE when compared to all other combinations. The format of the output is shown below the source code.

04/08/2019 08:10:16.1539
04/08/2019 08:10:16,1539
04/08/2019 08:10:16.1539
04082019 081016.1539740






CL_GUI_FRONTEND_SERVICES - Frontend Services   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.

Length: 7475 Date: 20240425 Time: 132803     sap01-206 ( 90 ms )