cancel
Showing results for 
Search instead for 
Did you mean: 

Leave request - Custom Workflow and Custom Class

farooq_basha
Active Participant
0 Kudos

Dear Expert,

My requirement to extended level of approval for different leave types.

So I have copied standard WF WS12300111 and Create custom WF and assigned the same in PTARQ configuration.

To do this even I have copied standard class CL_PT_REQ_WF_ATTRIBS and change in WF container and added my logic in Class.

Now when I trigger WF, Container Value for Req(which is of type ref 'Z'CL_PT_REQ_WF_ATTRIBS) is not getting populated and Workflow is going to error status because of Req.status is not getting value for initial step.

Do we need to pass 'Z'CL_PT_REQ_WF_ATTRIBS also any where to trigger or get populated in Workflow container?

Regards,

Shaik Farooq

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What is actually your requirement?

Are you sure that you need to copy CL_PT_REQ_WF_ATTRIBS to a Z-version? I have implemented quite a few custom workflow for the leave requests, and I never needed to copy the standard class. I just created my own Z-class and implemented the missing fucttionality into that. (=I used the standard class for the standard functionality and my own class for the custom functionality.)

Kind regards,

Karri

farooq_basha
Active Participant
0 Kudos

We have different processes for different Leave Type's.

I have achieved some Leave type's with Custom Workflow and standard class by identifying approval agent with RULE and it is working fine.

But for some Leave Type I have 3 Level and 4 Level Approval. I have tried by copying the standard class but I have stopped as container values is not populating and Workflow is going to error status.

I want to know, how the standard class is getting trigger and data for the container getting populated.

Regards,

Shaik Farooq

Former Member
0 Kudos

You could check the BADIs of the leave request processing. I think there is a method called START_WF or something like that. Perhaps you can do some tricks there.

From my point of view you most likely don't need a copy of the standard class. Just go to IMG, set your new Z-workflow to get started for the leave types that require the multilevel approval. Build your multilevel approval logic to this new workflow. If you need some custom coding, I don't think you need to add it to the standard class (or a copy of it). There are different tricks to achieve the multilevel approval scenario. For example if you need play with the request statuses, you can take a look to CL_PT_REQ_WF_ATTRIBS->APPROVE and see how can statuses be changed, etc. And then you can build the same thing in your own empty Z-class. Just an example.

Regards,

Karri

farooq_basha
Active Participant
0 Kudos

Let me try with standard class by adding  my functionality in custom class.

Thanks for the input

farooq_basha
Active Participant
0 Kudos

Hi,

I have one question, If I define one container element for my custom WF then how can I set the Value.

Because the Workflow is triggering from PT_GEN_REQ -> IF_EX_PT_GEN_REQ~START_WF.

How can Set the Container element?

Regards,

Shaik Farooq

Former Member
0 Kudos

How do you get the value for the container element? Do you have it only at the moment when the workflow is getting started (=as a variable in PT_GEN_REQ -> IF_EX_PT_GEN_REQ~START_WF)? I never needed to use this method, so I am not sure if the thing that you are trying to do it possible. The parameters of the method do not look very promising.

You could always consider to populate the container element value in the workflow itself, if possible. You could for example add an additional background step to the beginning of the workflow to get all the data that you need in the container.

Regards,

Karri

farooq_basha
Active Participant
0 Kudos

Need to follow below step?

Step -> Task -> populate the Container of the Task and Bind to WF container?

Former Member
0 Kudos

I am not sure what your question is?

Just create a container element (in workflow container) that has the data type of the data that you need in the container. Then create a method for your class that exports the data (same data type as above). Create a new task in PFTC that uses your new method. When the task creation asks about if it should create the missing elements, answer yes. Now go back to your workflow, create a new activity step, and put your new task into the step. When it asks about the bindings, let them be as they are (most probably they will be correct automatically). If the bindings seem not to be working, you need to adjust them manually in the step editor (bind the container element of the step/task to the workflow container).

Regards,

Karri

manukapur
Active Participant
0 Kudos

HI Karri,

I need some help with the custom workflow for Leave Request Approval. Trying to execute it using another application. Can't figure out how to fill in the workflow container? Can you help?

Regards,
Manu

felixsaid
Explorer
0 Kudos

I am facing this same problem. I am creating a custom application that should trigger the standard leave workflow and for sure I am not getting how to populate my container with data like absence type, start and end dates. Someone to help.

Answers (0)