Skip to content

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

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.

Other versions: 7.31 | 7.40 | 7.54


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 ).