cancel
Showing results for 
Search instead for 
Did you mean: 

Two Level Leave Request workflow

Former Member
0 Kudos

Dear Experts,

I am working on the Two Level Leave Request Workflow.

I copied the standard workflow WS21500001 and added two background activity steps.

Activirty1. Change the Status to SENT. This Is working fine.

Activity2. Get the Next Approver Details.

For this i have created the custom class by coping the standard class CL_PT_REQ_WF_ATTRIBS.

In the custom class i have added the method 'Next_approver'. Importing parameter as REQUEST_ID.

In the Method I have written the below mentioned code.

DATA: lcl_request type ref to if_pt_req_request.

*--Enqueue the request
call function'ENQUEUE_EPTREQ'
exporting
mode_ptreq_header = 'S'
mandt = sy-mandt
request_id = Request_id
exceptions
foreign_lock = 1
system_failure = 2
others = 3.

*-- Get the request object instance
call method cl_pt_req_badi=>get_request
exporting
im_req_id = Request_ID
importing
ex_request = lcl_request.

call method lcl_request->set_next_processor
exporting
im_actor_type = 'P'
im_plvar = '01'
im_otype = 'P'
im_objid = N_PROCESSOR. " PERNR of Next Approver
if sy-subrc = 0.
commit work and wait.
endif.

*-- Dequeue the request
call function'DEQUEUE_EPTREQ'
exporting
mode_ptreq_header = 'S'
request_id = Request_id.

In the task 'Get Next Approver' I assigned the custom class and assigned the method 'Next_approver'.

Below I provide my binding.

&YCL_PT_REQ_WF_ATTRIBS_HANOI& = &_WI_OBJECT_ID&
&REQ.REQ_ID& = &REQUEST_ID&

After doing this i executed the workflow.

After first level approver Approves the workflow the the workflow is going to the Error.

The Error happened in the Get Next Approver Method.

Please validate whether i have done anything wrong.

Could anyone help me to solve this error.

Thanks & Regards,
Ashok.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Why do you need to create a method to assign the second step approver? If you have the next processor (N_PERNR), you can directly assign it to the second approval step as an agent.

Former Member
0 Kudos

Hi Abdullah,

In the Next Processor(N_PERNR). the first approver Value is coming.

So I am creating the method for the second level approver.

Please validate the steps i followed are right or not.

Thanks & Regards,

Ashok.

Former Member
0 Kudos

I'm not an expert in this specific workflow template. Still, I'm not sure why you assign the processor in the code. Processors are assigned to the task in SWDD. Since you have the PERNR, then you can pass it to the task. Why do you assign directly to the leave request?

former_member185167
Active Contributor
0 Kudos

Hello,

The error message suggests the problem is that you have an empty (NULL) object.

You should check for that in the container, to see which one it is.

regards

Rick Bakker

suresh_subramanian2
Active Contributor
0 Kudos

Hello Ashok !

           Have you test this method in SE24 ?

           I think the next processor personnel number is not populated.

Regards,

S.Suresh.

naresh_bammidi
Contributor
0 Kudos

Hi,

What error you are getting?Can you please provide the screen shot of the error?.Meanwhile put a break point in your class method and debug the task.

Thanks

Naresh

Former Member
0 Kudos

Hi Naresh,

I am getting the below error message.

Please let me know what could be the Problem.

Thanks & Regards,

Ashok.