Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Declarations →  Declaration Statements →  Data Types and Data Objects →  Declaring Data Objects →  Literals 

Character Literals

Other versions: 7.31 | 7.40 | 7.54


... 'c[c[c[...]]]' | <i class="bn">[</i>c<i class="bn">[</i>c<i class="bn">[</i>c<i class="bn">[</i>...<i class="bn">]</i><i class="bn">]</i><i class="bn">]</i><i class="bn">]</i> ...


Character literals can be either text field literals or text string literals. A text field literal is a character string enclosed in single quotes ('); a text string literal is a character string of alphanumeric characters c enclosed in single backquotes (`).

Syntax Name Possible Characters
'...' Text field literal String of any alphanumeric characters. The data type is c with the lengthof the enclosed characters (including trailing blanks). The length of a text field literal must liebetween 1 and 255 characters. There is no empty text field literal: The text field literal '' has the same meaning as the text field literal '' with length 1. To represent a quotation mark in a text field literal, two consecutive quotation marks must be specified.
... Text string literal String of any alphanumeric characters. The data type is string. A textstring literal can have a maximum of 255 characters. The empty text string literal `` represents anempty string with length 0. To represent a backquote in a text string literal, two consecutive backquotes must be specified.

Character literals that span multiple lines are not allowed. The literal operator & can, however, be used to join multiple literals with the same type as a composite literal.

If a text field literal is specified at an operand position at which a text symbol is possible, you can append the three-digit identifier idf of a text symbol in round brackets.

... 'Literal'(idf) ...

If the text symbol exists in the currently loaded text pool, then the content of the text symbol is used instead of the literal, otherwise the literal is used. Text string literals cannot be assocaited with text symbols.

Programming Guidelines


  • Only text field literals (not text string literals) can be used to associate a literal with a text symbol.

  • Trailing blanks in text field literals use memory, but are generally ignored in operand positions, like all data objects of the type c. In text string literals they are always relevant, as is the case for all data objects of type string.

  • Quotation marks can be represented directly in text string literals and backquotes in text field literals.

  • The maximum length of the content of a character literal is 255 characters, which means that a literal with 255 characters cannot be specified within a single line of a program (due to the quotation marks or backquotes). The maximum length of 255 characters can be achieved only by using the literal operator &.

  • String templates, which only contain literal text, behave like text string literals, but are not evaluated until runtime. For standalone operands that are not part of an expression, for performance reasons only real text string literals with backquotes are to be used.


Represents quotation marks and backquotes in character literals. The first two and the last two literals always have the same meaning.

cl_demo_output=>write_text( 'This is John''s bike' ). 
cl_demo_output=>write_text( `This is John's bike` ). 
cl_demo_output=>write_text( 'This is a backquote: `' ). 
cl_demo_output=>write_text( `This is a backquote: ``` ). 
cl_demo_output=>display( ).


If quotation marks and backquotes are required in a string, string templates are also suitable, whose special characters are consistently masked with \.

cl_demo_output=>display( |Quote: ', Backquote: `, Bar: \| | ).