Ansicht
Dokumentation

ABENUNTYPED_CHARACTER_LITERALS - UNTYPED CHARACTER LITERALS

ABENUNTYPED_CHARACTER_LITERALS - UNTYPED CHARACTER LITERALS

Fill RESBD Structure from EBP Component Structure   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

Character Literals

... 'c$[c$[c$[...$]$]$]' $| `$[c$[c$[c$[...$]$]$]$]` ...

Effect

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 length of the enclosed characters, including trailing blanks. A text field literal is between 1 and 255 characters long. 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 text string literal can have a maximum of 255 characters. The empty text string literal `` represents an empty 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 combine multiple literals with the same type into a literal of this type.

If a text field literal is specified at an operand position at which a text symbol is possible, the three-digit identifier idf of a text symbol can be appended 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 combined with text symbols.

Notes

  • Only text field literals, not text string literals, can be used if a literal is to be combined 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. Since the maximum line length in the ABAP Editor is restricted to 255 characters, a literal with 255 characters can never 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, only real text string literals with backquotes should be used for performance reasons.

Example

Representation of quotation marks and backquotes in character literals. The first two and the last two literals have the same result.

Example

If quotation marks and backquotes are required within a string, string templates are also suitable, whose special characters are uniformly escaped with \.






Vendor Master (General Section)   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 5225 Date: 20240426 Time: 214421     sap01-206 ( 83 ms )