Skip to Content
0
Former Member
Sep 14, 2007 at 07:55 AM

Exception SQL not catched

333 Views

Hi all, I am accessing to a external system in order to get some information.

TRY.

EXEC SQL.

OPEN C1 for

SELECT

GU010210,

GU010250

from GU01TB01

where GU010030 = :pi_pernr

ENDEXEC.

DO.

EXEC SQL.

FETCH NEXT C1 into :lw_contacto

ENDEXEC.

IF sy-subrc EQ 0.

po_extension = lw_contacto-extension.

po_email = lw_contacto-email.

CLEAR lw_contacto.

ENDIF.

EXIT.

ENDDO.

  • Treat errors

CATCH cx_root INTO exc_ref.

CLEAR: po_extension,

po_email.

ENDTRY.

  • Close connection

TRY.

EXEC SQL.

CLOSE C1

ENDEXEC.

CATCH cx_root INTO exc_ref.

CLEAR: po_extension,

po_email.

ENDTRY.

If I try to get information of a employee that does not exist in the external system, I am getting the exception:

EXSQL_DSQL_CURSOR_NOT_FOUND

The cursor "C1" is unknown.

Can someone know how can I resolve this please? I was thinking that cx_root was the exceptions root.

Thanks in advance!