Application Development 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: 

What's the difference between class-based exceptions and classic exception?

Former Member
0 Kudos

Hi buddies,

I was learning the new class-based exception handling, a question suddently jumped in my brain:what's the difference between the new concept and the old exception concept EXCEPTIONS

*\ conversion_error = 1

*\ file_open_error = 2

*\ file_read_error = 3

*\ invalid_type = 4

*\ no_batch = 5

*\ unknown_error = 6

*\ invalid_table_width = 7

*\ gui_refuse_filetransfer = 8

*\ customer_error = 9

*\ OTHERS = 10.

?

3 REPLIES 3

rainer_hbenthal
Active Contributor
0 Kudos

In class base exceptions you do not need to capture the return-code at once and after each call, cause sy-subrc might be overriden. Instead you can catch the exception at a central point in the try statement coding the error handling only once.

Former Member
0 Kudos

hi,

Go through this PDF, it will answer all your queries as to why the new class based exception is better.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f86c9290-0201-0010-7a93-dda...

Hope this helps, Do reward.

Former Member
0 Kudos

Classic exceptions are usually mapped to a SY-SUBRC as soon as they occur.

Class based exceptions create an object representing the exception occurred. This object then can have attributes containing further information specifying the exception. (just an example...)