Ansicht
Dokumentation

ABENOO_OBS_EXEC_SQL_2 - OO OBS EXEC SQL 2

ABENOO_OBS_EXEC_SQL_2 - OO OBS EXEC SQL 2

rdisp/max_wprun_time - Maximum work process run time   General Material Data  
This documentation is copyright by SAP AG.
SAP E-Book

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, 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.






rdisp/max_wprun_time - Maximum work process run time   General Material Data  
This documentation is copyright by SAP AG.

Length: 2010 Date: 20240425 Time: 132110     sap01-206 ( 36 ms )