Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Assignments →  = - Assignment Operator →  = - Assign Calculation Expressions 

=, String Expression

Other versions: 7.31 | 7.40 | 7.54

Syntax


result = string_exp.

Effect

If a string expression string_exp is specified on the right side of the assignment operator =, its result of type string is calculated and assigned to the left side result.

The following can be specified for result:

  • A variable that has type string or to whose data type the result can be converted.
  • An inline declaration DATA(var). The data type of the declared variable var is string.


Notes

  • In the following example, the result result is a variable with the type string, strings are appended to this variable on the right side, and the strings cannot be dependent on result (as known by the compiler):
result = result && dobj1 && dobj2 && ...
result = |result...{ dobj1 ... }...{ dobj2 ... }...|.
Here, no subtotal is created and an append is made directly on result. In all other cases (namely data types other than string or when expressions or functions are appended on the right side), a subtotal is created first and then assigned. This optimized method improves performance, but care should be taken, especially in loops, that this improvement is not canceled out by using expression or functions on the right side (even if they are not dependent on result). See also the Performance Note for string expressions.

Example

The first assignment declares a target field of the type string inline and assigns it the chained text "12". The second assignment converts the chained text "12" to the number 12.

DATA(text) = '1' && '2'. 

DATA number TYPE i. 
number = 1 && 2.