SAP And Robot Hang Intermittently

How to troubleshoot Robot (UiPath.Executor.exe) hang while executing SAP related automation process?

Issue Description: UiPath Robot [UiPath.Executor.exe] hangs or freeze intermittently while executing SAP related automation process.

Root Cause:

  1. In some cases, the SAP GUI application gets into a busy state which in turn affects the UI automation activities that are to be executed next. Instead of failing with a timeout error, the execution is also stuck because at the moment, before checking the timeout, all activities do one complete try to perform the requested action, no matter how long it takes. So, the execution could hang while executing that activity once.
  2. In the other cases where this behavior has been seen, it usually occurs when two selector-based activities occur one after the other and the first selector-based activity requires some time to complete. For example, in one case this issue arose when an automation did the following:
    • Entered an attach window activity
    • Opened a page on the SAP application
    • Entered data on that page which included a file to upload.
    • Submitted the data
    • Exited the attach window activity
    • Immediately tried to see if the file had successfully uploaded using an Element exists activity.

Resolution:

  1. Starting from 20.10.5 version of UiPath.UIAutomation.Activities package, boolean value "sapReadyState" attribute can be used in Wait Attribute activity to check the busy or ready state of the SAP application. Refer How to Wait For An SAP Background Operation]. If SAP operation completes in less than the defined timeout value, activity completes and workflow continues, otherwise an exception is thrown
  1. If the issue is due to back to back UI actions being performed on SAP, add a delay in between those activities. For the example explained in the 'Root cause' section, the sequence of submitting data, immediately exiting the attach window activity and then immediately query the GUI for an element caused both the SAP application and UiPath to hang. Adding a delay should resolve the issue.
image.png
  1. Move the SAP related activities to a separate workflow and invoke them using Invoke Workflow File activity with the Isolated option checked and a timeout value set. This will ensure that the workflow throws an error if it exceeds the configured timeout value instead of in a stuck / hang state.
image.png