Skip to content

ABAP Keyword Documentation →  ABAP Dictionary →  Predefined Data Types in ABAP Dictionary →  Attributes of the Predefined Dictionary Types →  General Dictionary Types 

Decimal Floating Point Numbers

In decimal floating point numbers, a maximum of 16 or 34 decimal places are returned exactly in the mantissa depending on the data type.

Other versions: 7.31 | 7.40 | 7.54

Handling in ABAP Dictionary

In ABAP Dictionary, the following data types are available for decimal floating numbers:

These data types are a replacement for real decimal floating point types that are supported by all database systems:

  • DF16_DEC and DF34_DEC

    In database fields of this type, decimal floating point numbers are stored as a packed number (format DEC). The length and the number of decimal places must be specified when defining a data type in ABAP Dictionary. Calculations (SELECT with appropriate SQL expressions or with the aggregate functions SUM and AVG, UPDATE with SET +, and -) can be performed on the database for this type. When there is a write to the database, the system implicitly rounds off to the number of decimal places and decimal overflows can occur. Database fields with these types can be edited in Native SQL.
  • DF16_RAW and DF34_RAW

    In database fields of this type, decimal floating point numbers are stored as binary (In RAW format). The length is set to 16 or 34 places. Values can be sorted, compared, and used in indexes. For this type, no calculations can be executed on the database. This is an SAP-specific format, which means that the corresponding fields also cannot be edited in Native SQL. The scaling is lost when writing to the database.


Notes

  • The actual predefined data type from ABAP Dictionary used for decimal point numbers depends on their purpose.

  • The types DF16_DEC and DF34_DEC can be used for calculations on the database, but their value ranges are smaller than those of real decimal floating point numbers.

  • The types DF16_RAW and DF34_RAW cover the whole value range, but are not recognized as numbers by the databases.

  • As well as the types above, there are also the obsolete predefined data types DF16_SCL and DF34_SCL for decimal floating point numbers with scaling.

  • In database fields of this type, decimal floating point numbers are stored in the same way as DF16_RAW or DF34_RAW (length 16 or 34 places, and the same restrictions apply). The scaling must be specified in a direct successor database field with type INT2. When a decimal floating point number is written, this field is automatically filled with the scaling and during reading, the scaling is automatically taken from it.

  • It is strongly advised not to use the types DF16_SCL and DF34_SCL. Their functions are rarely needed and the additional column for scaling makes them too complicated and error-prone to use correctly.

Handling in Dynpros - Output Length and Output Style

The maximum output length that can be specified in a domain for a 16-character decimal floating point number is 24. For a 34-character numbers, 46 is the maximum output length. These are also the default values.

In a domain, or directly in a structure component created using one of the types for decimal floating numbers (but not in data elements with directly specified technical attributes), one of the following output styles is always defined. The output style defines how a dynpro field defined with reference to this domain (or a corresponding ABAP field in the case of list output) is formatted.

  • Simple
Mathematical or scientific notation (depending on space)
  • Leading Sign to the Right
Commercial notation (canceled if not enough space instead of implicit transformation to scientific notation)
  • Scale-preserving
Format with preservation of scaling, including trailing zeroes after the decimal place
  • Scientific
Scientific notation
  • Scientific with leading zero
Scientific notation with a 0 in the place in front of the decimal point
  • Scale-preserving scientific
Scientific notation including trailing zeroes in the mantissa.
  • Technical
Scientific notation where the exponent is always an integer and a multiple of 3. The value range of the places in front of the decimal point is between 1 and 999 (except if the source field has the value 0).

For dynpro fields whose data type is not defined in ABAP Dictionary, the output style can also be determined in Screen Painter. In the case of formatting with the statements WRITE or WRITE TO, the addition STYLE is available (as for the string templates).


Notes

  • If scientific notation is used, a limited number of displayed places in the mantissa is recommended. This can be specified using the predefined function rescale.

  • The "scale-preserving" style ensures that the scaling is restored in conversions from dynpro fields to ABAP, and not just the original value.

  • If vertically aligned decimal separators and exponents are needed on UIs, the scale-preserving scientific notation can be used.

Handling in ABAP Programs

The ABAP types which correspond to the 16 or 34 figure decimal floating numbers in ABAP Dictionary are decfloat16 and decfloat34, which are handled internally according to the IEEE-754-2008 standard, and are supported by all ABAP operations. In arithmetic SQL expressions, decimal floating point numbers are not supported.

The STYLE addition after WRITE [TO] and the STYLE formatting option in embedded expressions are available for the formatting of decimal floating numbers in programs. These overwrite the output style defined in ABAP Dictionary.