Exception Classes

For all you C++, Java and .NET developers, the concept of exception classes, which is relatively new in ABAP, will be easy to understand.

Exception classes are, as their name imply, classes that define exceptions.
Exception classes are created in a manner similar to creating regular ABAP classes. You can create exception classes in SE80, but you choose “Exception class” as the class type.

Java developers are probably familiar with the concept of checked exceptions and unchecked exceptions. ABAP has this concept as well. As the ABAP documentation explains:

• “If exceptions defined via subclasses of CX_STATIC_CHECK are propagated from a procedure, they must be explicitly declared in the interface of the procedure. The syntax check makes a static check of whether all exceptions triggered in the procedure with RAISE EXCEPTION or declared in the interfaces of the calling procedures are either handled with CATCH or explicitly declared in the interface and issues a warning if this is not the case.”

• “If exceptions defined via subclasses of CX_DYNAMIC_CHECK are propagated from a procedure, they must be explicitly declared in the interface of the procedure. However, this is not checked statically by the syntax check; instead, it is checked dynamically at the point in time when such an exception is propagated from a procedure.”

• “Exceptions that are defined via subclasses of CX_NO_CHECK may not be explicitly declared in the interface of the procedure. The CX_NO_CHECK class and its subclasses are always implicitly declared and are always propagated, whereby resumability is retained if it exists.”

You can therefore see the first type is like checked exceptions, the second and third types have some similarities to unchecked exceptions.

You can find more about ABAP Exception Categories here. You can find more about ABAP exceptions in general here.

SAP SDN also has a good article explaining the difference between the old exception using method and the new one. You can access it here, but you need to have an SDN account in order to read it.

5 comments:

itdocs July 29, 2009 at 1:19 AM  

It was not easy to comment on your site, as your comment links are broken, they do not work..
Congratulations for your break into ABAP. I would love to deliver your updates to more visitors.
If you dun mind I will add your site to my directory at http://social.sapdocs.info
Best~

Yours Truly July 29, 2009 at 9:20 AM  

Hi Eddai,

Thank you pointing out the commenting issue, it's hopefully fixed now.
I would be honored to have my site in your directory. I shall also put a link to your directory from the site.

Eddai July 29, 2009 at 12:54 PM  

You are welcome,
Added your site under http://social.sapdocs.info/abap/

Feel free to add your updates to my SAP Community News bar which you can see it in action at http://sapdocs.info/category/sap/

for this, registration is required.
mail me please if you want to do so.
wish u my best for your blog

viswa April 12, 2015 at 11:50 PM  

Excellent Article,I like Your Post and very informative,very Inseparable,keep sharing us.

peterjohn September 10, 2015 at 7:39 AM  

I appreciate you sharing this article. Really thank you! Much obliged.
This is one awesome blog article. Much thanks again.

sap online training
software online training
sap sd online training
hadoop online training
sap-crm-online-training

About This Blog

This blog contains tips, tricks, tutorial, and some of my personal experiences with the SAP ABAP language.

FEEDJIT Live Traffic Feed

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP