sapdev logo background
sapdev logo sapdev logo
Comments

SAP LITERAL OPERATOR documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

Literal Operator
The literal operator can be used to join two literals (of the same type) as a single literal. In this way, the definition of one literal can be extended across multiple program lines. The content of the resulting literal must match its type and its length must not exceed the associated maximum length.
The literal operator can be used for the character literals , but not for the numeric literals . The syntax for text field literals and text string literals is:
'...' '...' ... '...'
`...` `...` ... `...`
These categories of literals cannot be mixed.
The literal operator can normally be used to join literals in any reader position . Exceptions to this are literals specified dynamically in parentheses , literals in parenthesized lists separated by commas (here the only relevant operand position is
WHERE IN ) and literals in embedded
Native SQL .

Notes
  • As well as for literals, the literal operator can also be used to join string templates .

  • Any trailing blanks in text field literals are respected by the literal operator.

  • When used for literals, the literal operator must not be confused with the chaining operator

  • that can be used in string expressions to chain character-like operators. Whereas linking literals with the literal operator takes place once at the compilation of a program, the chaining operator executes a genuine operation at runtime and chains any number of character-like operands. The trailing blanks of operands with fixed lengths, in particular text field literals, are ignored.
  • Character literals joined using the literal operator are subject to the upper limit of 255 characters. Longer character strings can only be concatenated at runtime, for example, with the chaining operator .


  • Example
    Constructs an HTML string from subliterals.
    DATA html TYPE string.

    html =
    `<(><<)>html>` <(> <)>
    `<(><<)>body>` <(> <)>
    `Text` <(> <)>
    `<(><<)>/body>` <(> <)>
    `<(><<)>/html>`.

    cl_abap_browser=>show_html( html_string = html ).
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    LITERAL_GLOSRY
    LITERAL_OPERATOR_GLOSRY




    comments powered by Disqus