cancel
Showing results for 
Search instead for 
Did you mean: 

based on no. of leaves, approvers should be different

former_member188019
Active Participant
0 Kudos

Hi all,

we are in ehp7.

in our scenario, when employee applies leaves for less than 10 days, the approvers should be persons A and B.

when employee applies leaves for 10 or more days, the approvers should be persons X and Y.

for this we tried to use the method  IF_EX_PT_ABS_REQ~GET_MULTIPLE_APPROVERS of Leave Badi ZCL_PT_ARQ_REQ_EXIT, using the blog http://scn.sap.com/docs/DOC-41537

in the leave approval screen, when we select a leave type, the method IF_EX_PT_ABS_REQ~GET_MULTIPLE_APPROVERS is getting called.

but we want to call this method after the employee puts the leave dates, so that we can take the decision based on leave days count.

is there any way to change/add/remove approvers, via SIMULATE_VIA_BLOP method or any other place, because SIMULATE_VIA_BLOP is getting called, when the employee clicks on send leave request.

is there any other way to incorporate approvers based on leave count.

thanks,

Madhu_1980

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member182426
Active Contributor
0 Kudos

You can copy the standard workflow WS21500001 and do customization.

In your custom workflow, before approval step,  you validate the no.of leaves and get the ACTOR details and pass the ACTOR in approver task.

This will be good way and you can have track of approvers in each level.

Former Member
0 Kudos

Hi Madhu,

There is an attribute ACTOR_AGENT in the class ZCL_PT_ARQ_REQ_EXIT. In that we have       OBJECT_INFO which will have employee record and the approver record. try changing the approver details based on the number of days in the method SIMULATE_VIA_BLOP.

Else you can change the rule to find the approver based on the number of days in the workflow approval task.

Regards,

Jyothi

Lukas_Weigelt
Active Contributor
0 Kudos
Else you can change the rule to find the approver based on the number of days in the workflow approval task.

That's a very good point and probably the cleanest way, though it's only usable if he uses a workflow and not the dedicated POWL scenario.

Cheers, Lukas

former_member188019
Active Participant
0 Kudos

Hi Jyothi,

we are trying to add one more level of approver, when the no. of leaves are more than 10.


There is an attribute ACTOR_AGENT in the class ZCL_PT_ARQ_REQ_EXIT. In that we have       OBJECT_INFO which will have employee record and the approver record. try changing the approver details based on the number of days in the method SIMULATE_VIA_BLOP.


in ZCL_PT_ARQ_REQ_EXIT-ACTOR_AGENT-OBJECT_INFO, while adding new actor/approver, it expects IDs which are internally used.

also, when i removed a row from ZCL_PT_ARQ_REQ_EXIT-ACTOR_AGENT-OBJECT_INFO, in simulate_via_blop via debugging, it gave error:


  Exception 'CX_OS_OBJECT_STATE' was raised, but it was not caught anywhere

  along the

  call hierarchy.

  Since exceptions represent error situations, and this error was not

  adequately responded to, ABAP program 'CB_PT_REQ_ACTOR===============CP' had

  to be terminated.



former_member188019
Active Participant
0 Kudos

Else you can change the rule to find the approver based on the number of days in the workflow approval task.

That's a very good point and probably the cleanest way, though it's only usable if he uses a workflow and not the dedicated POWL scenario.

currently, in MSS, Managers are using POWL to approve leaves. (we dont have EP, so not using UWL). If we modify the workflow, does it mean that Managers cannot approve/reject via POWL.

Former Member
0 Kudos

Hi,

In debugging mode do not add new record, just change the ACTOR_AGENT-OBJECT_INFO

ACTOR_AGENT

OBJECT_INFO

the above highlighted record will have approver details, select and try to change the approver details. If it works you can add the same logic.

Regards,

Jyothi

Lukas_Weigelt
Active Contributor
0 Kudos

Hi Madhu,

we don't use the multi level approver functionality and I don't entirely understand whether you are using the OVS Searchhelps or whether the approvers are polled entirely automatic in your business scenario, but just to make sure you don't miss anything, you might want to check BADI PT_GEN_REQ Methods IF_EX_PT_GEN_REQ~SEARCH_FOR_NEXT_PROCESSOR and IF_EX_PT_GEN_REQ~FILTER_NEXT_PROCESSOR as an alternative to SIMULATE_VIA_BLOP in PT_ABS_REQ.

Cheers, Lukas

former_member188019
Active Participant
0 Kudos

>>whether you are using the OVS Searchhelps or whether the approvers are polled entirely automatic in your business scenario,

we are not using OVS, or allowing the employees to select the approvers. the system automatically to select the approvers, based on the no. of leaves applied.