These data types are predefined in the SAP Web AS ABAP kernel, and are visible in all ABAP programs. You can use predefined types to define local data types and objects in a program and to specify the type of interface parameters and field symbols.
Data Type |
Initial Field Length |
Valid Field Length |
Initial Value |
Meaning |
---|---|---|---|---|
Numeric Types |
||||
I |
4 |
4 |
0 |
Integer (whole number) |
F |
8 |
8 |
0 |
Floating point number |
P |
8 |
1-16 |
0 |
Packed number |
Character types |
||||
C |
1 |
1 - 65535 |
' … ' |
Text Field (alphanumeric characters) |
D |
8 |
8 |
'00000000' |
Date field (Format: YYYYMMDD) |
N |
1 |
1 - 65535 |
'0 … 0' |
Numeric text field (numeric characters) |
T |
6 |
6 |
'000000' |
Time field (format: HHMMSS) |
Hexadecimal type |
||||
X |
1 |
1 - 65535 |
X'0 … 0' |
Hexadecimal field |
The initial value (and initial field length in the case of the generic types), are values that are used implicitly in short forms of the TYPES and DATA statements.
The fixed-length predefined types are divided into:
Numeric Types
You can use type I data for counters, numbers of items, indexes, time periods, and so on.
You can use type P data for such values as distances, weights, amounts of money, and so on.
You use type F fields when you need to cope with very large value ranges and rounding errors are not critical.
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 have to use type P data to meet accuracy or value range requirements.
Character Types
Of the five non-numeric types, the four types C, D, N, and T are character types. Fields with these types are known as character fields. Each position in one of these fields takes up enough space for the code of one character. Currently, ABAP only works with single-byte codes such as ASCII and EBCDI.
Hexadecimal Type
The remaining non-numeric type - X - always interprets individual bytes in memory. One byte is represented by a two-digit hexadecimal display. The fields with this type are called hexadecimal fields. In hexadecimal fields, you can process single bits.
A string is a sequence of characters with variable length. A string can contain any number of alphanumeric characters. The length of a string is the number of characters multiplied by the length required for the internal representation of a single character.
A byte string is a hexadecimal type with variable length. It can contain any number of bytes. The length of a byte string is the same as the number of bytes.
The initial value of a string is the empty string with length 0. A structure that contains a string is handled like a deep structure. This means that there are no conversion rules for structures that contain strings.
ABAP contains no predefined complex data types that you can use to define local data types or data objects in a program. All complex data types are based on elementary ABAP types, and are constructed in ABAP programs or in the ABAP Dictionary.