How to call enhanced class method in Workflow task?

Mike Pokraka wug at workflowconnections.com
Mon Aug 16 12:20:59 EDT 2010


Hello Savitha,

You are correct that methods added using the enhancement concept are not
visible. This is a bug and if you have the time I'd suggest reporting it
to SAP.
Although both ideas you suggest would work, I would not suggest either.
1) Copying a class will create a divergence between yours and future
changes from SAP. Bad.
2) Enhancing currently doesn't work (as you noticed). I think SAP know
about this, but it's worth raising a note anyway.

What I would do instead is one of
3) Create a subclass and use that in your WF. The superclass methods will
work just fine. Note that many SAP classes are defined as final and you
may need to do a repair to un-final the class (I did not just suggest
this...)
4) Create a wrapper class with your own functionality. If you need to get
at private data/methods from teh SAP class then an enhancement will work
in this case. A minor annoyance is that you may need two objects in your
WF, but depending on the design you could get away with just using your
wrapper class and exposing the SAP class as an attribute (e.g. for binding
to the original class's tasks).

Both 3 and 4 will do the job, personally I lean towards 4) because it
provides better isolation between own and SAP functionality while still
keeping them together and reusable.

Cheers,
Mike


On Mon, August 16, 2010 2:51 pm, Savitha M wrote:
> Hi All,
>
> I have enhanced a global class from SAP by adding a new method. I would
> like
> to call it from a workflow task, but it is not visible. Seems to be only
> native methods created within the class are visible to be selected. I
> searched in SDN forums, but I could not get an answer.
>
> Also what is the best way to enhance standard workflow(which is using
> classes) with custom functionality
> 1) Copy the standard class into new Z class and use this Z class after
> implementing new methods.
>                                     OR
> 2) Enhance the SAP standard class with new methods .
>
> Is delegation concept possible with classes?
>
> Could you please guide me.
>
> Thanks & Regards,
> Savitha
> _______________________________________________
> 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