cancel
Showing results for 
Search instead for 
Did you mean: 

Change approver on cancellation of a old leave request

0 Kudos

Hi all,

so i'm having the following problem:

Employee requested leaves in the past. They are all approved. Then the manager got changed. Employee wants to cancel a old leave request. The cancellation is sent the the old manager.

The badi PT_GEN_REQ is already implemented and working fine and finds the correct and actual manager. But then when an employee sends a cancellation of old leave it gets redirected to the old manager.

Unfortunately as i found out, this is hardcoded in CL_PT_REQ_APPROVER_LIST->GET_REQ_APPROVERS. There is a SELECT statement in this method:

"get request approvers

       SELECT * FROM ptreq_approver INTO TABLE lt_approver_backend

         WHERE request_id = is_req_id AND version_no = lv_version_no.


Here the system reads the request and finds the old approver and then sets this one as the approver.


Is there a way to override this this behavior? I want the request to be redirected to the new manager.


Thanks in advance for your answers.


Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi yanko,

Did you find the solution of this problem?

siddharthrajora
Product and Topic Expert
Product and Topic Expert
0 Kudos

is the approver field can be changed by the end user?

what is the rule setting for determination of next agent, is it LINE MANAGER?

0 Kudos

Hi Siddharth,

the end user cannot change the approver. The rule setting in customizing is LINE MANAGER.

siddharthrajora
Product and Topic Expert
Product and Topic Expert
0 Kudos

So you are not allowing end user to change teh approver as per setting in V_t554s_web
typically when you are editing or modifying the leave the approver is already filled from previous approval cycle? was it not in your case? what about when you raise a new request?

0 Kudos

Explanation: manager xxx was the head of the org unit until 30.06.2015. Now the unit has new head - manager yyy.

Yes we are not allowing the end user to change the approver.

When a new leave is requested the right approver(yyy) is displayed.

But when a old one is cancelled or edited the old approver(xxx) is determined automatically by the system. That's the point that i want to override and set the manager yyy as approver, because he is the actual head of the unit now.

Former Member
0 Kudos

Hey Yanko,

I think you have 2 problems here.

1. to send the workitem to the new manager (because manager have to be one of the agents), one possible way to do that would be the workflow administration.

2. To get the workitem in Managers Inbox, are you using the standard Leave request powl? As far as I know the feeder class is working with the pernr of the manager in request and not with the actual wf agent...

regards

Alex

0 Kudos

Hi Alex,

thanks for your response.

the only problem that i have is the situation i described earlier. All is working fine workflow and manager inbox. The problem is in the standard coding of SAP.

As I already stated there is a SELECT statement in CL_PT_REQ_APPROVER_LIST->GET_REQ_APPROVERS, which gets called in the badi PT_GET_REQ->FIND_RESP_AND_DEFAULT_NEXT_PRC:

"get request approvers

       SELECT * FROM ptreq_approver INTO TABLE lt_approver_backend

         WHERE request_id = is_req_id AND version_no = lv_version_no.


After this statement the approver is read directly from the database and then later set as an default agent in the workflow. But the approver at that time was the previous manager not the actual one.


So any ideas?

Former Member
0 Kudos

Hi yanko,

i have no doubt that all is working fine ;-), what I wanted to say:

You can change the agent of the approval workitem via workflow administration.

Thats no big problem.

But if you do so, I think (i am not 100% sure) the new manager will not see this in his inbox and when he doesn´t see it, he can´t approve it.

Maybe it would be easier to use report RPTARQAPP in this case.

With this report you can approve leave requests, that woul be the easiest way, but then I think the user who executed the report will be the approver...