Handling Job Running Forever Issue in SAP-related Automation

What is the solution when SAP-related automation in UiPath freezes during an authentication error and causes a job to run indefinitely without producing any error?

Issue Description

In specific SAP-related automation scenarios, instances have been observed where UiPath Robots freeze and stop executing subsequent activities due to an authentication error or similar SAP GUI issues. As a result, the job runs indefinitely without generating an error. In such cases, the job must be manually terminated.

Root Cause

Sometimes, the SAP GUI may freeze while communicating with the server. This freezing leads in turn to the Robot also freezing. Hence, it is crucial that any interaction with SAP is timeboxed and placed in a Parallel activity.

This Parallel activity should incorporate a delay that reflects the anticipated running time and triggers an action, such as closing the SAP process.

It is noteworthy that simply throwing an exception, rather than terminating the SAP GUI, is generally ineffective. This ineffectiveness is due to the activity potentially freezing and waiting for the SAP action to conclude before it can throw the exception.

Ultimately, the exhibited behavior is a result of frozen SAP interactions. These interactions cause the UiPath Executor Robot to wait for a response on the same thread to the request initiated via the GUI action or scripts.

Resolution

Here are the possible solutions to this challenge:

  1. Invoke SAP-related actions via the Invoke workflow activity and define a timeout value. This value should reflect the expected duration plus some buffer time, measured in minutes or seconds. See Activities - Classic
  2. Encase SAP interactions in the Parallel activity. Refer to the official documentation for more detailed understanding and instructions in Activities - Run Parallel Process

Always remember, effectively addressing this issue is key to avoiding workflow interruptions and ensuring seamless automation for SAP-related processes.