Background tasks and deadlines

Florin Wach florin.wach at gmx.net
Mon Feb 6 17:07:17 EST 2012


Hi there,

it's obvious, that as long a bg workitem runs / processing, it's not going to be cancelled by a deadline, as it is currently locked by the enqueue.

Unless the SAP runtime system has invented a new intelligent subsystem that is aware of Rick's special coding obstacles, it will think: "Well, I have no idea, about what's going on within that workitem, but the programmer has a hell of a calculation to solve, and I trust the developer, who knows what he's been doing."

Performing a huge background operation is just not the right place for a workflow to do it. Instead, I suggest to use a background task that creates a Job with a variant and starts that like an SM36. There's even a workflow wizard availabe, that does exactly that kind of neat activity.
If you needed to progress with the Workflow, once the report ends, create a waiting step there, and an event creation at the end of the report.

With the best wishes,
   Forin


Am 06.02.2012 um 15:13 schrieb "Sample, Rick" <Rick.Sample at graybar.com>:

> First, this is low priority issue. I found something I did not think was allowed and testing. 
> 
> Org issue, in prod with very large PO lines a FM call in a background task gets stuck. Working on the issue, but I tried to just abort the call and move to next user until I have time to work on it. Nothing I tried is working. 
> 
> Test: 
> I created a very simple test WF that I put into an endless loop to attempt a quick fix using an End Deadline. Doing this, I found when it gets stuck in loop, it gets "STUCK" in loop. Never errors, never ends, etc. I have to logically delete the task and kill the process from SM50. I have been away from SAP for 6+ months, but as I recall, the system should never allow these run away loops. I am reviewing my notes for config to abort on these endless loops. I know there config, just don't recall where. I believe there is a BASIS level and a WF System level config to abort after x times or time. 
> 
> Thanks,
> Rick
> 
> 
> 
> -----Original Message-----
> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf Of Kjetil Kilhavn
> Sent: Monday, February 06, 2012 2:21 AM
> To: SAP Workflow Users' Group
> Subject: Re: Background tasks and deadlines
> 
> Fredag 3. februar 2012 10.45.31 skrev Sample, Rick:
>> Hi Margaret,
>> 
>> Never used it before, but I just tried it. Nope! Does not stop the 
>> task or the BOR-Method process. When I Logically Delete the WF task, 
>> the program still continues to run, until I kill it in SM50.
>> 
>> I am looking for the config for time outs. I believe there is an SWU3 
>> setting. Forces long running "Oops loops" into error if they take 
>> longer than 'X' time. As Mike stated, supposed to be 30 mins default. 
>> (as I recall anyway). I have been away from SAP for 6+ months, so 
>> little rusty and doing the hunt & peck method of finding this setting.
>> 
>> Thanks - and if you know where these settings are to set WF tasks or 
>> 'stuck in loop' processes to error, please forward. Rick
> 
> I would try to fix the ABAP instead (unless I have misunderstood and the looping is in the workflow definition). 
> I guess this is just stating the obvious, but if the background step runs into an endless loop you need to add conditions to prevent that. If the database selection takes too long there's a need for either a slight rewrite to use better indexes or the creation of a new index. Perhaps you'll find that the endless loop is in SAP's code and can report an error - in which case your problem will be solved (eventually) and the rest of us won't have to suffer the same problem.
> You wouldn't happen to have fallen into the "FOR ALL ENTRIES" on an empty table trap? I've been there, and I'm sure most of the readers here have too.
> 
>> -----Original Message-----
>> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On 
>> Behalf Of Hilsbos, Margaret A Sent: Friday, February 03, 2012 10:19 AM
>> To: SAP Workflow Users' Group
>> Subject: RE: Background tasks and deadlines
>> 
>> Rick,
>> 
>> I don't know if this was mentioned yet ... in the workflow step 
>> definition, scroll far to the right, on the Miscellaneous tab, there 
>> is a setting labeled "Time from Creation of Work Item Until Timeout". 
>> The help for this field says, "Time interval between the creation of 
>> the background work item and the occurrence of the timeout."
>> 
>> Have you tried this?
>> 
>> Margaret Hilsbos
>> Day & Zimmermann
>> 
>> 
>> 
>> -----Original Message-----
>> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On 
>> Behalf Of Sample, Rick Sent: Friday, February 03, 2012 10:18 AM
>> To: SAP Workflow Users' Group
>> Subject: RE: Background tasks and deadlines
>> 
>> Thanks for assistance all.
>> 
>> No success. And one more question.
>> 
>> Mike, on your point on the 30 minute error rule. That is obviously not 
>> working here. These looped task will run for days if I let them. So 
>> would you be so kind as to remind me where that setting is located? I 
>> recall a setting, but can't recall what / where.
>> 
>> First, until I can figure out why code that has been working correctly 
>> for 6 yrs is now 'sometimes' getting stuck in loop, I would like to 
>> stop the bleeding.
>> 
>> Tests:
>> I created a simple test WF with BG task and simple DO forever loop.
>> I tried everything that I can think of (and suggestions from list) to 
>> stop this task and running process in SM50. Parallel fork suggestion, 
>> continues the flow, but does not stop the said BG Looped task. Async 
>> with term event, nada. Deadline, nope!
>> 
>> 
>> -----Original Message-----
>> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On 
>> Behalf Of Mike Pokraka Sent: Friday, February 03, 2012 7:07 AM
>> To: SAP Workflow Users' Group
>> Subject: Re: Background tasks and deadlines
>> 
>> Persn'ly I'd consider the wrong approach.
>> 
>> Deadlines aren't meant for this level of control. The timing 
>> resolution is a
>> 5 minutes accuracy at best, and background tasks error after 30 
>> minutes by default (at least last time I looked). If a background task 
>> takes that long it should probably be asynch anyway.
>> 
>> Best off doing this in code - add a timer to whatever the task method 
>> does
>> - e.g. in a loop. Use SELECT ... PACKAGE SIZE nnn to break up a 
>> long-running query - it would even improve DB performance if it means 
>> you can stop a query gracefully whever it takes too long.
>> 
>> Otherwise I suppose one could create a 'Meta method' that submits a 
>> task and monitors it in a WAIT UP TO... loop. Not pretty but an option.
>> 
>> Regards,
>> Mike
>> 
>> On Thu, February 2, 2012 5:52 pm, Sample, Rick wrote:
>>> Hey Wug'ers
>>> 
>>> I have someone trying to use a deadline on a background task.
>>> Just complete the task if it takes too long.
>>> 
>>> Been a while, so don't recall if this is possible.
>>> I thought of using CALL FUNCTION 'C160_HOLD_FOR_DEBUG'.
>>> but that won't work in WF-BATCH. (Unless someone knows how to take 
>>> over a WF-BATCH via SM50?)
>>> 
>>> Any way to set the task to complete in background task would be 
>>> appreciated.
>>> 
>>> Rick
>>> _______________________________________________
>>> SAP-WUG mailing list
>>> SAP-WUG at mit.edu
>>> http://mailman.mit.edu/mailman/listinfo/sap-wug
>> 
>> _______________________________________________
>> SAP-WUG mailing list
>> SAP-WUG at mit.edu
>> http://mailman.mit.edu/mailman/listinfo/sap-wug
>> 
>> _______________________________________________
>> SAP-WUG mailing list
>> SAP-WUG at mit.edu
>> http://mailman.mit.edu/mailman/listinfo/sap-wug
>> 
>> _______________________________________________
>> SAP-WUG mailing list
>> SAP-WUG at mit.edu
>> http://mailman.mit.edu/mailman/listinfo/sap-wug
>> 
>> _______________________________________________
>> SAP-WUG mailing list
>> SAP-WUG at mit.edu
>> http://mailman.mit.edu/mailman/listinfo/sap-wug
> --
> Kjetil Kilhavn (+47 40220607) - Blue Consulting AS (http://www.bluec.no) _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
> 
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug



More information about the SAP-WUG mailing list