SAP EQUALS OPERATOR



Get Example source ABAP code based on a different SAP table
  


• = ABAP_ASSIGN_OPERATOR
VERSION 5 IN

=, Assignment Operator

ABAP_SYNTAX
lhs = rhs.

What does it do?
An operator = that is placed in a statement between a left hand side lhs and a right hand side rhs acts as an assignment operator, that assigns the value of the right hand side to the left hand side. If necessary, a conversion takes place.
The right side rhs, which is the source of the assignment, is a general expression position and can be specified as follows:
As a single data object
As a return value or result of functional methods, built-in functions, or constructor expressions or table expressions
As a result of calculation expressions
The left side lhs, the target of the assignment, is a both a declaration position and a result position and can be specified as follows:
As any data object that can be specified in a write position. The data type of the data object must either be compatible with the assigned value or must be convertible to the data type of lhs in accordance with one of the conversion rules. If the assigned value does not match the data type of lhs, the exceptions described in the conversion rules can occur.
As an inline declaration DATA(var) or FINAL(var). The data type of the declared variable is determined by the right side and is described for the different rhs options. Any variable that is used on the right side cannot be declared on the left side. An identically named data object of a more global context can be used on the right side and is not hidden by the local declaration until after the statement.
As a writable expression representing an operand to which the right side can be assigned.
If an exception is raised on the right side, the statement is not executed, and the value of the target field is undefined.



Latest notes:

See also calculation assignments with the operators +=, -=, *=, /=, and =.
NON_V5_HINTS
If lhs is a data object, it can be prefixed with the obsolete keyword COMPUTE, which has no effect however and should therefore be omitted.
Another obsolete form of the assignment is the statement MOVE rhs TO lhs, where the left side is on the right side and does not include all options of the assignment operator =.
ABAP_HINT_END

ABAP_PGL
Assignments with the assignment operators = and ?= only
ABAP_PGL_END

ABAP_EXAMPLE_VX5
Assignments of a literal, a constructor expression, and an arithmetic expression to target fields.
ABEXA 01015
ABAP_EXAMPLE_END