Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Character String and Byte String Processing →  Expressions and Functions for String Processing 

string_exp - String Expressions

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


... { |string_template| } 
  | { operand1 && operand2 [&&  operand3 ... ] } ...

Effect

A string expression formulates an operation (calculation) with character-like operands. The result of a string expression is a character string. A string expression consists of

String expressions can occur in the reading positions of certain statements, in particular on the right side of an assignment with the assignment operator =.

The operands of string expressions must have character-like data types. Structures with character-like-only flat components cannot be specified.

If constructor expressions are specified as operands of string expressions, their data type is not determined by the string expression. The

character can be specified for the data type of the constructor expression only if the type can be determined from the constructor expression itself.


Notes

  • The program DEMO_EXPRESSIONS shows examples of how to use string expressions.
  • String expressions and arithmetic expressions can not be mixed. Arithmetic expressions can, however, also be specified as embedded expressions of string templates. In addition, the formatting options of embedded expressions or string functions in operand positions can contain arithmetic expressions as arguments.
  • The conversion operator CONV can be applied to a structure with character-like-only components to use it as an operand of a string expression.
  • If the right side of an assignment appends strings to a variable specified with the type string on the left side of the assignment, the variable is used directly in specific cases without producing a subtotal. Care must be taken to preserve this optimization, especially in loops.

Example

Displays a string expression. This is a chaining of a string literal with a string template that contains an embedded expression.

cl_demo_output=>display( 

   `Hello ` && |{ sy-uname }!| 

   ).

Continue

string_exp - String Templates

string_exp - Character String Operator

string_exp - Performance Note