SAP ABAP Operators

The source code of SAP ABAP consists of either statement or comment. Statement is a combination of operators, operands, variables, and keywords.

  • Operands : – Operands are the variables which you need to perform particular operation.
  • Variables : – Variables is the name given to the memory location.
SAP ABAP Operators

SAP ABAP operators are further classified into different types of operators, they are

  1. Arithmetic Operators
  2. Comparative Operators
  3. Logical Operators.

There should be at least one space between any type of operator. for e.g.

Arithmetic Operators

SAP ABAP/4 supports various arithmetic operators to perform various mathematical functions. For all Arithmetic operators, the default keyword COMPUTE is added at the beginning of the statement.

OperatorDescriptionExample
+ + (Addition) operator is used to add the values5+3 = 9
 – (Subtraction) operator is used to subtract the values5-3  = 9
** (Multiplication) operator is used to multiply the values5*3 = 15
**** operator is used for exponential of values5**3 = 125
MODMOD operator is used for reminder of division of two integer5 mod 2
// (Division) is used to divide the values5/3 = 1.66

Comparative Operators

The different types of comparison abap operators are as follows

OperatorDescriptionExample
< or LTLess thanA < B or A LT B
<= or LELess than or equalA <= B or A LE B
> or GTGreater thanA > B or A GT B
>= or GEGreater than or equalA >= B or A GE B
= or EQEqualA = B or A = B
<> or NENot EqualA <> B or A NE B

Logical Operators

Logical operators are used to check the results of more than one statement combination.

OperatorDescriptionExample
ANDAND (Is True) operator is used when all the statements are trueIF A > B AND A > C

A is Biggest.

ENDIF

OROR (Is True) operator is used when at least one statement is trueA < B OR A < C
NOTNOT?