Friday, September 9, 2022

ARITHMETIC OPERATORS IN SAP ABAP


 SAP ABAP supports various arithmetic operators for performing mathematical operations on variables and constants. Here are the commonly used arithmetic operators in SAP ABAP:
  1. Addition (+): The addition operator is used to add two values.

  2. Subtraction (-): The subtraction operator is used to subtract two values.

  3. Multiplication (*): The multiplication operator is used to multiply two values.

  4. Division (/): The division operator is used to divide two values.

  5. Integer division (DIV): The integer division operator is used to divide two values and return the quotient as an integer.

  6. Modulus (MOD): The modulus operator is used to divide two values and return the remainder.

  7. Exponentiation (**): The exponentiation operator is used to raise a number to a power.

  8. Absolute value (ABS): The absolute value operator is used to return the absolute value of a number.

  9. Round (ROUND): The round operator is used to round a number to a specified number of decimal places.

  10. 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.









****************   ARITHMETIC OPERATORS IN SAP ABAP ********************

DATA TYPE i,   " DECLARING VARIBLES.
       Y TYPE I,
       TYPE I.


10.  " Initialization.
10.

WRITE :'The Values Of Two Numbers Are X = 'X'Y = 'Y.


+ Y.  " Addition

ULINE.
WRITE :'The Sum Of Two Numbers  Is:'COLOR CENTERED.  " Display statement.

ULINE.
10.  " Initialization.
10.

Y.  " SUBTRACTON

WRITE :'The Subtraction Of Two Numbers  Is:'COLOR CENTERED.  " Display statement.

ULINE.

* Y.  " MULTIPLICATION


WRITE :'The Multiplication Of Two Variables Is:'COLOR CENTERED.

ULINE.

/ Y.  " DIVISION


WRITE :'The Division Of Two Variables Is:'COLOR LEFT-JUSTIFIED.

ULINE.








Follow me for more on LinkedIn : 👍 (432) LinkedIn

SAP ABAP System Variables

  In SAP ABAP, system variables are predefined variables that hold system-related information. Here are some commonly used system variables ...