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 freezes intermittently while executing the SAP-related automation process.

Root Cause

  1. Sometimes, the SAP GUI application becomes busy, which affects the next UI automation activities in the workflow. Instead of failing with a timeout error, the execution gets stuck because each activity tries to complete the action once, no matter how long it takes. This can cause the execution to hang during that attempt.
  2. This behavior typically occurs when two selector-based activities are executed consecutively, and the first activity takes some time to complete. For instance, this issue was observed in a scenario where an automation performed the following steps:
    • 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 version 20.10.5 of the UiPath.UIAutomation.Activities package, you can use the boolean “sapReadyState” attribute in the Wait Attribute activity to check if the SAP application is busy or ready. Refer to the guide on “How to Wait For An SAP Background Operation” for more details. If the SAP operation finishes within the defined timeout, the activity completes and the workflow continues. If not, 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 querying 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 the 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 staying in a stuck/hang state.
image.png