SAP GUI Scripting

Diverse tools use SAP GUI scripting: test tools to perform regression testing, load testing, solution manager CBTA, etc. Also robotizing tools often use GUI scripting.

Questions that will be answered in this blog are:

  • How to enable GUI scripting in the SAP system?
  • How to make sure only the allowed users run GUI scripting?
  • How can I record an SAP GUI script and execute a playback of the recorded script?

Server side enabling GUI scripting

First you need to allow GUI scripting on the server side. This can be done by setting system parameter sapgui/user_scripting to the value TRUE. This is done in transaction RZ11.

Client side enabling GUI scripting

In your SAP gui, goto the options. In the Accessibility & Scripting part, enable the scripting.

At the top part you can see the installation status of scripting tools from SAP itself.

Securing scripting

If you want to securely control which user is allowed to use and execute scripting, you have to set the system parameter sapgui/user_scripting to TRUE. Now any user who is having the authorization object S_SCR is allowed to perform scripting. User who lack the authorization object will cannot run the script.

More information can be found in OSS note 983990 – SAP GUI Scripting security: Enable Scripting per system user. And OSS note 2565390 – SAP GUI Scripting: Changed behavior for combination of profile parameters sapgui/user_scripting_set_readonly and sapgui/user_scripting_per_user.

Security guide for SAP GUI scripting can be found in this link.

Recording and playing an SAP GUI script

You can record a script by going to the button Customize Layout and selecting the option Script Recording and Playback..:

Now the GUI scripting record and playback tool opens:

By pressing record, you can start recording a script. When you are done stop it and save it. You can playback a script with the play button.

Sample applications can be found in OSS note 1441550 – SAP GUI scripting: Sample applications.

More background information

More information can be found in OSS note 2296251 – How can SAP GUI Scripting be enabled?. And 2811334 – Prerequisites to record a SAP Gui Script.

Restrictions of SAP GUI scripting are listed in OSS note 587202 – Restrictions when using SAP GUI Scripting.