Exception Handling in ABAP OO and Workflow

Kjetil Kilhavn KJETILK at statoil.com
Thu Nov 16 03:41:12 EST 2006


Although I am familiar with the concept of abstract classes (I use them myself in OO ABAP) I have not yet created a CL-based workflow, so one of the previous summaries is still here in my SAPWUG folder. It will _not_ be deleted.

So thanks all of you for a discussion well worth following even for someone who didn't have anything to contribute.

PS: I just created my first try-catch block and exception classes the other day after attending the session on creating "Bullet-Proof Software" at TechEd. Along with Alan's session on using forms where I learnt about guided procedures and more, these two hands-on sessions alone provided enough "bang for the buck" to justify a trip to Amsterdam - even if I never found time to go have a "coffee".
-- 
Kjetil Kilhavn, Statoil ØFT KTJ BAS DEV SAP

 

> -----Original Message-----
> From: sap-wug-bounces at mit.edu 
> [mailto:sap-wug-bounces at mit.edu] On Behalf Of Mike Pokraka
> Sent: Wednesday, November 15, 2006 7:04 PM
> To: SAP Workflow Users' Group
> Subject: RE: Exception Handling in ABAP OO and Workflow
> 
> :-)
> All is not lost, at least it will hopefully have led to else 
> benefiting from a nice detailed description of what 
> 'abstract' means in an OO concept...
> 
> 
> On Wed, November 15, 2006 17:34, Alon Raskin wrote:
> > My life would be much simpler if I actually read what 
> people wrote to me.
> >
> > That's perfect. Thank you Mike.
> >
> > Regards,
> >
> > Alon Raskin
> > e: araskin at 3i-consulting.com <mailto:araskin at 3i-consulting.com>
> > p: +1 207 523 3489
> > c: +1 207 409 4983
> > f:  +1 806 403 4983
> >
> >
> >
> > ________________________________
> >
> > From: sap-wug-bounces at mit.edu on behalf of Mike Pokraka
> > Sent: Wed 11/15/2006 11:25
> > To: SAP Workflow Users' Group
> > Subject: RE: Exception Handling in ABAP OO and Workflow
> >
> >
> >
> > Huh, so what I suggested was to use cx_bo_error, which is a 
> subclass 
> > of cx_bo_application. Therefore no need to create a subtype.
> > Along with cx_bo_temporary, these are the two I use all the 
> time, or 
> > create subclasses from them if I need something more specific.
> >
> > Cheers,
> > Mike
> >
> > On Wed, November 15, 2006 15:11, Alon Raskin wrote:
> >> Ummm. I am creating a custom method and want to raise an 
> application 
> >> exception using cx_bo_application . I cant use that class 
> (I have to 
> >> create a sub-type) and I don't really have any reason to create a 
> >> sub-class (except for Jocelyn's comments about modelling 
> outcomes) as 
> >> I have no requirement to further enhance the SAP delivered class.
> >>
> >> However, what Jocelyn said makes sense. If all methods 
> used the same 
> >> class there would be no real way to model the exceptions 
> as outcomes.
> >>
> >> Regards,
> >>
> >> Alon Raskin
> >> e: araskin at 3i-consulting.com <mailto:araskin at 3i-consulting.com>
> >> p: +1 207 523 3489
> >> c: +1 207 409 4983
> >> f:  +1 806 403 4983
> >>
> >> ________________________________
> >>
> >> From: sap-wug-bounces at mit.edu on behalf of Mike Pokraka
> >> Sent: Wed 11/15/2006 09:39
> >> To: SAP Workflow Users' Group
> >> Subject: RE: Exception Handling in ABAP OO and Workflow
> >>
> >>
> >>
> >> Sorry, misunderstood - sounded like you were confused about the 
> >> abstract thing.
> >> Still, you're not forced to create any subclass. Just use 
> SAP's ones, 
> >> or am I the one missing the problem?
> >> Cheers,
> >> Mike
> >>
> >> On Wed, November 15, 2006 13:12, Alon Raskin wrote:
> >>> Jocelyn and Mike. Thanks for the reply. I understand why and how 
> >>> abstract classes are used (I have been doing OO in other 
> languages 
> >>> for quite some time now).
> >>>
> >>> Anyway, your explanation of modelling outcomes in the Workflows 
> >>> based on the different class types makes perfect sense and I now 
> >>> understand why SAP have 'forced' us to create a child class.
> >>>
> >>> Appreciate the response.
> >>>
> >>> Alon
> >>>
> >>> ________________________________
> >>>
> >>> From: sap-wug-bounces at mit.edu on behalf of Mike Pokraka
> >>> Sent: Wed 11/15/2006 05:06
> >>> To: SAP Workflow Users' Group
> >>> Subject: RE: Exception Handling in ABAP OO and Workflow
> >>>
> >>>
> >>>
> >>> 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
> >>>>
> >>>
> >>>
> >>> _______________________________________________
> >>> 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
> >>
> >>
> >> _______________________________________________
> >> 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
> >
> 
> 
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
> 


-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you.




More information about the SAP-WUG mailing list