cancel
Showing results for 
Search instead for 
Did you mean: 

Multilevel Approver

sonu_kumar6
Explorer
0 Kudos

Hi Experts,

i have created a customized workflow , in which getting problem in agent determination.

i have to define agent in way that for a one condition , mail goes to all levels , for other condition mail goes to

3 different levels , similarly 2 and 1 based on condition .

How to create a rule (can we derive multilevel approver from PFAC) and  how  to use that in workflow ,(in loop or directly,

as number of approver is dynamic ,that we have to determine in rule i think )  

as if all the level person derived  approve  it,   then only  it should implement otherwise not .

Regards,

Sonu

Accepted Solutions (0)

Answers (5)

Answers (5)

sonu_kumar6
Explorer
0 Kudos

Thanks Karri for ur response ..n sorry for my low understanding as new to workflow ...

i am facing problem in step one only .

Actually earlier i was doing calculation in rule , and agent derived from that calculation  was unique so  , my workflow was working properly .

Now according to new requiremnt , i have to get all agent and that will be dyanamic.

How can i read it from rule. Can we create a container in workflow, and export all info which we needed like no of agent , level from rule or from class.

is there any way to fill values in container of workflow in workflow after few complex calculation in either class of FM ?

former_member185167
Active Contributor
0 Kudos

Hello,

You can write a method which calls the rule (using fm RH_GET_ACTORS) and retrieves all of the agents. You can pass that, plus the count of the number of agents back to the workflow and then use that information in a loop as Karri suggested.

With a method and bindings you can pass back just about anything from method to workflow.

A task (TS) calls the method.

regards

Rick Bakker

Former Member
0 Kudos

Hi,

You can do whatever you want. Just decide it first and then code it. Create a new method and task, and then call that in your workflow. You could for example copy the code from the rule to the method (or call the rule programmatically with RG_GET_ACTORS as Rick said) and then do the relevant adjustments to it. The method can return/export that data exactly in the format that you want and need. It can be a variable, structure or table type (of your own format), and you can export multiple different types of parameters. Then of course you need to create similar container elements to the workflow container, so that you can actually export the parameters from the step/task to the WF container.

One you have the data in the needed format in the container, then your next problem will be how to use in in the workflow (looping etc.). I already gave you a simple example in my earlier answer. You can choose that or something else. I don't know the exact requirement, so it is impossible to give detailed answers.

Kind regards,

Karri

sonu_kumar6
Explorer
0 Kudos

Actully here main problem is that i can't put Agent directly in container. There is complex calculation to determine that .Here i am not getting clear idea , how to put all those approver that i got in rule into a loop in workflow. can i put agent details in rule into workflow container ??

Former Member
0 Kudos

There are multiple ways to do this and this is just a really simple example:

1) In the beginning of the WF get the information about how many approvals is needed. Return the amount for example into a container element called APPROVALS_REQUIRED. Let's say you have 2 there.

2) Now put a loop there. In the beginning of the loop, put +1 into a a new element called a COUNTER or whatever.

3) Put your approval step in the loop. In the approval step you can put a rule function that takes the COUNTER value and all the other needed information that you require to determine the approver. Now in the rule function module you know that you are on the first level of approval and can calculate the correct approver.

4) In the loop check whether needed amount of approvals have been done (COUNTER equals APPROVALS_REQUIRED), and if not, the loop starts again. Now you should have '2' in the counter, and now your rule gets this value and can calculate correct second level approver.

Kind regards,

Karri

sonu_kumar6
Explorer
0 Kudos

Thanks Karri  and Anjan for quick response .

I have created a rule but requirement is like this :

if for one condition 3 approvers are there , then it should go to 3rd level first , if he approves then to 2nd ,and if he approves then to 1st.

As it is dynamic in nature in rule only , so how to implement this in workflow.

anjan_paul
Active Contributor
0 Kudos

Hi,

  That is ok, you can do it simple way.   based on condition take a loop step. In the loop step you send mail using mail step or activity step sequentially.

Former Member
0 Kudos

Then I would say that use a loop. It is not so much about the agent rule, but developing a workflow logic that utilizes a loop. Actually you might not even want to use a rule, but get the agents into a workflow container, and then use them as an expression for the agent determination. 

Don't forget to think about that what will happen when one of the approver decides to reject instead of approving. This might get a bit complex when using a loop...

Regards,

Karri

anjan_paul
Active Contributor
0 Kudos


Hi,

  You can do it using Rule using Function module. Create a custom rule where you pass the list of approver as import.     And in the rule send mail to the list using Cl_Bcs * class.  Then bind the Rule properly with step container

You will find lot of document to use Rule usin Function module in scn

Former Member
0 Kudos

This is really basic stuff. Yes, rules can return multiple agents. It is a standard behavior - you can as many agents as you want (or just one).

But really you should reformulate your question again. What are you really asking?

One critical thing here is that you need to define that do you need a dynamic parallel processing (=every agent needs to approve the same "document") or is it enough that one approves it, and then the work item will disappear from everyone's inbox.

Kind regards,

Karri