Exception Handling in ABAP OO and Workflow

Dart, Jocelyn jocelyn.dart at sap.com
Tue Nov 14 19:49:09 EST 2006


Well ... technically because it is an abstract class
 
Functionally ... because just to say its an application error really
doesn't help you to understand what's causing the problem.  So its good
practice to create a more specific exception to give the poor old
workflow system and administrator some small clue as to what is going
on.  Plus by using a specific exception class you can activate that
specfic exception as a handled outcome in your workflow design. 
 

Regards, 
Jocelyn Dart 
Senior Consultant 
SAP Australia Pty Ltd. 
Level 1/168 Walker St. 
North Sydney 
NSW, 2060 
Australia 
T   +61 412 390 267 
M   + 61 412 390 267 
E   jocelyn.dart at sap.com 
http://www.sap.com <http://www.sap.com/>  

The information contained in or attached to this electronic transmission
is confidential and may be legally privileged. It is intended only for
the person or entity to which it is addressed. If you are not the
intended recipient, you are hereby notified that any distribution,
copying, review, retransmission, dissemination or other use of this
electronic transmission or the information contained in it is strictly
prohibited. If you have received this electronic transmission in error,
please immediately contact the sender to arrange for the return of the
original documents. 

Electronic transmission cannot be guaranteed to be secure and
accordingly, the sender does not accept liability for any such data
corruption, interception, unauthorized amendment, viruses, delays or the
consequences thereof.

Any views expressed in this electronic transmission are those of the
individual sender, except where the message states otherwise and the
sender is authorized to state them to be the views of SAP AG or any of
its subsidiaries. SAP AG, its subsidiaries, and their directors,
officers and employees make no representation nor accept any liability
for the accuracy or completeness of the views or information contained
herein. Please be aware that the furnishing of any pricing information/
business proposal herein is indicative only, is subject to change and
shall not be construed as an offer or as constituting a binding
agreement on the part of SAP AG or any of its subsidiaries to enter into
any relationship, unless otherwise expressly stated. 

 

________________________________

From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Alon Raskin
Sent: Wednesday, 15 November 2006 7:41 AM
To: SAP Workflow Users' Group
Subject: RE: Exception Handling in ABAP OO and Workflow


Mike,
 
You are right. While I was waiting for someone to respond I tried
creating my own sub-type of cx_bo_application and that fixed the
problem.
 
My issue with this, is academic. Why do I have to create a subtype to
use this? I have not reason to 'enhance' the SAP delivered class so why
create a sub-type? Particularly when you don't have to do this for the
other exception classes ( CX_BO_TEMPORARY, CX_BO_ACTION_CANCELLED,
etc)....
 
Appreciate the response regardless.
 
Alon


________________________________

From: sap-wug-bounces at mit.edu on behalf of Mike Pokraka
Sent: Tue 11/14/2006 11:52
To: SAP Workflow Users' Group
Subject: Re: Exception Handling in ABAP OO and Workflow



Hi Alon,

It does what it says on the tin, cx_bo_application is abstract and
should
not be used other than perhaps to catch subclasses.

Use any of the existing subclasses or define your own. cx_bo_error for
errors and cx_bo_temporary for .. er, temporary errors, and cx_bo_abort
for system errors. You can even create your own subclasses from the
above
and it will behave according to it's subcleass (i.e. temporary error
etc.). Exception classes excellent and so much more useful.

Cheers,
Mike


On Tue, November 14, 2006 16:05, Alon Raskin wrote:
> So I finally took the plunge and created my first ABAP OO Workflow.
>
> I implemented a class which inherits from IF_WORKFLOW, BI_PERSISTENT
and
> BI_OBJECT.
>
> Everything was going well till I tried to raise an exception from my
> method using the standard exception classes. Here is an excerpt from
my
> code...
>
> ...
>       IF sy-subrc <> 0.
>       RAISE EXCEPTION type cx_bo_application.
>     ENDIF.
> ...
>
> When I compile I get the error saying that You cannot generate
instances
> of the abstract class 'cx_bo_application'. I can see that the
> instantiation scope is marked as abstract but surely I don't have
define a
> concrete child class of cx_bo_application for every exception that I
want
> to raise? Or do I just need to do one per workflow (seems redundant).
>
> Oh and I went to the method definition and checked the exception
classes
> checkbox (in the class builder) and pasted in cx_bo_application. It
seemed
> happy with that but it didn't make my syntax error go away.
>
> Perhaps I am using the wrong syntax in the method ? I checked OSS...
> nothing. I checked SDN... nothing.
>
> I am using ECC 6.0 with SAP_BASIS and SAP_ABA release 7.00
>
> I will keep trying other things but I welcome your comments.
>
> Alon
>
>
> Your comments are welcome.
>
>
>
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
>


_______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu
http://mailman.mit.edu/mailman/listinfo/sap-wug


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20061115/1b2ac557/attachment.htm


More information about the SAP-WUG mailing list