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.
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.
saplogon.exe, log in to your SAP server using your credentials. The SAP Easy Access window opens.
- Run transaction
RZ11. Specify the parameter name
sapgui/user_scriptingand 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
TRUE. Save the changes.
All changes to parameters in transaction
RZ11are applied with immediate effect and are lost when the system restarts. For changes to be permanent, please contact your SAP System Administrator and use transaction
- Log off and back on again to see the change into effect, as it does not apply to sessions that are currently running.
The status bar message “Parameter name is unknown” refers to the fact that the
sapgui/user_scriptingparameter cannot be changed using this transaction because a SAP server package is missing. Install the missing package, and try again.
- 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.
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 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 2 years ago