sapdev logo background
sapdev logo sapdev logo
Comments

SAP UNTYPED CHARACTER LITERALS documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

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.
ABAP_PGLS Trailing blanks in character literals
Character Set in Source Code

Notes
  • 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 in all data objects of type

  • string .
  • You can directly represent inverted commas 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 quotes or backquotes). The maximum length of 255 characters can be achieved only by using the literal operator

  • .

    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( ).
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    UNTREATABLE_EXCEPTION_GLOSRY
    UNTYPED_NUMBER_LITERALS




    comments powered by Disqus