Polymorphic classes in workflow?

Breslavets Sergey sergey.breslavets at volvo.com
Fri Jun 29 14:27:22 EDT 2007


Hi Mike, 
I implemented IF_WORKFLOW at a superclass level. That's right - you
cannot redefine FIND_BY_LPOR, but then you don't need to: all this
method has to do is to generate an instance and pass it back. And you're
already have your instance key and an actual class type name in the LPOR
parameter (class name of the actual runtime parameter, not from
definition). All I do in my FIND_BY_LPRO is get an object key from
lpor-instid and call constuctor. Here's the code fragment: 
-------------------------------------------------
...
[get/calculate your subclass object key from LPOR-INSTID]
>>> create object result type (lpor-typeid) exporting ....
...
-------------------------------------------------

And then you can redefine constructors in subclasses or use any other
kind of initialization methods to provide unique instantiation.

Best regards,
Sergey

-----Original Message-----
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Mike Pokraka
Sent: Friday, June 29, 2007 5:48 AM
To: SAP Workflow Users' Group
Subject: RE: Polymorphic classes in workflow?

Hi Sergey,

No prob, thanks for your input! I got the binding to work after kicking
myself for missing the obvious.

I would be very interested to know how you handle inheritance of
IF_WORKFLOW. Do you implement IF_WORKFLOW in the subclass or superclass?
My problem is that static components such as FIND_BY_LPOR cannot be
redefined in subclasses, so it needs to go into subclasses. However I am
finding that I actually need to define it at superclass level, and then
end up with a vicious circle where other static components cannot be
redefined in subclasses.

Been messing about with this for several days now... so close yet so far
:-)

Cheers,
Mike


On Thu, June 28, 2007 7:50 pm, Breslavets Sergey wrote:
> Hi Mike, Alon: sorry wasn't able to reply earlier.
> Your problem might be in a binding. I use abap classes in my w'flows
for
> a while now and polymorphic binding works pretty well for me. I
declare
> a superclass in the task container and then can bind any inherited
> subclasses at a runtime. I did that for an HR Master Data maintenance
> where I had a separate subclass to handle each infotype, all inherited
> from a single superclass - the superclass was declared in a task
> container but a particular infotype subclass was used as a runtime. I
> use CL_SWF_EXP_EXPRESSION class to handle the binding to a task
object.
>
> Regards,
> Serge
>
> -----Original Message-----
> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On
Behalf
> Of Mike Pokraka
> Sent: Wednesday, June 27, 2007 6:31 AM
> To: SAP Workflow Users' Group
> Subject: RE: Polymorphic classes in workflow?
>
> It would work if it worked.
> I can bind a class *from* a task to an element of type NN, but when I
> try
> to bind it *to* a task's object it simply remains empty. It would be
> sortof polymorphic - in a sense, NN could be considered a
> super-supertype.
> We'd still have to control compatibility, but at least we could use
> interfaces internally in our own developments.
>
> However even if it worked, in effect we'd have to use NNs everywhere
and
> I
> don't think complete loss of typing is worth the gain of polymorphic
> behaviour.
>
> Oh and it completely refuses to bind anything to/from sub/supertypes,
> type
> definitions have to match exactly. (Although I'm not too sure that
using
> subtypes will simplify matters in my case).
>
> Cheers,
> Mike
>
> On Wed, June 27, 2007 10:54 am, Alon Raskin wrote:
>> Problem with NN (I haven't used it) as I am not sure I can see how it
>> will allow you to leverage polymorphism? You need to be able to
> declare
>> supertypes (or interfaces) to leverage polymorphism. Mike, have you
>> tried declaring a concrete superclass and using that in your binding?
> I
>> wonder if the problem lies in interfaces only?
>>
>> Alon Raskin
>> e: araskin at 3i-consulting.com
>> p: +1 207 523 3489
>> c: +1 207 409 4983
>> f:  +1 806 403-4983
>>
>> -----Original Message-----
>> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On
> Behalf
>> Of Mike Pokraka
>> Sent: Wednesday, June 27, 2007 4:58 AM
>> To: SAP Workflow Users' Group
>> Subject: RE: Polymorphic classes in workflow?
>>
>> ...doubly frustrating because all the underlying technology allows
it.
>> BTW, if you are going to try using NN on a system >620, could you let
> us
>> know if it works? It doesn't on 620 unless I do programmed bindings
>> which
>> kinda defeats the point of simplification.
>>
>> Although... I think it may be possible to develop some kind of
generic
>> programmed binding to do the job across various object types. But
> right
>> now time is not a close enough friend to embark on such projects.
>>
>> Cheers,
>> Mike
>>
>> On Tue, June 26, 2007 7:04 pm, Alon Raskin wrote:
>>> Seems like an unnecessary work around (but I will take it). If only
>> SAP
>>> allowed proper polymorphic behaviour....
>>>
>>> ________________________________
>>>
>>> From: sap-wug-bounces at mit.edu on behalf of Mike Pokraka
>>> Sent: Tue 6/26/2007 13:35
>>> To: SAP Workflow Users' Group
>>> Subject: RE: Polymorphic classes in workflow?
>>>
>>>
>>>
>>> There there, actually an answer to your problem may be at hand - you
>> can
>>> enable a type NN (Not Defined) as a container element type as of
some
>>> service pack.
>>> This is supposed to work, though I still get no end of
> binding-related
>>> errors. In my case I'm trying to restrict things further than
>> IF_WORKFLOW,
>>> e.g. IF_WF_INVOICE with a number of associated classes for different
>>> purposes.
>>>
>>>
>>> On Tue, June 26, 2007 5:38 pm, Alon Raskin wrote:
>>>> here here.
>>>>
>>>> ________________________________
>>>>
>>>> From: sap-wug-bounces at mit.edu on behalf of Mike Pokraka
>>>> Sent: Tue 6/26/2007 11:21
>>>> To: sap-wug at mit.edu
>>>> Subject: Polymorphic classes in workflow?
>>>>
>>>>
>>>>
>>>> Hi Workflowers,
>>>>
>>>> A very technical question: Has anyone tried to use some sort of
>>>> polymorphism with ABAP classes in workflow?
>>>>
>>>> I am working on 620 at the moment and the trouble is that the WF
>> builder
>>>> doesn't let you specify an interface as a class container element
>> type.
>>>> I
>>>> have even tried to get it to work via inheritance (i.e. binding a
>>>> subtype
>>>> to it's supertype and vice versa) and having spent most of a day on
>> it
>>>> have had no success whatsoever. It seems that the class you define
> is
>>>> the
>>>> class you're stuck with thoughout the WF.
>>>>
>>>> This is rather annoying and negates one of the more useful benefits
>> of
>>>> using classes. Even though I am sitting on a 620 system, I would
> also
>> be
>>>> interested in any experience on NW04/s because it would be handy to
>> know
>>>> how things work and which direction things will go as we also have
>>>> upgrade
>>>> plans around the corner.
>>>>
>>>> Any input appreciated.
>>>> Cheers,
>>>> Mike
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>
>>>
>>> --
>>> Mike Pokraka
>>> Senior Consultant
>>> Workflow Connections
>>> Mobile: +44(0)7786 910855
>>>
>>> _______________________________________________
>>> 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
>>>
>>
>>
>> --
>> Mike Pokraka
>> Senior Consultant
>> Workflow Connections
>> Mobile: +44(0)7786 910855
>>
>> _______________________________________________
>> 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
>>
>
>
> --
> Mike Pokraka
> Senior Consultant
> Workflow Connections
> Mobile: +44(0)7786 910855
>
> _______________________________________________
> 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
>


-- 
Mike Pokraka
Senior Consultant
Workflow Connections
Mobile: +44(0)7786 910855

_______________________________________________
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