SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
Subroutine Calls Not Allowed in EXEC SQL
In ABAP Objects, the following syntax causes an error message:
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 of the
main program in local
classes and you cannot call them in 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.