Subroutine Calls Not Allowed in EXEC SQL

Using the PERFORMING addition in the EXEC SQL statement to use a subroutine to process data line by line that you have read using Native SQL is not allowed in ABAP Objects. The EXIT FROM SQL statement, previously used within such subroutines, is also forbidden.

In ABAP Objects, an error message occurs on:

EXEC SQL PERFORMING form.
  select ... into :wa from dbtab where ...
ENDEXEC.

FORM form.
  ...
  EXIT FROM SQL.
  ...
ENDFORM.

Correct syntax:

EXEC SQL.
  open c1 for
  select ... from dbtab where ...
ENDEXEC.

DO.
  EXEC SQL.
    fetch next c1 into :wa
  ENDEXEC.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
  ...
ENDDO.

EXEC SQL.
  close c1
ENDEXEC.

Reason:

You should not call subroutines from local classes, and cannot call them from global classes. The called subroutine has no interface, working instead with the global data of the main program. The EXIT FROM SQL statement ends the SQL processing without reference to the actual SQL statement.

Overview:

Replacement for Obsolete Statements ABAP Objects