Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Handling non-catchable exceptions

Former Member
0 Likes
698

Hi!

I would like to know how can I handle an exception, which is not catchable?

Now I'm developing an ABAP, which contains Native SQL commands with the "EXEC SQL" command. In the help of this command there are several non-catchable exceptions, for example: EXSQL_DSQL_DUPLICATE_CURSOR

This exception occurs for me very often, and because it is not catchable by the TRY...CATCH...ENDTRY command, I would like to handle it with an other solution.

In most common the program works with this sequence:

EXEC SQL.

OPEN CURSOR C FOR... (SELECT command)

ENDEXEC.

EXEC SQL.

FETCH ...

ENDEXEC.

EXEC SQL.

CLOSE CURSOR C.

ENDEXEC.

There are some cases, after the CLOSE CURSOR C, the cursor remains still open, and I get a short dump on the next run with the EXSQL_DSQL_DUPLICATE_CURSOR.

Is there a way to query the state of the cursor C?

Thank you in advance

Tamá

1 ACCEPTED SOLUTION
Read only

michael-john_turner
Active Participant
0 Likes
501

This isn't answering your question directly, but perhaps investigate the CL_SQL* classes instead of using raw Native SQL. They wrap Native SQL in a nice set of classes and I'm pretty sure they raise class based exceptions that you can catch.

MJ

1 REPLY 1
Read only

michael-john_turner
Active Participant
0 Likes
502

This isn't answering your question directly, but perhaps investigate the CL_SQL* classes instead of using raw Native SQL. They wrap Native SQL in a nice set of classes and I'm pretty sure they raise class based exceptions that you can catch.

MJ