cancel
Showing results for 
Search instead for 
Did you mean: 

FM/Class-Method to Replace Approver in particluar Process Level

Former Member
0 Kudos

Dear Experts,

Is there any way ( any Function Module OR Class Method ) to change the approver  of particular Process Level. My requirement is as below:

We have a custom Table from where approval agents are determined and Process levels are created.

Now if today I replace the approver in custom table with some other approver then our customer wants that it should be effective for all SCs which are pending for approval.

We can change the approver if workitem is pending with that approver ( Though workitem forwarding using FM SAP_WAPI_FORWARD_WORKITEM ).

But is there any way to replace the approver if SC has not reached to particular level yet for approval.

e.g.

SC is created with 4 levels of approval ( Level A, Level B, Level C, Level D)

SC is pending with Level B.

I need to replace the approver of Level D. ( without restarting the Workflow)

Thanks

Rajan

Accepted Solutions (0)

Answers (2)

Answers (2)

SandySingh
Active Contributor
0 Kudos

Hi Rajan

Based on my knowledge, once a process level is completed, next process level is validated  and approvers for this level (BADI logic) will be determined at the runtime. So if the custom table will have updated values then new set of approvers will be correct.

I think the issue here is with current approver being incorrect if a custom table is updated after WF trigger. In this case, WF admin can forward the work item using Transaction SWIA. Ideally the agent determination tables shouldnt be changing that often.

You can also create a small report program that would take Shopping cart nos as input and would re-run the logic to determine the new agents reading custom table and forwarding it to new agents using FM SAP_WAPI_FORWARD_WORKITEM. This report can be scheduled after hours as batch job to avoid shopping cart locking.

Regards

Sandy

Former Member
0 Kudos

Dear Sandy,

Would request you to refer my response to Mr. Rick. Will really appreciate if you could help into the same.

I am already planning for the batch job and I can forward the workitem if it is pending with particular approver. But how can I change the approver of future Process Level. As I mentioned in previous response; approvers are predetermined in Process Controlled Workflow.

Thanks

Rajan

SandySingh
Active Contributor
0 Kudos

Hi Rajan

When you raise a shopping cart, then you see the list of all approvers for all process levels in forecast functionality but once a process level is completed then next process level approvers are determined at runtime. Dont get confused with forecast at the time of raising shoppinf carts.

So if the custom table is updated then approver BADI code will read this new entry when agents for new process level are determined.

Report can be used to forward approal items to correct agents and is only applicable for current in process process level.

Mark the correct answers or helpful answers and close the thread.

Regards

Sandy

SandySingh
Active Contributor
0 Kudos

Hi Rajan,

Is this issue resolved?

Please share your response for others and close the question with correct/helpful answers.

Regards

Sandy

former_member185167
Active Contributor
0 Kudos

Hello,

The workflow should designate the approvers as late as possible - that is common sense design.

So, the approver for Level D should only be deduced after approval at Level C. If that's not the case then you should fix the workflow.

For the existing workflows - if the future approver is stored in the container (bad design) then you could use SAP_WAPI_WRITE_CONTAINER to change it.

regards

Rick

Former Member
0 Kudos

Dear Rick/Sandy,

Apologize that I forgot to mention that this query is related to Process Controlled Workflow ( BRF).

IN Process Controlled Workflow, it predetermine the process levels and approval agents. My problem is to change the approver of future process level.

You are right that in case of Application Controlled Workflow, next approver is determined when current approver have completed the process.

Thanks

Rajan

former_member185167
Active Contributor
0 Kudos

Hello,

Your batch job should run whatever process is used to determine the Approvers. Because the Z table has now been updated, it should pick the new Approver for level D. Then, you can forward the workitem to that Approver.

regards

Rick