cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow conceptual -doubts

Former Member
0 Kudos

hello,

few doubts on workflows,

i am executing a workflow from a program using FM :'SWW_WI_START'.

i am passing agent table in this FM as a parameter.

But in workflow also i have created an activity and maintained agent assignement in task.

What i am not understanding is:

Does workflow sends workitems to those agents which i am passing while calling FM

or does workflow send notifications to agents in have maintained in agents in workflow (control tab).

1 once i have not assigned any agent in control tab and also agent table (passed to FM) is also empty.

Still why i am getting notifications in SBWP for that work item?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Just as Rick, I would use SAP_WAPI function. You can pick SAP_WAPI_START_WORKFLOW, because you are already using a similar function to start the workflow directly. Then use the container parameter  of the function to pass the agents to the workflow. For example create a new container element called AGENT to the workflow container (change its properties to "import"). Now pass the agents with SAP_WAPI_START_WORKFLOW to this new container element. Use that container element as your step's agent (I can see from your screenshot that currently its empty).


Regards,

Karri

Former Member
0 Kudos

Thanks,

I can create a mandatory multiline container element AGENT.

Please tell me its (container element) data type.(which table,which field).

Former Member
0 Kudos

For example  WFSYST-INITIATOR. The data must be in format US + user ID, e.g. user ID SMITH is USSMITH.


Regards,

Karri

Former Member
0 Kudos

Thanks Karri,

That was indeed a helpful answer.

Why i have not marked thread answered..because i want to know few more concepts(this a not about a requirement).

1. got 1 way of assigning multiple agents to a task.(Which you have mentioned,by creating multiline container element.)

2.Can be also fulfilled by creating rule...? I  have created a rule(T Code PFAC), and assigned a function module to it.

once i have agents handy (to which workitems to be sent) how can this rule send workitems to those agents(may be i am asking how rule with task in combination works) ?

What is the role of two table parameters.

ACTOR_TABLIKESWHACTOR
AC_CONTAINERLIKESWCONT
Former Member
0 Kudos

Basically you have two main ways of delivering the work item to the agents. (There are some others too, but let's not discuss them now.)

1) Just like you are doing now. You fill a container element (for example from the WF starting phase)  and then use that container element expression in the agent part of the step definition.

2) Use a rule. You have already figured out that you can use a function module as a rule. If you use a rule, then you don't need to fill the container element at all. It is rules job to find the agents. I am sure you can easily find some examples of rule functions. Basically the AC_CONTAINER includes the incoming parameters. You can define a container element for the rule, and then you can do the binding from the workflow to the rule => you can find the container element value in AC_CONTAINER and then use that in your code. The ACTOR_TAB is the one that includes the agents. Since you are developing the rule function, you must add relevant code there to add the agents to this internal table ACTOR_TAB. The workflow delivers the work items to these agents that it finds from ACTOR_TAB.

Regards,

Karri

Former Member
0 Kudos

Basically the AC_CONTAINER includes the incoming parameters. You can define a container element for the rule, and then you can do the binding from the workflow to the rule => you can find the container element value in AC_CONTAINER and then use that in your code.

That Means, if i am not defining any container element(may be i don't need one), then parameter AC_CONTAINER  is of no use to me.

Secondly, I see there are two parameter of structure SWHACTOR (ACTOR_TAB).

OTYPETypesOTYPE
OBJIDTypesACTORID

If in Function module i am only defining OTYPE = 'US' and OBJID = 'ABHISHEK'. then i'll be getting email(email address defined to my user id SU01). Am I right?

former_member185167
Active Contributor
0 Kudos

Hello,

"If in Function module i am only defining OTYPE = 'US' and OBJID = 'ABHISHEK'. then i'll be getting email(email address defined to my user id SU01). Am I right?"

Not entirely. Rules are for returning users (or groups of users, like Positions) - not email addresses.

regards

Rick Bakker

Former Member
0 Kudos

>That Means, if i am not defining any container element(may be i don't need one), then parameter AC_CONTAINER  is of no use to me.


Yes. AC_CONTAINER will be empty in runtime.


>then i'll be getting email(email address defined to my user id SU01). Am I right?


I am not sure where you got that email idea? The agents will be user IDs. => The users will get a work item in their Business Workplace inbox (not email inbox). It looks like you are having some kind of IDOC monitoring task, so in other words, the users will get a task for IDOC monitoring in their inbox.


Now if you want emails to be sent, that will be entirely another story. Basically you need to add email sending step in your workflow OR you can implement Extended Notifications for your task.


Regards,

Karri

Former Member
0 Kudos

Thanks Karri,

I got your point.I was referring to a work item(not email exactly).

One thing:

I have created a rule to determine agents for the task.Also, i have created another rule to determine agents for deadline monitoring of this task.

Time and date for deadline monitoring is assigned as EXPRESSION in variables.

See Screen-shot.

Both variables '&GV_DATUM&' , '&GV_TIME_MISSED&'  are in workflow container and their values are passed in workflow container while calling workflow.

Is this the correct way to dynamicaly determine time/date for deadline monitoring?

Secondly, i am trying to insert condition step before this step to check if these (both) variables are not initial.

The condition should be:

CHECK GV_DATUM IS NOT INITIAL AND GV_TIME_MISSED IS NOT INITIAL.

But i am facing issues while implementing this condition.

Please guide me, how to use condition editor to implement this condition .

Former Member
0 Kudos

Your approach of using the expressions is correct.

This thread has become a one-on-one teaching session. I recommend that you close this thread and continue your learning process by trying to search answers by yourself. If and when you cannot solve certain specific problem, you can create a new thread.

Thanks,

Karri

Answers (2)

Answers (2)

former_member185167
Active Contributor
0 Kudos

Hello,

You should not be using fm SWW_WI_START. Use SAP_WAPI_START_WORKFLOW if you have to, but best of all would be to use SAP_WAPI_CREATE_EVENT to create an event to trigger the workflow.

regards

Rick Bakker.

Former Member
0 Kudos

Rick Bakker wrote:

You should not be using fm SWW_WI_START. Use SAP_WAPI_START_WORKFLOW if you have to,

My question is :WHY?

What difference does it make if i am using FM SWW_WI_START  or SAP_WAPI_START_WORKFLOW .

former_member186746
Active Contributor
0 Kudos

One of those function modules is not released by SAP.

That's why.

former_member185167
Active Contributor
0 Kudos

Further to what Rob said - SAP_WAPI* is guaranteed to work after the next upgrade while SWW* can be changed at any time by SAP, causing your application to fail.

If you want to really do it properly, use SAP_WAPI_CREATE_EVENT. Surely your workflow has a main class or BOR object.

anjan_paul
Active Contributor
0 Kudos

Hi,

The FM you used and passed AGENT is refer to the  workflow agent , not TASK agent(2nd screenshot).  If you not maintinating any agent in control tab and   make the TASK    as

      general task, every user in the system   will get         the workitem.

Check and share screnshot of runtime workflow log

Former Member
0 Kudos

okay. thanks,

How would i be able to send the work item to multiple agents . Should i pass multiple receipients in FM.(workflow agents) or should i create a container element(multiline) and then pass it in control tab in TASK.

Or should i create a rule to determine agents(FM to determine agents).