In SAP ABAP, integer data types are used to store whole numbers. The main integer data types in ABAP are:
1. I (Integer)
- Type: Fixed-length, signed 4-byte (32-bit) integer
- Value Range: -2,147,483,648 to +2,147,483,647
- Example declaration:
DATA lv_int TYPE I.lv_int = 100.
2. INT1 (1-byte integer, Tiny Integer)
- Type: Unsigned 1-byte (8-bit) integer
- Value Range: 0 to 255
- Example declaration:
DATA lv_int1 TYPE INT1.lv_int1 = 200.
3. INT2 (2-byte integer, Small Integer)
- Type: Signed 2-byte (16-bit) integer
- Value Range: -32,768 to +32,767
- Example declaration:
DATA lv_int2 TYPE INT2.lv_int2 = 30000.
4. INT4 (4-byte integer, Standard Integer)
- Equivalent to
I
type (32-bit integer) - Example declaration:
DATA lv_int4 TYPE INT4.lv_int4 = 200000.
Additional Notes:
- No INT8 in Standard ABAP: ABAP does not have an 8-byte integer (
INT8
). Instead, you can useDECFLOAT
orP
(Packed Number) for larger numbers. - Conversion Considerations: Be careful when converting between integer types to avoid overflow errors.