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 (
||Text field literal||String of any alphanumeric characters. The data type is
||Text string literal||String of any alphanumeric characters. The data type is
Character literals that span multiple lines are not allowed. The
& 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.
- 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
- 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
- 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: \| | ).