Ansicht
Dokumentation

ABENSTRING_OPERATORS - STRING OPERATORS

ABENSTRING_OPERATORS - STRING OPERATORS

Addresses (Business Address Services)   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

- &&

... operand1 && operand2 ...

Effect

The concatenation operator && concatenates two operands in a string expression into one character string.

The operand positions operand are enhanced character-like expression positions, which means that character-like data objects, string expressions, and built-in functions, or functional methods and method chainings whose return value has a character-like data type, can be specified. Furthermore, apart from built-in functions, generic expressions with non-character-like data types can also be specified, which can be converted to the type string. The operand operand must be elementary. Structures with character-like-only flat components cannot be specified.

In the case of character-like operands with a fixed length, trailing blanks are ignored. An operand that does not have a character-like data type is regarded implicitly as an embedded expression of a string template and formatted as a text string before the concatenation in accordance with the associated predefined format.

Notes

  • String functions with character-like return values are particularly suitable when specifying built-in functions as operands.
  • The concatenation operator && must not be confused with the literal operator &, which combines two character literals to one literal. The literal operator is generally used if a literal 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 string expression with a concatenation operator, on the other hand, is recalculated each time, like all expressions, and can be used to concatenate any number of character-like operands.
  • If on the right side of an assignment, strings are appended using && to a variable specified with the type string on the left side of the assignment, the variable is used directly in some cases without producing an interim result. It should be ensured that this optimization is preserved, especially in loops.
  • A calculation assignment with the operator &&= can be used as a short form for assignments of concatenations.

Concatenation of four operands as the character string "Hello world!". The last operand is a string template that has only literal content.

This example demonstrates that a non-character-like operand in a concatenation is handled like an embedded expression and is not converted in accordance with the conversion rules. After handling as an embedded expression, the minus sign is placed to the left of the number. After the conversion, it is placed to the right of the number.






ABAP Short Reference   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 5303 Date: 20240425 Time: 015551     sap01-206 ( 75 ms )