SAP ABAP supports various arithmetic operators for performing mathematical operations on variables and constants. Here are the commonly used arithmetic operators in SAP ABAP:
Addition (+): The addition operator is used to add two values.
Subtraction (-): The subtraction operator is used to subtract two values.
Multiplication (*): The multiplication operator is used to multiply two values.
Division (/): The division operator is used to divide two values.
Integer division (DIV): The integer division operator is used to divide two values and return the quotient as an integer.
Modulus (MOD): The modulus operator is used to divide two values and return the remainder.
Exponentiation (**): The exponentiation operator is used to raise a number to a power.
Absolute value (ABS): The absolute value operator is used to return the absolute value of a number.
Round (ROUND): The round operator is used to round a number to a specified number of decimal places.
Square root (SQRT): The square root operator is used to calculate the square root of a number.
These operators can be used in arithmetic expressions in ABAP to perform calculations on variables and constants.
Y TYPE I,
Z TYPE I.
X = 10. " Initialization.
Y = 10.
WRITE :/ 'The Values Of Two Numbers Are X = ', X, 'Y = ', Y.
Z = X + Y. " Addition
ULINE.
WRITE :/ 'The Sum Of Two Numbers Is:', Z COLOR 1 CENTERED. " Display statement.
ULINE.
X = 10. " Initialization.
Y = 10.
Z = X - Y. " SUBTRACTON
WRITE :/ 'The Subtraction Of Two Numbers Is:', Z COLOR 2 CENTERED. " Display statement.
ULINE.
Z = X * Y. " MULTIPLICATION
WRITE :/ 'The Multiplication Of Two Variables Is:', Z COLOR 3 CENTERED.
ULINE.
Z = X / Y. " DIVISION
WRITE :/ 'The Division Of Two Variables Is:', Z COLOR 4 LEFT-JUSTIFIED.
ULINE.

No comments:
Post a Comment