Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Built-In Types, Data Objects, Functions, and Constructors →  Predefined Data Types →  Built-In 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 1 character Text Field
n 1 to 262,143 characters 1 character Numeric text field
string Variable   Text string

Value Ranges and Initial Values

Type Value Range Initial Value
c Any alphanumeric characters " " for every position
n Any alphanumeric characters; only valid values are the digits 0 to 9, however "0" for every position
string As for type c Empty string with length 0


Notes

  • The data types c and string are general character-like data types, but n, on the other hand, has special properties. The data type n corresponds to the special type NUMC in ABAP Dictionary.

  • Further character-like data types with special properties are the built-in date types and time types that match the corresponding types DATS and TIMS in ABAP Dictionary. All other special character-like data types in ABAP Dictionary are assigned to the general ABAP types listed here.

  • The content of the data objects of character-like data types is saved in the memory in accordance with the current system code page

  • When specifying lengths for character-like types, note that the length of a character in bytes depends on the character representation used. The length of a character is two bytes for the character representation UCS-2 used by the ABAP programming language.

  • The types c and n, 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 and n.

  • The valid values of the data type n are a subset of its value range. ABAP statements that work with data objects of this type are only guaranteed to function correctly for operands with valid values.

Example

Declares character-like data objects with built-in character-like data types. The flag flag is limited to one character and the set of characters in the string html is variable.

DATA: flag TYPE c LENGTH 1, 
      html TYPE string.