cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop work item approval when payroll is locked

0 Kudos

Hi, A

Am new is SAP workflow, got my certification last month, we have implemented a custom workflow for overtime approval which is working well, However, during the payroll period, approval happen but the overtime record in PA2002 is not unlocked, this leads to many employees not being paid and we are forced to unlock them manually, kindly assist on how i cant restrict workitem approval when payroll area is locked. i have found the interface i need to implement , IF_SWF_IFS_WORKITEM_EXIT, but stuck on how to implement it. kindly help me out.

Thanks

Kelvin Munyasia

Accepted Solutions (1)

Accepted Solutions (1)

former_member201570
Active Participant
0 Kudos

Hi,

You can use the FM 'HR_EMPLOYEE_DEQUEUE'

*---> lock the employee
CALL FUNCTION 'HR_EMPLOYEE_DEQUEUE'
EXPORTING
number = im_pernr
IMPORTING
return = wa_return.

I have done the same for Overtime workflow. You can call this FM using your BO method.


Regards,

Shamsu

0 Kudos

Thanks Sham,

I have used your logic to implement the IF_SWF_IFS_WORKITEM_EXIT interface in a class and used the program exit in the decision step.

The after execution method checks if the payroll area of the employee is locked. if that is true, it thows an error "payroll area locked" and stops execution of the same.

Thanks a lot.

Answers (2)

Answers (2)

former_member185167
Active Contributor
0 Kudos

"Am new is SAP workflow, got my certification last month"

You were able to pass the official SAP Workflow certification exam while being new to Workflow?

Congratulations, but it's time to raise that passing grade!

0 Kudos

Rick, by new i mean i dont have much experience. AM really working on it. Thanks

ronen_weisz
Active Contributor
0 Kudos

You must catch errors raised form your approval method, and transfer that error for someone to handle, a decision task in a loop giving the user a "retry" option and calling the approval step again should work.

If this is a reoccurring error to which you know the solution, you can add this solution to the method performing the approval. but always catch the errors you never know when a new type of error can happen.