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

Exception Handling

Former Member
0 Likes
624

Hi all

I need to handle exceptions regarding database operations such as modify, insert update, datatype mismatch etc.

Does a standard exception class exist for it?

if there is no such class, how do i define one of my own?

PS: Points will be rewarded for correct solution.

Thanks & Regards

Ravish

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
571

Hi Ravish,

try exception class CX_SY_OPEN_SQL_DB.

If it does not fit your needs or you need additional functionality create your own class ZCX_SY_OPEN_SQL_DB in SE24 and tick Exception class (I recommend to set the 'with message class'-flag).

If you need additional functionality to CX_SY_OPEN_SQL_DB you make your class inherit from this class.

Hope this helps,

cheers,

Axel

3 REPLIES 3
Read only

gopi_narendra
Active Contributor
0 Likes
571

Check the SY-SUBRC for each statement used for Modify or insert or update or.....

modify <datatable> from table itab.
If Sy-subrc = 0.
write ' Modify Done'.
else.
write ' Modify failed'.
endif.

Regards

Gopi

Read only

Former Member
0 Likes
571

Hi Ravish,

The best and easiest way in ABAP to handle the exception is checking the value of sy-subrc after each DB operation.

Regards,

Atish

Read only

Former Member
0 Likes
572

Hi Ravish,

try exception class CX_SY_OPEN_SQL_DB.

If it does not fit your needs or you need additional functionality create your own class ZCX_SY_OPEN_SQL_DB in SE24 and tick Exception class (I recommend to set the 'with message class'-flag).

If you need additional functionality to CX_SY_OPEN_SQL_DB you make your class inherit from this class.

Hope this helps,

cheers,

Axel