Ansicht
Dokumentation
ABAPSUBTRACT_MULTIPLY_DIVIDE - SUBTRACT MULTIPLY DIVIDE
BAL Application Log Documentation ABAP Short ReferenceThis documentation is copyright by SAP AG.
SUBTRACT, MULTIPLY, DIVIDE
SUBTRACT dobj1 FROM dobj2.
MULTIPLY dobj2 BY dobj1.
DIVIDE dobj2 BY dobj1.
Effect
These statements have the same effect as the statements
dobj2 = dobj2 - dobj1.
dobj2 = dobj2 * dobj1.
dobj2 = dobj2 / dobj1.
The content of dobj2
- has the content of dobj1 subtracted,
- or is multiplied by the content of dobj1,
- or is divided by the content of dobj1,
and the result is assigned to dobj2. The data objects dobj1 and dobj2 must be numeric. Only data objects can be specified and no calls or other expressions. The calculation type is determined like an arithmetic expression.
Division by the value 0 is undefined and raises a catchable exception. The only situation where division by 0 does not raise an exception is if the dividend is also 0. Here, the result is set to 0.
Note
The statements shown here have been replaced by
calculation assignments with the operators -=,
*=, and /=
in which the operands can also be specified as expressions.
Example
The variable n has the value 1.50 after the calculation statements. See also the example for the corresponding
calculation assignments.
Exceptions
Catchable Exceptions
- Cause: Overflow in arithmetic operation (type p)
Runtime Error: BCD_OVERFLOW
- Cause: Integer overflow in addition
Runtime Error: COMPUTE_INT_PLUS_OVERFLOW
- Cause: Overflow in arithmetic operation (type p, with specified length)
Runtime Error: BCD_FIELD_OVERFLOW
- Cause: Division by 0 (type p)
Runtime Error: BCD_ZERODIVIDE
- Cause: Division by 0 (type f)
Runtime Error: COMPUTE_FLOAT_ZERODIVIDE
- Cause: Division by 0 (type i)
Runtime Error: COMPUTE_INT_ZERODIVIDE
Non-Catchable Exceptions
Runtime Error: ADD_FIELDS_ILLEGAL_ACCESS
- Cause: p field does not contain the correct BCD format
Runtime Error: BCD_BADDATA
BAL Application Log Documentation CL_GUI_FRONTEND_SERVICES - Frontend Services
This documentation is copyright by SAP AG.
Length: 4681 Date: 20240418 Time: 021920 sap01-206 ( 47 ms )