How to fix an issue "A script is trying to access SAP GUI" while inspecting an element in a SAP application or executing a process that automates SAP via Robot?
Issue Description: A pop up with a message "A script is trying to access SAP GUI" is prompted by SAP whenever an external script\program tries to access a GUI element. In some cases, a different message "A script is trying to attach to GUI"
Starting with the UiPath.UIAutomation.Activities package v 22.4.4, the activities will also return an error message when interacting with SAP if the scripting is miss-configured.
"Cannot communicate with SAP GUI Scripting interface. Click for more information".
Root Cause:
By default, SAP application notifies the user that some program is trying to access the SAP GUI application. This is to prevent a program from making any changes in the SAP without a user's consent.
Resolution:
These settings are configurable and can be disabled through SAP Accessibility and scripting settings,
- Launch SAP GUI application manually.
- Navigate to âOptionsâ as below or press âAlt+F12â and click âOptions'.
- Select the âAccessibility & Scriptingâ option in the left pane
- Expand âAccessibility & Scriptingâ and select âScriptingâ
- If the warning message is thrown, the option âNotify when a script attaches to SAP GUIâ would be checked. To overcome the challenge, un-check following options:
- Notify when a script attaches to SAP GUI
- Notify when a script opens a connection. Click âApplyâ followed by âOKâ.
Note: The above screen may vary for different versions of SAP.