In SAP ABAP, the length of an integer depends on the specific integer type you use. ABAP provides several integer types, each with a fixed length in bytes.


📌 Integer Data Types & Their Lengths

Data TypeDescriptionLength (Bytes)Value Range
IInteger (standard)4 bytes (32-bit)-2,147,483,648 to +2,147,483,647
INT11-byte integer1 byte (8-bit)0 to 255
INT22-byte integer2 bytes (16-bit)-32,768 to +32,767
INT44-byte integer (same as I)4 bytes (32-bit)Same as I

📌 Examples of Integer Length in ABAP

1️⃣ Checking the length of an integer variable

DATA: lv_int TYPE I.
WRITE: 'Integer length:', STRLEN( lv_int ). " Output: 4 (Bytes)

2️⃣ Declaring Different Integer Types

DATA: lv_int1 TYPE INT1 VALUE 255,
lv_int2 TYPE INT2 VALUE 30000,
lv_int4 TYPE INT4 VALUE 200000.
WRITE: / 'INT1 (1 Byte):', lv_int1.
WRITE: / 'INT2 (2 Bytes):', lv_int2.
WRITE: / 'INT4 (4 Bytes):', lv_int4.

📌 Important Notes

🔹 Integers always have a fixed length; you cannot define a custom length. 🔹 ABAP does not have an 8-byte (INT8) integer type. Use P (Packed Number) or F (Floating Point) for large numbers. 🔹 If a calculation exceeds the range of an integer type, it may cause an overflow error.