ABAP Keyword Documentation → ABAP - Reference → Predefined types, data objects, and functions → Predefined Data Types → Predefined Types in ABAP Dictionary → Use of Predefined Data Types from ABAP Dictionary
Decimal Floating Point Numbers in ABAP Dictionary
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:
- DF16_DEC, DF16_RAW, and DF16_SCL for 16-digit numbers.
- DF34_DEC, DF34_RAW, and DF34_SCL for 34-digit numbers.
The following applies to these data types:
- 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 the aggregate functions SUM andAVG
,UPDATE
withSET
+
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.
- 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 indices. For this type, no calculations can be executed on the database. Since it is an SAP-specific format, corresponding fields also cannot be edited in Native SQL statements using ADBC. The scaling is lost when writing to the database.
- DF16_SCL and DF34_SCL
Data type 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.
Handling in Screens
In a domain, or directly in a structure component created using one of the types for decimal floating numbers, one of the following output styles is always defined. The output style determines how a decimal floating point number is displayed on the screen of a dynpro.
- Simple - default, mathematic or scientific notation (depending on space)
- Sign on the right - commercial notation
- Scaling-preserving - Format with preservation of scaling, including trailing zeros after the decimal place
- Scientific - Scientific notation
- Scientific with leading zero - Scientific notation with a 0 before the decimal point.
- Scaling-preserving scientific - Scientific notation including trailing zeros in the mantissa.
- Technical - Scientific notation whereby the exponent is always an integer and a multiple of 3.
For screen fields whose data type is not defined in thABAP Dictionary, the output style can also be determined in the Screen Painter.
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 operations.
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.