SAP ABAP Data types
ABAP Data types are defined as the users view on the data, i.e. it is the data format at user interface. The data format is based on the type of database is using.
SAP ABAP uses various data types in the work areas for data, the different data types are as follows.
Types of data types
- Elementary data types
- Complex data types
- Reference data types
Elementary data types : – Elementary data types are further categorize into two types
- Fixed Length
- Variable Length
Fixed Length
Keyword | Data Type | Example |
C | Text field | “Hello World” |
N | Numeric | 00500 |
D | Date | “20171201” |
T | Time | “233010” |
P | Packed Number | 200.50 |
I | Integer | 500 |
F | Float point number | 4e5 |
Variable Length
Keyword | Type |
STRING | Character Sequence |
XSTRING | Byte Sequence |
Pre-defined elementary ABAP data types
SAP delivers predefined data types with length and templates, where the field length is defined in bytes.
Data Type | Int. field length | Valid field length | Initial value | Description |
Character Types | ||||
C | 1 | 1 – 65535 | ‘….’ | It is a text field for alphanumeric characters |
N | 1 | 1 – 65535 | ‘0 … 0’ | Numerical text field for only numeric characters |
D | 8 | 8 | ‘00000000’ | Date field allows in format YYYYMMDD |
T | 6 | 6 | ‘000000’ | Time field allows in format HHMMSS |
Numeric Types | ||||
I | 4 | 4 | 0 | For Integers (Whole numbers) |
F | 8 | 8 | 0 | For floating point number |
P | 8 | 1 – 16 | 0 | Packed decimal numbers |
Important notes
- Data type N is not a numeric type, type N objects con only contains numeric characters (0…….9), but they are not represented as internally as numbers.
- The value range of data type I number is -2**31 to 2**31-1 and consists only whole numbers. Data type I (Integer) is used for the values of counters, number of items, indexes, etc.
- Data type P allows digits after the decimal point. The number of decimal place is generic and is determined in the program. Type P can be used for distance,weights, etc.
- The Non-numeric data types such as C (Text field), D(Data), N(Numeric), T (Time) are character types. Fields in this type are allowed to enter characters and it takes enough memory for coding.
Complex types : – Complex types includes structures types and table types.
Reference Types : – Reference types includes data references and object references.