ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Character String and Byte String Processing → Expressions and Functions for String Processing → string_exp - String Expressions
string_exp - Character String Operator
One string operator is currently available for string expressions.
Other versions: 7.31 | 7.40 | 7.54
Syntax
... operand1 && operand2 ...
Effect
The chaining operator &&
concatenates two operands in a string expression as a character string.
The operand positions operand
are enhanced
character-like expression positions, which means that
character-like data objects,
string expressions, and
predefined functions, or
functional methods and
method chainings whose return code has a
character-like data
type, can be specified. Furthermore, operands of non-character-like data types can be specified, which are convertible to the type string
.
In the case of character-like operands with a fixed length, trailing blanks are ignored. All operands
that do not have a character-like data type are converted to the type string
before the chaining is performed.
Notes
- In particular, string templates can be specified as operands.
- We recommend string functions with character-like return codes when predefined functions are specified as operands.
- Do not confuse the chaining operator
&&
with the literal operator&
, which joins two character literals as a literal. The literal operator is generally used if a literal string template is to be defined across multiple program lines. The operator is executed only once, when the program is compiled and trailing blanks of character literals are always respected. A character string expression with a chaining operator, on the other hand, is recalculated each time (like all expressions) and can be used to concatenate any number of character-like operands.
Example
Concatenation of four operands as the character string "Hello world!". The last operand is a string template that has only literal content.
DATA text TYPE string VALUE `Hello`.
text = text && ` ` && 'world' && |!|.