=, Arithmetic Expression
7.31 | 7.40 | 7.54
result = arith_exp.
The following can be specified for
- A variable compatible with the numeric result of the arithmetic expression or to whose type the result can be converted.
An inline declaration
DATA(var). The data type of the declared variable
varis the statically identifiable calculation type, where generically typed field symbols and formal parameters are respected using a standard type described there.
If an existing variable is specified for
result, its data type is respected when determining the
calculation type. If the calculation type is not the data
result, the result is converted to the data type of the result field before the assignment is made.
- The fact that the result field is respected when the calculation type is determined is a special property of ABAP that should always be kept in mind.
The calculation type that is dependent on the data type of the result field is a major different from an
assignment of data objects; if data objects are incompatible,
the source field is always converted to the data type of the target field. When arithmetic expressions are assigned, their operands can also be converted to the data type of the result field before the calculation.
The first assignment is an assignment of an arithmetic expression, because of its sign. The
calculation type is determined as
result is given the value "731036", the number of days since 01.01.0001. The second assignment, on the other hand, has the same meaning as an
assignment of data objects and produces the value "20020704" in
DATA: result TYPE string, date TYPE d VALUE '20020704'. result = + date. result = date.