cancel
Showing results for 
Search instead for 
Did you mean: 

FM to add possible agents at runtime in workflow

Former Member
0 Kudos

Hi experts,

We have requirement to restrict forwarding of workitem. I know we can achieve this by define possible agents in agent assignment of the task (General forwarding not allowed).

But our requirement is to fetch the possible agents from custom table at runtime dynamically. So, is there any FM or BAPI available to fill the possible agents dynamically instead of static assignment in the task. Or is there any other way to achieve this requirement.

We are trying to map custom workflow task to 'My inbox' fiori app. In this custom workflow, there is a functionality that it can be forwarded to only a particular group of users which is fetched from Z-table at runtime (company code wise)

Now, we require this functionality in the fiori app also. While R&D, we have restricted the users via possible agent option in the task(Task -> Extra -> Agent assignment -> Maintain -> Attributes -> General forwarding not allowed). In this option, we have assigned some test users. When we tried to use forward option in the fiori app, only the assigned users were allowed.

But it's a static restriction. we can assign possible agents before the execution of task and we have to assign all the users from all the company codes.

Our requirement is to assign possible agents(company code wise) at runtime to match our custom functionality in fiori app also. So, the forward functionality should work only for respected set of users per company code.

Is there any way to do so?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

pokrakam
Active Contributor

Workaround: Copy your main task to a series of tasks for each company code with the possible agent subset. I'm not a big fan of Z-tables anyway, so would check if it's possible to use roles or org units? This is definitely the recommended approach for agent assignment.

Then just assign each role/org unit to the corresponding task.

Use dynamic task assignment to select the right one at runtime. With a functional method it can all be done in your WF activity step.

Not a perfect solution (well, replacing Z-tables is a better solution), but quick and easy to implement and uses standard SAP functionality.

Former Member
0 Kudos

Thanks a lot Mike,

I think your workaround is near to perfect solution. Probably the only solution. 🙂

Regards, Vijay

JensSB
Participant
0 Kudos

Hello Mike,

this workaround is for my requirement too static (forwarding only to people with a higher approval level) and too much effort (around 90 units) to realize. HR is not in use.

Are there any new possibilities in a SAP HANA 1809??

It would be great if the addional option RULE could be realized, at least of category F (function module) and the binding to the task container. This would integrate so much flexibility.

Thank you for your answers.
Best regards, Jens Schmitt-Bousska

pokrakam
Active Contributor

Hi Jens,

I am not aware of any new 1809 functionality that would support your scenario. For similar scenarios I've modelled it into WF. Something like "Approve/Reject/Forward" as decision options and then presenting a choice of forwarding agents.

Failing that, I would create an enhancement for this.

PS. You'd be better off posting a new question (link to this one if you like). People are more likely to read new questions than comments on three year old threads, especially with this site's awful Q&A format.

Good luck,

Mike

Answers (7)

Answers (7)

former_member186746
Active Contributor

Hi,

Adhoc forwarding can be done with transaction SWIA, check if this conforms to the clients needs.

Also, if forwarding is something that is done so many times that the need arises to control it then in all probability the original agent assignment was wrong and you should fix that. The moniker of SAP Business Workflow is:"the right information at the right time to the right person"

Kind regards, Rob Dielemans

Former Member
0 Kudos

Hi Rob,

We are trying to map custom workflow task to 'My inbox' fiori app. In this custom workflow, there is a functionality that it can be forwarded to only a particular group of users which is fetched from Z-table at runtime (company code wise)

Now, we require this functionality in the fiori app also. While R&D, we have restricted the users via possible agent option in the task(Task -> Extra -> Agent assignment -> Maintain -> Attributes -> General forwarding not allowed). In this option, we have assigned some test users. When we tried to use forward option in the fiori app, only the assigned users were allowed.

But it's a static restriction. we can assign possible agents before the execution of task and we have to assign all the users from all the company codes.

Our requirement is to assign possible agents(company code wise) at runtime to match our custom functionality in fiori app also. So, the forward functionality should work only for respected set of users per company code.

Is there any way to do so?

Regards, Vijay

bpawanchand
Active Contributor

Hi ,

Try with the below function module RH_WI_ORGTASK_ACT_AGENT_SET. Actually, in the first mentioned function module you have to pass the possible agents in the agents tables parameter.

Thanks, Pavan

0 Kudos

Vijay,

I was going to post the same question so I will just monitor this one, I have a decision task in a parforeach and each loop is a different approver (supervisor,manager,director). This is dynamic based on $ amount, my scenario is if this only needs a supervisor then I would like to dynamically fill possible agents with just supervisors. Right now I have supervisors, managers and directors as possible agents. I would like to just list the supervisors so they don't forward to a directors and vise versa. I could make a separate decision tasks and populate accordingly but seems like something that should be remedied with the ability to populate POSSIBLE agents dynamically before the task is called in a wf.

I already have the responsible agent determined and know that they are a sup,man,dir so seems I should be able to load the possible dynamically but have not found anyway to do so.

Regards

Jim

Former Member
0 Kudos

Hi Sascha and Pavan,

I've updated my post to elaborate our requirement. Can you please have a look again to the question section.

If you have completed the whole question, you should get the complete picture of the requirement. Now, if we use 'SWW_WI_AGENTS_CHANGE' FM then the workitem will be forwarded to all the users of particular company code. But we don't want to send the workitem to every user. We only need to restrict the users while forwarding. One can forward a workitem only to the set of users (company code wise) not to everyone.

Because of that, we need dynamic possible agent assignment at runtime.

Regards, Vijay

SaschaW
Participant
0 Kudos

Hi,

maybe SWL_WI_POSSIBLE_AGENTS_ASSGIN is what you are looking for?

Regards

sumeet123kumar7
Explorer
0 Kudos

where is parameter ? i don't see any parameter to pass possible agents.

please help.

Former Member
0 Kudos

Hi Sascha,

Thanks for your answer.

This FM calls the screen for edit agent assignment in dialog mode. But we require to edit in background task. Is there any other FM for assign possible agents in background ?

Regards,

Vijay

SaschaW
Participant
0 Kudos

Hi Vijay,

you are right. But is the answer from him then not the right one? With SWW_WI_AGENTS_CHANGE you can change the agents for a workitem. And every agent who is allowed is a possible agent untill one of them starts to work at this workitem?

bpawanchand
Active Contributor
0 Kudos

Hi,

Check the below function module

SWW_WI_AGENTS_CHANGE

Thanks,Pavan

sumeet123kumar7
Explorer
0 Kudos

In the given Function Module there is parameter for every Agent,but no parameter for Possible agent.

can u please help.

former_member400468
Active Participant
0 Kudos

Hi!

You can create a new FM to determine agents please check the following links:

https://blogs.sap.com/2015/04/02/workflow-agent-determination-customization/

http://saptechnical.com/Tutorials/Workflow/Rules/Create.htm

Hope it's helpful

Evgeny