Can I not use interfaces as input objects in single tasks? (R/3 4.6C)

Mike Pokraka wug.replies at workflowconnections.com
Mon Aug 29 17:58:08 EDT 2005


Hi Kjetil,
Interesting one... Interfaces are great :) I remember attempting 
something similar: I tried creating a task based on a common supertype 
and binding in subtypes with redefined methods in the different WF's, 
hoping it would execute the subtype's method. Unfortunately polymorphism 
was just a little beyond WF and it whined about object type mismatches 
and stuff.
I think it was 4.6c, but maybe it gives you an idea or maybe it even 
works thanks to some fabulous patches.... (hey, one can always be 
hopeful!).

Plan B: Have an interface method look for an object in the container and 
call its same-named method. (Or redefine a common supertype's 
instance-independent method to do this).
At binding, shove your 'real' object into adhoc objects so you don't 
have to bother with any hardcoding. You'll need to do some coding to 
either look for it in the container based on compatible object types or 
use a naming convention of sorts. Or perhaps to bind the element name as 
a parameter?

Thus bind:
PurchReq -> Adhoc Objects
'PurchReq' -> ElementName

to another object's method/task (supertype, interface or whatever):
METHOD FOO CHANGING CONTAINER
   SWC_GET_ELEMENT container 'ElementName' l_elementname.
   SWC_GET_ELEMENT container l_elementname l_obj.
   SWC_CALL_METHOD l_obj 'FOO' container.

Cheers
Mike

Kjetil Kilhavn wrote:
> I am currently rewriting an existing application where the code is quite 
> dynamic and re-useable. In order to maintain the dynamic nature of the 
> solution I thought I'd create an interface and reference the interface 
> instead of creating all methods in all object types. A nice surprise 
> compared to ABAP Objects was the ability to actually implement a method 
> in the interface, so I didn't have to copy the implementation between 
> all the object types.
>  
> Now I am facing the problem that apparently I can not bind my purchase 
> requisition object to the task I have created for executing my interface 
> method. It seems I will have to create one task for each object type 
> that implements the interface. Needless to say, this is a major bummer 
> after being happy about the ability to implement the method in the 
> interface.
>  
> Has anyone successfully used an interface as the object in a task?
> I've been trying all sorts of things now and am about to give up and 
> create one task per object type, but first I'll give you the weekend to 
> assist me ;-)
> -- 
> Kjetil Kilhavn, Statoil KTJ IT BKS
>  
> 
> -------------------------------------------------------------------
> 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.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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