Exception Handling in ABAP OO and Workflow

Mike Pokraka asap at workflowconnections.com
Wed Nov 15 05:06:49 EST 2006


Hi Alon,

On a slightly different note to Jocelyn's very sensible answer, the
cx_bo_application is very rightfully an abstract class, because it
represents the comcept of a BO error and includes the common functionality
for all of them.

Think of it as cx_bo_application being the exception in a BOR sense, but
you need to select one of the radio buttons (subclasses in this case) in
the exception dialog box to tell WF how to respond. cx_bo_error and
cx_bo_temporary are it's subclasses which you can use straight away (and
you should create subtypes of these rather than cx_bo_application).

Another BO example might be the VBAK object (Sales Order) which nobody
really uses, instead we use one of it's subtypes Sales Order (BUS2032)
Returns (BUS20toolazytolookitup), Credit Memo Request.
Abstract means "Dont use this, use it's subclasses".

Hope that makes sense. So much for academic questions :)
Cheers,
Mike

On Tue, November 14, 2006 20:40, Alon Raskin wrote:
> 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
>
>
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
>





More information about the SAP-WUG mailing list