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

Character Literals

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 enclosed in single backquotes (`).

Syntax Name Possible Characters
'...' Text field literal String of any alphanumeric characters. The data type is c with the length of the enclosed characters (including trailing blanks). The length of a text field literal must lie between 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 quote in a text field literal, two consecutive quotes must be specified.
`...` Text string literal String of any alphanumeric characters. The data type is string. A text string literal can have a maximum of 255 characters. The empty text string literal `` represents a string with length 0. To represent a backquote in a text string literal, two consecutive backquotes must be specified. An empty text string literal is the same as an empty string of length 0.

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

Trailing blanks are not ignored. 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 associated with text symbols.

Programming Guidelines

Notes

Example

Representation of inverted commas 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( ).