Logical Expressions and Control Structures

False Logical Operators

You cannot use the > < , =< und => logical operators in ABAP Objects. This also applies to the WHERE addition of the LOOP statement for internal tables and the WHERE cause of Open-SQL statements.

In ABAP Objects, the following statement causes an error message:

... >< ... =< ... => ...

Correct syntax:

... <> ... <= ... >= ...

Cause:

These operators for not equal to, less than or equal to, and more than or equal to. <>, <=, and >= perform the same function. (as do NE, LE, and GE).

ON CHANGE OF - ENDON not Permitted

The pseudo control structure ON CHANGE OF - ENDON is not permitted in ABAP Objects.

ABAP Objects error message at:

ON CHANGE OF f.
  ...
ENDON.

Correct syntax:

DATA g LIKE f.

IF f <> g.
  ...
  g = f.
ENDIF.

Reason:

The system internally creates a global invisible work field which cannot be controlled by the program. You are recommended to declare your own work field and process it with the IF control structure.

Incorrect statement after CASE

In ABAP Objects WHEN must be the first statement after CASE.

Error message in ABAP Objects if the following syntax is used:

CASE a.
  MOVE 5 TO a.
  WHEN 5.
    WRITE a.
ENDCASE.

Correct syntax:

MOVE 5 TO a.
CASE a.
  WHEN 5.
    WRITE a.
ENDCASE.

Reason:

The CASE control structure must always reflect the semantics of a IF-ELSEIF control structure, which is not ensured if a statement may come between CASE and WHEN.