ABAP Keyword Documentation → ABAP - Reference → Predefined Types, Data Objects, Functions, and Constructors → Predefined Data Types → Predefined ABAP Types
Predefined Character-Like Types
The data objects of the character-like data types are used to handle character strings.
Other versions: 7.31 | 7.40 | 7.54
Properties
Type | Length | Standard Length | Name |
---|---|---|---|
c |
1 to 262,143 characters | One character | Text field |
string |
Variable | Text string | |
n |
1 to 262,143 characters | One character | Numeric text field |
d |
8 characters | Character-like date field | |
t |
6 characters | Character-like time field |
Value Ranges and Initial Values
Type | Value Range | Initial Value |
---|---|---|
c |
Any alphanumeric characters | " " for every position |
string |
As for type c |
Empty string with length 0 |
n |
Any alphanumeric characters; only valid values are the digits 0 to 9, however | "0" for every position |
d |
Any eight alphanumeric characters; only those digits are valid, however, that are valid as datesaccording to the calendar rules in the format "yyyymmdd": "yyyy"(year): 0001 to 9999, "mm" (month): 01 to 12, "dd" (day): 01 to 31 | "00000000" |
t |
Any six alphanumeric characters; the only valid values are numbers that are valid as times in the24-hour clock format "hhmmss". "hh" (hours):00 to 23, "mm" (minutes): 00 to 59, "ss" (seconds): 00 to 59. | "000000" |
Notes
- The character-like data types are mainly used for string processing.
- The data types
c
andstring
are general character-like data types;n
,d
, andt
, on the other hands, have special attributes. They are the only predefined ABAP types that are compatible with the special types NUMC, DATS, and TIMS in ABAP Dictionary. All other special data types in ABAP Dictionary are assigned to general ABAP types.
- For information about using the character-like date type
d
and time typet
, see Character-Like Date Fields and Time Fields.
- When specifying lengths for character-like types, note that the length of a character in bytes depends on the character representation used. A character has a length of one byte in non-Unicode systems. In Unicode systems, UTF-16 is used as the system code page and a character is two bytes long.
- The types
c
andn
, for which a length interval is specified in the second column in the first table, are generic, which means that the length is not part of the type description. The entries in the Standard Length column specify the length used in declarations of data objects when using types with generic lengths, if no explicit length is specified in the relevant statement.
- The system class CL_ABAP_ELEMDESCR contains constants TYPE_C_MAX_LENGTH
and TYPE_N_MAX_LENGTH for the maximum length of the types
c
andn
.
- For the data types
n
,d
, andt
, the valid values are a subset of their value range. ABAP statements that work with data objects of these types are only guaranteed to function correctly for operands with valid values.
- The maximum size of strings must be respected.