ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Assignments → = - Assignment Operator
= - Assign Return Values and Results
Other versions:
7.31 | 7.40 | 7.54
Syntax
destination = meth( ) |
func( ) |
constr_expr | table_expr .
Effect
If one of the following calls or expressions is specified on the right side of the
assignment operator =
, its return value or result is determined and assigned
to the left side, destination
. If necessary, type-dependent conversions are performed in accordance with the
conversion rules. The following items are possible on the right side:
- A
functional method call
meth( )
including method chainings. The return value of a function method or an attribute addressed using a method chaining always has a full type that must match the type of the left side.
- A built-in function func( ). The type of the return value (which in some numeric functions can be dependent on the data type of the argument) must match the type of the left side.
- A constructor
expression
constr_expr
. The type of the result is determined by thetype
specified for the constructor expression and must match the type of the left side.
- A table expression
table_expr
. The type of the result must match the type on the left side.
The following can be specified for destination
:
- A variable that is compatible with the return value or to whose type the return value or result can be converted.
-
An inline declaration
DATA(var)
. The data type of the declared variablevar
is the statically known type of the return value or result.
Note
If an arithmetic expression is specified as an argument for one of the overloaded numeric functions, the function itself works like an arithmetic expression and its assignment is one of the assignments of arithmetic expressions. This can cause the conversions to be performed in a different order.
Example
Assigns the return value of a method to an internal table declared inline.
METHOD m1.
DATA(itab) = m2( ).
...
ENDMETHOD.