trying to use subclass in workflow, but superclass is instantiated

Florin Wach florin.wach at gmx.net
Wed Jun 6 10:14:03 EDT 2012


Hi Paul,

you need to have the same constructor's signature on both classes and then you have to use ... in find_by_lpor:


      CREATE OBJECT lo_instance_object TYPE (lpor-typeID)
                    EXPORTING
                       iv_instID = lpor-instID.

      result ?= lo_instance_object.


And you need to redefine the instance method LPOR to return your new subclass' name, so the workflow instantiates the subclass the next time, too.


Have fun, take care,
   Florin


-------- Original-Nachricht --------
> Datum: Wed, 6 Jun 2012 11:17:49 +1000
> Von: Paul.Bakker at osr.qld.gov.au
> An: sap-wug at mit.edu
> Betreff: trying to use subclass in workflow, but superclass is instantiated

> 
> Hello WUG OO experts,
> 
> As time goes on, I'm gradually switching my new workflow developments to
> OO, just to see what the benefits are.
> 
> Anyway, I have just run into a strange problem. I have defined a
> superclass
> ZCl_CLASS and a subclass ZCL_SUB_CLASS.
> 
> The subclass inherits all the methods of the superclass, and you can
> redefine them, which is good. However I've noticed that you can't redefine
> the critical method BI_PERSISTENT~FIND_BY_LPOR, because it is a 'static'
> method.
> 
> This causes a big problem when I start a workflow containing a
> ZCL_SUB_CLASS object, because I've found that FIND_BY_LPOR instantiates an
> object of type ZCL_CLASS in the container!
> 
> The workflow therefore runs into an error when it tries to execute
> ZCL_SUB_CLASS->MY_SUBCLASS_METHOD... it reports that the method does not
> exist.
> 
> I must be doing something wrong.. but what is it?
> 
> merci,
> 
> Paul Bakker
> 
> 
> *********************************************************************************************
> Only an individual or entity who is intended to be a recipient of this
> e-mail may access or use the information contained in this e-mail or any of
> its attachments.  Opinions contained in this e-mail or any of its attachments
> do not necessarily reflect the opinions of Queensland Treasury.
> 
> The contents of this e-mail and any attachments are confidential and may
> be legally privileged and the subject of copyright.  If you have received
> this e-mail in error, please notify Queensland Treasury immediately and erase
> all copies of the e-mail and the attachments.  Queensland Treasury uses
> virus scanning software.  However, it is not liable for viruses present in
> this e-mail or in any attachment.  
> ***************************************************************************************************
> 
> _______________________________________________
> 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