cancel
Showing results for 
Search instead for 
Did you mean: 

SQLScript Exception handling logic doesn't work in AMDP

former_member102219
Participant
0 Kudos

I've got an AMDP class (for Planning Function, namely) with SQLScript method executing some logic. Because an SQL exception may occur there, I declared an exit handler:

METHOD my_hana_procedure BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT
                           OPTIONS READ-ONLY.
.....
DECLARE EXIT HANDLER FOR SQLEXCEPTION begin
      e_msg = select 'ZIP' as msgid,
               'E' as msgty,
               '000' as msgno,
               ::SQL_ERROR_CODE as  msgv1,
               left( ::SQL_ERROR_MESSAGE,50) as  msgv2,
               substr( ::SQL_ERROR_MESSAGE, 51, 50) as  msgv3,
               substr( ::SQL_ERROR_MESSAGE, 101, 50) as  msgv4
               from dummy;
    end;
.....
e_msg = select 'ZIP' as msgid,
               'I' as msgty,
               '000' as msgno,
               'Successful execution' as  msgv1,
               '' as  msgv2,
               '' as  msgv3,
               '' as  msgv4
               from dummy;
  ENDMETHOD.

Then I try to execute my Planning Function from RSPLAN:

1. If I put a breakpoint into this SQLScript based method (in Eclipse), I get to debug, and I see that the exit handler code gets executed (however, _after_ all other code of my_hana_procedure). Then I see an error message in RSPLAN with msgv1-4 populated.

2. If I disable SQLScript debugger in Eclipse, the function is executed and I see "Successful execution" message with green status, i.e. exit handler has not been engaged.

Question: Does it mean that exit handlers don't work in AMDP framework??

sheldon_piao
Advisor
Advisor
0 Kudos

In May, I get one SAP Incident which is quite same as what your issue is. After the connection is built up, I can't replicate the issue anymore. I am not quite sure whether this incident is from you or not. Are you still able to replicate this issue now?

Accepted Solutions (0)

Answers (0)