cancel
Showing results for 
Search instead for 
Did you mean: 

background task put back the Work item in the inbox.

Former Member
0 Kudos

Hi experts,

I have a WF where at one stage the user ends on a decision task where he selects an option for wich an task need to be executed in background.when the task finishes the WF returns to the decision task which is assigned to the same person. but because of the intermediate background task the Work item finishes and the user need to reselect the WI in his inbox.

is there a way to keep the WI active, so it doensn't return in the inbox of the end user.

this works fine when 2 subsequent tasks are assigned to the same user, for the end user the WF stayed on his screen.

that's what I want to simulate here.

end user select an option, background task executed and the end user have the next decistion task automatically displayed whithout having to go to his inbox and reselect the work item.

any idea ?

regards,

Abdelaltif

Accepted Solutions (1)

Accepted Solutions (1)

former_member186746
Active Contributor
0 Kudos

hi,

In the step definition there's an option called continue with dialog, set this one active for all of the steps, this will continue executing workitems until one goes into error or when a user is needed (it's explained if you press F1 on the checkbox)

Kind regards, Rob Dielemans

Answers (1)

Answers (1)

Former Member
0 Kudos

You need to convert the background task to a foreground task and have the agent for this task same as the agent for decision task. Also have the 'Advance with dialog' checked on this task.

In this way the user will think that it is s background task but it is not. Instead it is executed in the foreground. Also since the agents for all the 3 tasks is same and have the 'Advance with dialog' switched on, the user will come back to the same decision screen without going back to the inbox.

Former Member
0 Kudos

Hi Jami,

Thanks for the Quick answer but the user cannot execute the background task. it has to be done by the workflow user ( authorization issue)

this task need to be executed by another user.

Abdellatif

pokrakam
Active Contributor
0 Kudos

Hi Abdellatif,

In that case it is not possible in a straightforward way: By switching userIDs you are ending the 'flow' of execution, the user context is lost.

A workaround is possible by executing your background task asynchronously. I don't mean in the asynch task sense, but to execute it parallel to the user decision.

This has some postential pitfalls because you need to consider what happens if the BG task fails but may just work depending on your scenario:

Put your background step into it's own workflow, then

Either call SAP_WAPI_START_WORKFLOW with the START_ASYNCHRONOUS flag set in a dialog step, or raise an event which triggers the flow.

You could handle failure by raising an event from the subwf which the calling flow waits for, but it would result in the user having a decision which is cancelled after he has seen the decision screen. Not pretty but you could send them an explanatory mail from your subflow.

Hope that helps.

Cheers,

Mike

former_member186746
Active Contributor
0 Kudos

Hi,

I don't know if this works, I was just thinking if it would be possible to change the agent of the step to the user AND change in the binding of the task-->method WF-BATCH = SY-UNAME.

If not, tough luck.

Kind regards, Rob Dielemans.

Former Member
0 Kudos

Hi Rob,

I think that should be the solution, but I don't know if it's possible. changing the running agent.

anyway if I don't find anything I will have to schedule a job in background under another user.

thanks,

Abdellatif

pokrakam
Active Contributor
0 Kudos

Hi,

Definitely won't work. A different user breaks the dialog chain. The only way to get that to work is to start a new WF which runs independent of the current user context.

Why bother with a background job? Using events is much easier, runs quicker and does the same. Simply create a custom event on the object, put a 'raise event' step where your background step is, and put your bg step into a new WF triggered by the event.

Cheers,

Mike