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

# rel_exp - Relational Operators for Bit Patterns

The table below shows the relational operators for comparisons of operands (single data objects or return values or
bit expressions) with bit patterns in byte-like operands in
comparison expressions. The data type of the right operand `operand2`

must be byte-like
(`x`

or `xstring`

). It contains the bit pattern with
which the left operand `operand1`

is compared. If `operand1`

is shorter than `operand2`

, hexadecimal zeroes are added on the right of `operand1`

(in accordance with the
comparison rules) to lengthen it appropriately. No conversion takes place. The data type of `operand1`

must also be byte-like
(`x`

or `xstring`

).

operator | Meaning |
---|---|

`O` |
Ones: True if the bits that are 1 in `operand2` , are also 1 in `operand1` .If `operand2` contains only zeroes, the relational expression is always true. |

`Z` |
Zeroes: True, if the bits that are 1 in `operand2` are 0 in `operand1` .If `operand2` contains only zeroes, the relational expression is always true. |

`M` |
Mixed: True, if of the bits that are 1 in `operand2` , at least one is 1and one is 0 in `operand1` . If `operand2` contains only zeroes, the relational expression is always false. |

Other versions:
7.31 | 7.40 | **7.54**

Note

For the result of the comparisons, it is irrelevant whether the bits that are 0 in `operand2`

, are 1 or 0 in `operand1`

.

Example

The logical expression in the `IF`

statement is false, because, before the
comparison, 00 is added on the right of `hex1`

. If the content of `hex2`

were 111100, the comparison would be true.

```
DATA: hex1 TYPE xstring,
hex2 TYPE xstring.
hex1 = 'FFFF'.
hex2 = '111111'.
IF hex1 O hex2.
...
ENDIF.
```