Arith - Exp - Arithmetic Expressions - ABAP Keyword Documentation
Arith - Exp - Arithmetic Expressions - ABAP Keyword Documentation
Search URL
SAP NetWeaver AS ABAP Release 752, ©Copyright 2017 SAP AG. All rights reserved.
Quick Reference
Syntax
... [+|-] operand1
[{+|-|*|/|DIV|MOD|**} [+|-] operand2
... ]] ...
Effect
An arithmetic expression expresses a calculation. The result of an arithmetic expression is a numeric value of the
calculation type assigned to the arithmetic expression. In an arithmetic expression arith_exp, the
arithmetic operators +,
-, *, /, DIV,
MOD, or ** can be used to join an operand operand1 with one or more operands operand2, operand3 ...
Brackets are also possible. The calculation is made in accordance with
calculation rules specified by the calculation type in
question.
If functional methods or
character-like expressions
are specified as operands, they are specified from left to right and from
inside to outside before the remainder of the expression is evaluated. The return values are buffered to be used in the
corresponding operand positions. Here,
character-like processing functions and
string expressions are only possible as
arguments of description functions.
Notes
Note whether the value of a data object that is also used as an operand is changed in a specified functional
method.
Even if an operand of this type precedes the functional method, its value will always be changed by the method
before it is evaluated.
Example
The following program excerpt computes the hyperbolic sine with the Eulerian formula in the explicit calculation type
decfloat34 and with the
built-in function sinh in calculation type f and displays the difference.
https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abapcompute_arith.htm 1/4
2/4/22, 10:32 PM arith_exp - Arithmetic Expressions - ABAP Keyword Documentation
REPORT kellerh_test1.
TYPES:
BEGIN OF line,
diff TYPE string,
END OF line.
DATA
DO 2001 TIMES.
TRY.
( exp( x ) - exp( -1 * x ) ) / 2 ).
DATA(result2) = sinh( x ).
APPEND VALUE #(
x = |{ x }|
ENDIF.
ENDTRY.
ENDDO.
cl_demo_output=>display( output ).
Exceptions
Handleable Exceptions
CX_SY_ARG_OUT_OF_DOMAIN
CX_SY_ARITHMETIC_OVERFLOW
https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abapcompute_arith.htm 2/4
2/4/22, 10:32 PM arith_exp - Arithmetic Expressions - ABAP Keyword Documentation
CX_SY_CONVERSION_NO_NUMBER
CX_SY_CONVERSION_OVERFLOW
CX_SY_PRECISION_LOSS
CX_SY_UNSUPPORTED_FUNCTION
https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abapcompute_arith.htm 3/4
2/4/22, 10:32 PM arith_exp - Arithmetic Expressions - ABAP Keyword Documentation
CX_SY_ZERODIVIDE
Non-Handleable Exceptions
Continue
arith_exp - ( )
https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abapcompute_arith.htm 4/4