Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Program Flow Logic →  Expressions and Functions for Conditions →  log_exp - Logical Expressions 

rel_exp - Comparison Expressions

Other versions: 7.31 | 7.40 | 7.54

Syntax


... { operand1   {=|EQ|<>|NE|>|GT|<|LT|>=|GE|<=|LE} 
               | {CO|CN|CA|NA|CS|NS|CP|NP}
               | {BYTE-CO|BYTE-CN|BYTE-CA|BYTE-NA|BYTE-CS|BYTE-NS}
               | {O|Z|M} operand2 }
  | { operand [NOT] BETWEEN operand1 AND operand2 }
  | { operand [NOT] IN range_tab }  ...

Effect

Comparison expressions join two or more operands using a relational operator to make a relational expression and produce a truth value as the result of the comparison.

operand1, operand2, and operand are general expression positions, which means that the following can be specified:

When a built-in function, a functional method, or a constructor expression is specified, its return value or result is used as an operand. When a calculation expression is specified, its result is used. A single operand can be compared with all single operands listed in the comparison rules for single operands. A calculation expression can be compared with all single operands or comparisons listed in the comparison rules for calculation expressions.


Example

Typical use of a logical expression, in this case a comparison of a built-in function with a literal, in a IF statement.

DATA flag TYPE c LENGTH 1. 

... 

IF to_upper( flag ) = 'X'. 
  ... 
ENDIF.

Continue

rel_exp - Relational Operators

rel_exp - Comparison Rules