In ABAP programming COMPUTE is the keyword to process an arithmetic or string or bit expression and store the result into a variable. The expression that should be computed will be on right side and result storing variable will be on the left side with COMPUTE statement.There is an addition “EXACT” used with with this statement when need to store the exact result without any rounding. In most of the cases we can avoid the COMPUTE keyword ( but it will be a must when we need to use EXACT statement )
COMPUTE statement syntax
- COMPUTE Variable = Arithmetic_expression. or
- COMPUTE EXACT Variable = Arithmetic_expression.
Run-time error with EXACT statement
- CX_SY_CONVERSION_ROUNDING
See a sample source code with this statement