Arithmetic operators in SAP ABAP

Author | Last Updated| | 1 Comments Facebook Share Twitter Share Google Plus Share A+ A-


Working with Arithmetic operators in SAP ABAP, using sum, subtraction, division in SAP ABAP

Arithmetic operators are used in mathematical expressions in the same way that they are used in algebra. The following are the arithmetic operators available in SAP ABAP.

Operator Usage
+ (Addition) It is used to add two or more variable/values of numeric type.
DATA: LV_ONE TYPE N VALUE '10'.
DATA: LV_TWO TYPE N VALUE '20'.
DATA: LV_THREE TYPE N.
LV_THREE = LV_ONE + LV_TWO. "Result lv_three will be 30
- (Subtraction) It is used to subtract one or more variable/values of numeric type from a variable .
DATA: LV_ONE TYPE N VALUE '10'.
DATA: LV_TWO TYPE N VALUE '20'.
DATA: LV_THREE TYPE N.
LV_THREE = LV_TWO + LV_ONE. "Result lv_three will be 10
* (Multiplication) It is used to multiply two or more variables.
DATA: LV_ONE TYPE N VALUE '10'.
DATA: LV_TWO TYPE N VALUE '20'.
DATA: LV_THREE TYPE N.
LV_THREE = LV_TWO * LV_ONE. "Result lv_three will be 200
/ (Division) It is used to divide a variable by a variable.
DATA: LV_ONE TYPE N VALUE '10'.
DATA: LV_TWO TYPE N VALUE '20'.
DATA: LV_THREE TYPE N.
LV_THREE = LV_TWO / LV_ONE. "Result lv_three will be 2
MOD (Modulus) Divides left hand operand by right hand operand and returns the remainder.
DATA: LV_ONE TYPE N VALUE '10'.
DATA: LV_TWO TYPE N VALUE '20'.
DATA: LV_THREE TYPE N.
LV_THREE = LV_TWO MOD LV_ONE. "Result lv_three will be 0

Tutorial Comments

Total Comments: Add your Comment
31 May 2018

sap nuts gives the complete idea

Leave a Comment

Enter Comment Text