Numeric Data Types

ABAP supports three numeric data types. These are:

Type I Data

The value range of type I numbers is -2**31 to 2**31-1 and includes only whole numbers.

Non-integer results of arithmetic operations (e.g. fractions) are rounded, not truncated.

You can use type I data for counters, numbers of items, indexes, time periods, and so on.

Type P Data

Type P data allows digits after the decimal point.

The value range of type P data depends on its size and the number of digits after the decimal point. The valid size can be any value from 1 to 16 bytes. Two decimal digits are packed into one byte, while the last byte contains one digit and the sign. Up to 14 digits are allowed after the decimal point. For further information about defining decimal places, see the section Basic Form of the DATA Statement.

When working with type P data, it is a good idea to set the program attribute Fixed point arithmetic (see Maintaining Program Attributes). Otherwise, type P numbers are treated as integers.

You can use type P data for such values as distances, weights, amounts of money, and so on.

Type F Data

The value range of type F numbers is 1x10**-307 to 1x10**308 for positive and negative numbers, including 0 (zero).

The accuracy range is approximately 15 decimals, depending on the floating point arithmetic of the hardware platform.

Since type F data is internally converted to a binary system, rounding errors can occur. Although the ABAP processor tries to minimize these effects, you should not use type F data if high accuracy is required. Instead, use type P data.

If you need large value ranges, and rounding errors are not important, you can use type F data.

Using I and F fields for calculations is quicker than using P fields. Arithmetic operations using I and F fields are very similar to the actual machine code operations, while P fields require more support from the software. Nevertheless, you may be obliged to use type P data to meet accuracy or value range requirements.

Type N data does not contain numbers. Although it consists of digits, these digits are not used for calculations. Typical type N fields are account numbers and zip codes.