Workflow Classes & Subclasses (Error..)
Im having problems using subclasses on workflows, if you experts know the answer ill appreciate
ill try to be simple and straight forward:
I have a Main class ZWKF_EMPLOYEE and a subclass ZWKF_EMPLOYEE_SINDICALES_ES.
- Main and key attribute is the PERNR and a BEGDA of a Employee
I have a method a in the subclass that i want to access from the workflow, but the workflow cant access it, cause only accesses the main class methods.
I understand the problem, but cant find a proper solution, is it possible that SAP Workflows (interface IF_WORKFLOW) dont support classes inherance.. ?
- Step 1 Create employee instance from subclass (ZWKF_EMPLOYEE_SINDICALES_ES)
- Step 2 Send notification from subclass (ZWKF_EMPLOYEE_SINDICALES_ES)
Step 1: ( The classes used on the bindings is allways the subclass)
Step 2: ( The classes used on the bindings is allways the subclass)
My problem is the FIND_BY_LPOR method, its static and cant be re-defined by the subclass, meaning it allways returns the Main class and the workflow while in runtime, doesnt detect the method on the subclass.
Error on workflow:
FIND_BY_LPOR Method sample:
Mike Pokraka replied
The problem has nothing to do with WF not supporting subclasses. In fact, Workflow will quite happily handle polymorphism - you could for example define your WF container element as the supertype and use the subtype in your task.
This is standard ABAP Objects, statics cannot be redefined. The mistake here is instantiating a fixed object type in your FIND_BY_LPOR. What you want to do is:
CREATE OBJECT employee TYPE (lpor-typeid) EXPORTING ...
There's a whole chapter on classes in the book as well.