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

ABAP debugging, catch exception

former_member216578
Participant
0 Likes
3,980

Hello, experts!

Is there any way for catching exception from "insert <tabname> from table itab" during debugging, if there's no any exception handling in code? I want to know what is the error text to analyze it in more detail. I can't modify a program, because it has been generated automatically (it is a data loading program for BW extractor), so I need any case to insert error handling or get the error message while debug before program exit.

Any suggestions would be appreciated.

Thanks,

Andrew.

4 REPLIES 4
Read only

Former Member
0 Likes
1,516

hi andrew,

There is a catchable exception which you can try

TRY.

     insert <tabname> from table itab

    CATCH CX_SY_ITAB_DUPLICATE_KEY.

ENDTRY.

There are also non-catchable exceptions which you can refer at

ABAP Keyword Documentation

Read only

0 Likes
1,516

Hi, Abdul.

Thanks for your reply, but I cannot modify the code, it was generated "on the fly", as I can see, and provided by SAP's functionality.

Read only

former_member216578
Participant
0 Likes
1,516

I didn't mention that insert updates a database table, not internal table, and also it has addition: INSERT <DB table> FROM TABLE itab ACCEPTING DUPLICATE KEYS.

Read only

0 Likes
1,516

hi andrew,

in case if any rows are not inserted then sy-subrc has value 4.

also if sy-dbcnt has less number of records than total then you can come to know that some records are missed.

but I think with this command it is not possible to rollback in case of any error