SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP Programming Guidelines → Structure and Style → Alternative Spellings →Assignments
Background
For explicit assignments in which the value of a source is assigned to a target, ABAP contains the general assignment operator = and the special casting operator ?=. Statements with these operators
enable assignments of
to variables that can also be declared inline and to writable expressions.
Alongside the assignment operators, two obsolete statements exist for historical reasons that can also perform assignments:
Rule
Assignments with the assignment operators = and ?= only
Use the assignment operators instead of the statement MOVE. Do not use the keyword COMPUTE in front of assignments.
Details
Assignments with the assignment operators = and ?= implement the most global concept. The right side is a general expression position and the left side is a declaration position (except in down casts).
The statements MOVE and COMPUTE have the following drawbacks:
The statements MOVE and COMPUTE were created at a time when assignments were only made between individual data objects and calculations were exclusively arithmetic. Neither of these statements is appropriate in a modern, expression-oriented ABAP program that exploits all options on the left and right sides of an assignments.
Note
The optional addition EXACT of the statements MOVE and COMPUTE, which produces lossless assignments and lossless calculations, has been replaced in full by the lossless operator EXACT.
Bad example
The following source code shows a simple assignment using MOVE and the assignment of an arithmetic expression after COMPUTE.
Good example
The following source code shows the same example as above but without specifying the keywords MOVE and COMPUTE. This makes inline declarations possible on the left side.