cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Instantiation of a Class in Workflow

Former Member
0 Kudos

I created a subclass of CL_HRASR00_WF_PROCESS_OBJECT to include some of my custom methods to be used in the workflow. Since the subclass methods cant be referred using the super class name(as we do in BO) in the standard task , i used a custom method to create the instance of the subclass using the following code and then using the subclass instance i tried to call my subclass method, but the issue what i am facing is the subclass instance is not getting created using the following code(may be i am missing something) instead the superclass instance is returned by the method containing the below code an in the next step(in workflow) when it tries to call the subclass method I am getting an error that : "Method not found":'CL.CL_HRASR00_WF_PROCESS_OBJECT.GET_INIT_EMAIL'. Please advice what is that I am missing.

TRY.

CREATE OBJECT processinst

EXPORTING

guid = guid.

CATCH cx_bo_error .

ENDTRY.

where processinst is of type ZCL_HRASR00_WF_PROCESS_OBJECT.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Yes, check the workflow interface methods (the LPOR ones). You are probably still returning from those interface methods the super class instance (the workflow uses these methods to instantiate the object). It isn't that straighforward to start using subclass instad of the superclass in workflow.

Regards,

Karri

Former Member
0 Kudos

Hi Karri,

You are right. I think the system is using the interface methods FIND_BY_LPOR to create an instance of the super class as this method directly gets added when we mention the super class in the properties.I think we can't re-define this methods. Is there any other solution for this.

For your other solution: i can't do that because we are using standard event completed of the super class CL_HRASR00_WF_PROCESS_OBJECT.

Former Member
0 Kudos

Well, what about if you just forget the whole sub-classing? Just build your own class that is not a subclass of anything). It does need only the minimum: the constuctor and the LPOR-methods and of course your own custom logic/methods. This way you can still use the functionalitites of the super-class but can also use your own custom logic offered by your own class. You don't even need to implement the LPOR-methods, if you use only static methods (for example some kind of "get email address" method could be static).

Of course this will not work, if you have a specific reason for using subclass, but I doubt you have. Trying to emulate the BO super/subclass delegation functionality is not good enough reason. It is totally ok to build your own class that has nothing to do with the actual standard class. It all depends on the requirements and what makes the most sense.

Regards,

Karri

Answers (1)

Answers (1)

narin_nandivada3
Active Contributor
0 Kudos

HI,

I think WF Instance is not created... Try Checking the articles how to create a instance by implementing IF_WORKFLOW interface.

So check that...


 "Method not found"

With the refrence value that had got in WF container during runtime it was unable to find the method. ie., I think Ref not created successfully.

Regards

Narin