SAP NetWeaver AS ABAP Release 750, ©Copyright 2016 SAP AG. All rights reserved.
ABAP - Keyword Documentation → ABAP Programming Guidelines → Structure and Style → Alternative Spellings →Calculations
Background
In ABAP, the arithmetic operators in arithmetic expressions are used for numeric calculations. Alongside the operand format, the dedicated ABAP keywords ADD, SUBTRACT, MULTIPLY and DIVIDE are also used for the basic arithmetic operations.
Rule
Use the operator format
For calculations, use the operator format with the equals sign (=) instead of the ABAP keyword format.
Details
Calculations with the statements ADD, SUBTRACT, MULTIPLY, and DIVIDE are often more difficult to read than the corresponding operator format. Calculations other than the basic arithmetic operations cannot be expressed by ABAP keywords in any case.
Exception
The command format allows the use of chained statements, which can be useful in these special cases:
If arithmetic operations are in the form a = a + 1, where the target variable and one of the operands are identical, using the statements ADD, SUBTRACT and so on has the advantage of being easier on the eye, especially when the name of the target variable is relatively long:
It is immediately clear to the observer that the value of the specified variables is reduced by one. This may not be the case for the operator format, if it is not straightaway obvious that the target variable and one of the operands are identical. In such cases you can and should ignore the above rule. The primary concern is the readability of the source code.
Bad Example
The following source code shows a multiplication using the statement MULTIPLY.
Good Example
The following source code shows the same example as above, but in the more compact operator format.