ABAP Keyword Documentation →  ABAP Programming Guidelines →  Structure and Style →  Alternative Spellings

# Calculations

Other versions: 7.31 | 7.40 | 7.54

## 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

### Using 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:

`ADD increment TO: sum_individual,                   sum_total.`

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:

`SUBTRACT 1 FROM reference->structured_attribute-component.`

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.

The following source code shows a multiplication using the statement `MULTIPLY`.
`MULTIPLY n1 by n2.`
`n1 = n1 * n2`.