ABAP supports the four basic arithmetic operations and power caluclations. You can use the following arithmetic operators in mathematical expressions:
Operator
|
Meaning
|
+
|
Addition
|
‑{}‑-
|
Subtraction
|
‑{}‑*
|
Multiplication
|
‑{}‑/
|
Division
|
DIV
|
Integer division
|
MOD
|
Remainder of integer division
|
‑{}‑**
|
Powers
|
Instead of using operators in mathematical expressions, you can perform basic arithmetic operations with the keywords ADD, SUBTRACT, MULTIPLY, and DIVIDE.
The following table shows the different ways of expressing basic arithmetic operations in ABAP:
Operation
|
Statement using
mathematical expression
|
Statement using
Keyword
|
Addition
|
p = n + m.
|
ADD n TO m.
|
Subtraction
|
P = m – n.
|
SUBTRACT n FROM m.
|
Multiplication
|
P = m * n.
|
MULTIPLY m BY n.
|
Division
|
P = m / n.
|
DIVIDE m BY n.
|
Integer division
|
P = m DIV n.
|
---
|
Remainder of division
|
P = m MOD n.
|
---
|
Powers
|
P = m ** n.
|
---
|
No comments:
Post a Comment
Note: only a member of this blog may post a comment.