ABAP Keyword Documentation → ABAP - Reference → Declarations → Declaration Statements → Data Types and Data Objects → Declaring Data Objects → Literals
Numeric Literals
Numeric literals consist of continuous sequences of numbers with a maximum of 31 digits (0 to 9), which can be directly preceded by a plus (+) or minus (-) sign.
- Numeric literals between -2147483648 and 2147483647 are
integer literals and have the predefined ABAP type
i
.
- Numeric literals outside of this interval are
packed numeric literals
and have the predefined ABAP type
p
with a length of 8 bytes if they are not longer than 15 digits, and with a length of 16 bytes if they are between 16 and 31 digits long.
Other versions:
7.31 | 7.40 | 7.54
Notes
- In numeric literals, neither decimal separators nor scientific notation with mantissa and exponent are possible.
- Numbers that cannot be represented as numeric literals can only be specified in character literals. If used in operand positions where which a numeric value is expected, they are converted accordingly.
- Numeric literals that extend across multiple lines are not permitted. Furthermore, the
literal operator
&
cannot be used to create a composite literal from multiple numeric literals.
Example
The first literal has the type i
. The following literals have the type p
and lengths 8 and 16.
DATA: t TYPE c LENGTH 1,
l TYPE i.
DESCRIBE FIELD 123456 TYPE t.
cl_demo_output=>write( t ).
DESCRIBE FIELD 123456790123 TYPE t LENGTH l IN BYTE MODE.
cl_demo_output=>write( |{ t } { l }| ).
DESCRIBE FIELD 12345679012345678 TYPE t LENGTH l IN BYTE MODE.
cl_demo_output=>write( |{ t } { l }| ).
cl_demo_output=>display( ).