ABAP Objects vs. BOR to trigger event? (Thanks Mike(s) - 1 last question per your response)

Mike Pokraka wug at workflowconnections.com
Fri Feb 11 11:40:44 EST 2011


Hi Rick,

Yes, this should work. You will need to supply the instance data back to
WF in the LPOR method so you need to do some work in the CONSTRUCTOR to
store your instance data.

Not sure if I mentioned it already, but consider getting a copy of The
Book (version 2). It has a whole section on OO in WF with lots of code
samples. By all means do continue to ask questions, but the book will save
time as you don't need to wait for answers.

Cheers,
Mike


On Fri, February 11, 2011 4:23 pm, Sample, Rick wrote:
> Mike,
>
> I have a simple WF with one task. I have the ABAP OO class coded. (based
> on ZCL_PLANT demo by Jocelyn)
>
> Test WF (SWUS) with setting the ABAP OO key, works fine. I have an
> instance and can call any method with Task.
>
> Test WF (SWUS) without setting the ABAP OO key, lpor-instid is not set
> (obviously) and
> fails in FIND_BY_LPOR, so I have no instance at this point. This is where
> I created a BG task to create/set the WF instance.
> BG task with Static method called CREATEINSTANCE:
>   TRY.
>       CREATE OBJECT ex_instance
>         EXPORTING
>           im_salesdocument = im_salesdocument.
>     CATCH cx_bo_error.
>       EXIT.
>   ENDTRY.
>
> This what you were suggesting? Sorry, a little dense. The OO learning
> curve thing...
>
> Thanks for your time.
> Rick
>
>
>
>> -----Original Message-----
>> From: sap-wug-bounces at mit.edu
>> [mailto:sap-wug-bounces at mit.edu] On
>> Behalf Of Mike Pokraka
>> Sent: Friday, February 11, 2011 4:41 AM
>> To: SAP Workflow Users' Group
>> Subject: RE: ABAP Objects vs. BOR to
>> trigger event?
>>
>> Yes. Good OO practice is to make the
>> instantiation private so this and
>> FIND_BY_LPOR are the only ways to
>> instantiate the class.
>>
>> What I have done is also a
>> GET_BOR_INSTANCE instance method,
>> just so I can populate the WF container
>> with the BOR instance for GOS purposes.
>>
>> In general, my approach for working with
>> existing functionality is to leave existing
>> stuff as is, but whenever I need to make a
>> modification to a BOR component I port it
>> over to the corresponding class. I try to be
>> as proactive as time permits, so it's more
>> of a jugement call than anything else.
>>
>> The GOS part is mainly a problem
>> because the BOR object types are often
>> hardcoded. I did have some ideas about
>> enhancing GOS to automatically map
>> BOR types to corresponding classes so it
>> would pick up pure OO WFs, but never
>> had the time/opportunity/need to
>> implement it. Unless you have serious
>> volumes it's a disproportionately large
>> effort for circumventing something as
>> simple as having an additional container
>> element sitting there doing very little.
>>
>> Cheers,
>> Mike
>>
>>
>> On Wed, February 9, 2011 8:23 pm,
>> Sample, Rick wrote:
>> > Hi Mike,
>> >
>> > When you were referring to
>> GET_INSTANCE, you are saying it is just
>> a
>> > method of the class with something like
>> this? This is what I have for
>> > CreateInstance. Standard naming to call
>> it GET_INSTANCE like my usage?
>> >
>> >   TRY.
>> >       CREATE OBJECT ex_instance
>> >         EXPORTING
>> >           im_salesdocument =
>> im_salesdocument.
>> >     CATCH cx_bo_error.
>> >       EXIT.
>> >   ENDTRY.
>> >
>> > scratching the surface, but making some
>> headway!
>> >
>> >
>> >
>> >> -----Original Message-----
>> >> From: sap-wug-bounces at mit.edu
>> >> [mailto:sap-wug-bounces at mit.edu] On
>> >> Behalf Of Mike Pokraka
>> >> Sent: Wednesday, February 09, 2011
>> >> 11:27 AM
>> >> To: SAP Workflow Users' Group
>> >> Subject: RE: ABAP Objects vs. BOR to
>> >> trigger event?
>> >>
>> >> Hi Rick,
>> >>
>> >> Yes it is unfortunately necessary to
>> have both in most cases.
>> >> Sometimes I just have the BOR in the
>> WF container purely so the
>> >> workflow is visible from GOS. There
>> are ways around that too but some
>> >> things aren't always worth the effort.
>> >>
>> >> A couple of ways around the
>> instantiation:
>> >> 1.  An event replicator. The BOR event
>> receiver in SWETYPV is a
>> >> method that looks at the BOR event
>> and raises the clas event which
>> >> starts the workflow. Not suitable for
>> high-volume processes.
>> >> 2. First prize is always to raise a class
>> event in first place. If
>> >> using change docs or the likes you're
>> all set.
>> >> 3. Create class instance in WF. This is
>> what you have done, but far
>> >> less performance overhead is via a
>> static GET_INSTANCE functional
>> >> method on the
>> >> class: this can then be called in a
>> >> conatiner operation step or even in a
>> binding of the first step that
>> >> needs it.
>> >>
>> >> This is all explained in the second
>> edition of the WF book. Author's
>> >> prceeds go to charity so this is not
>> advertising :-)
>> >>
>> >> Cheers,
>> >> Mike
>> >>
>> >>
>> >> On Wed, February 9, 2011 4:39 pm,
>> >> Sample, Rick wrote:
>> >> > Note: I added a hack. I catch the
>> BOR
>> >> Created event, then in
>> >> > background task, call a
>> >> CREATE_INSTANCE method to
>> populate
>> >> the ABAP
>> >> > objects instance, but this seems a
>> little
>> >> bit of a kludge way to do it.
>> >> >
>> >> >
>> >> >
>> >> >> -----Original Message-----
>> >> >
>> >> >> From: sap-wug-bounces at mit.edu
>> >> >
>> >> >> [mailto:sap-wug-bounces at mit.edu]
>> On
>> >> >
>> >> >> Behalf Of Sample, Rick
>> >> >
>> >> >> Sent: Wednesday, February 09,
>> 2011
>> >> >
>> >> >> 10:14 AM
>> >> >
>> >> >> To: SAP Workflow Users' Group
>> >> >
>> >> >> Subject: ABAP Objects vs BOR to
>> >> trigger
>> >> >
>> >> >> event?
>> >> >
>> >> >>
>> >> >
>> >> >> Hi all,
>> >> >
>> >> >>
>> >> >
>> >> >> I am playing around with a WF
>> using
>> >> >
>> >> >> ABAP Objects. I built the object, wf,
>> >> some
>> >> >
>> >> >> tasks, and all seems to be going
>> fine.
>> >> >
>> >> >>
>> >> >
>> >> >> The WF will be based on Sales
>> >> >
>> >> >> (BUS2032). I will obviously need to
>> run
>> >> >
>> >> >> both BOR and ABAP objects to
>> trigger
>> >> the
>> >> >
>> >> >> CREATE, CHANGED, etc. events.
>> >> When
>> >> >
>> >> >> BUS2032.CREATE triggers, how to
>> I
>> >> also
>> >> >
>> >> >> trigger ABAP Objects?
>> >> >
>> >> >>
>> >> >
>> >> >> What is the "Best practices" to run
>> side
>> >> by
>> >> >
>> >> >> side? I have several PDFs, but do
>> not
>> >> see
>> >> >
>> >> >> this addressed.
>> >> >
>> >> >>
>> >> >
>> >> >> Thanks,
>> >> >
>> >> >> Rick
>> >> >
>> >> >>
>> >> >
>> >> >>
>> >>
>> __________________________________
>> >> >
>> >> >> _____________
>> >> >
>> >> >> 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
>





More information about the SAP-WUG mailing list