The SAP GUI Scripting API automation interface is used for increasing capabilities of SAP GUI for Windows. SAP GUI Scripting is required for enabling UI elements recognition capabilities in SAP automation. To gain access to the interface, Studio requires enabling SAP scripting on the local machine, where the Robot runs, as well as on the server. Without this, selectors won’t work on the SAP UI elements. Image and OCR automation can be used instead, but selectors would provide an increased accuracy to the workflow.
With scripting disabled, SAP GUI panels are seen as blocks, even though the toolbar buttons and other elements are identified individually. The recognition of UI elements does require enabling SAP GUI scripting.
Note:
In relation to any security concerns, the SAP server sees no difference between SAP GUI communication generated by a script and the one generated by a user. The script has the same rights to run SAP transactions and enter data, just like a user would. The same data verification rules are applied to both data entered by a user and by a script.
Enabling SAP GUI Scripting on the Server Side
- Launch
saplogon.exe
, log in to your SAP server using your credentials. The SAP Easy Access window opens. - Run transaction
RZ11
. Specify the parameter namesapgui/user_scripting
and press Enter on the keyboard or Display in the SAP interface.
- In the Display Profile Parameter Attributes window, press the Change Value button on the toolbar and set the New value of
sapgui/user_scripting
toTRUE
. Save the changes.
Note:
All changes to parameters in transaction
RZ11
are applied with immediate effect and are lost when the system restarts. For changes to be permanent, please contact your SAP System Administrator and use transactionRZ10
.
- Log off and back on again to see the change into effect, as it does not apply to sessions that are currently running.
Note:
The status bar message “Parameter name is unknown” refers to the fact that the
sapgui/user_scripting
parameter cannot be changed using this transaction because a SAP server package is missing. Install the missing package, and try again.
Enabling SAP GUI Scripting on the Client Side
- On the Toolbar, go to the Customise Local Layout button and select Options from the drop-down menu. The SAP GUI Options window opens.
- Go to Accessibility & Scripting and click on Scripting. Under User Settings, check the box next to Enable scripting. Make sure the other two options Notify when a script attaches to SAP GUI and Notify when a script opens a connection are disabled. Save the changes by clicking OK. The SAP GUI scripting is now enabled.
Enabling Modal Dialog Boxes
Control (amodal) display options are not supported by SAP scripting. In this case Dialog (modal) display options need to be enabled, and this is done as follows:
- From the SAP Easy Access window, click Settings under the Help menu. The Personal Settings for User window is displayed.
- Access the F1 Help tab and select the in Modal Dialog Box option from the Display section.
- Access the F4 Help tab and select the Dialog (modal) option from the Display section.
- Click the Apply button to save changes and close the Personal Settings for User window.
Elements from dialog boxes now generate <SAP>
selectors.
Limitations
SAP automation can be performed with two clients, namely SAP GUI for Windows and SAP Business Client (NWBC). However, the latter client has some limitations in the SAP GUI Scripting engine, which is the technology used by UiPath to automate SAP applications. This has a couple of implications on automating SAP applications, such as:
- Running both the SAP GUI for Windows and SAP Business Client simultaneously can generate unpredictable selectors matching results. This is because it is impossible to reliably distinguish between the SAP Scripting instances of the two clients.
- If there are two active SAP Business Client (NWBC) instances, selectors are identified and generated only for the first. This is because only the first client instance is visible to the SAP GUI Scripting Engine, thus subsequent instances are invisible to the engine. In other words, the element in the first instance is detected every time.
Our recommendation is to use either the SAP GUI with as many instances as you want or the SAP Business client in a single instance when performing SAP automation.
Updated 3 years ago