<-- previous rule | overview | next rule -->
Replaces textual comparison operators (LT, LE, EQ, NE, GE, GT) with symbolic comparison operators (<, <=, =, <>, >=, >) or vice versa.
- ABAP Keyword Documentation: Use consistent spelling
- ABAP Keyword Documentation: Obsolete Relational Operators
- Preferred set of comparison operators: [symbolic (<, <=, =, <>, >=, >)]
- Replace regular comparison operators with preferred variant
- Replace obsolete comparison operators (>< => =<) with preferred variant
CLASS any_class IMPLEMENTATION.
METHOD use_consistent_comparison_ops.
IF a EQ b OR c NE d.
IF a < c AND b > d
AND b < e.
IF a LE d AND c GE b.
result = xsdbool( a <= d OR a GE b ).
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
FORM any_form.
" these obsolete variants are only possible outside of the object-oriented context:
IF a >< b AND b => c OR c =< d.
RETURN.
ENDIF.
ENDFORM.
Resulting code:
CLASS any_class IMPLEMENTATION.
METHOD use_consistent_comparison_ops.
IF a = b OR c <> d.
IF a < c AND b > d
AND b < e.
IF a <= d AND c >= b.
result = xsdbool( a <= d OR a >= b ).
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
FORM any_form.
" these obsolete variants are only possible outside of the object-oriented context:
IF a <> b AND b >= c OR c <= d.
RETURN.
ENDIF.
ENDFORM.