Purpose
Use SAP GUI Scripting from GuiXT

General remarks on SAP GUI Scripting
SAP GUI contains a "scripting API": an object model that represents a screen with its controls at runtime. In Windows environment the API can be used from any tool that supports the COM object interface, especially from VB.NET, VBScript and JavaScript. The object model allows one to automate all user actions.

Unlike GuiXT, the SAP GUI scripting approach is not intended to change the screen layout. It completes the GuiXT functionality, allowing us to manipulate special controls (like the grid control), but is restricted to actions that a user is able to do as well.

Documentation of SAP GUI Scripting API
To display the most recent SAP GUI Scripting documentation, click on the options icon in the SAP GUI window and select "SAP GUI scripting help":


Activating SAP GUI scripting
It is necessary to activate scripting support in the SAP system and in the SAP GUI options.

The SAP Profile parameter is

sapgui/user_scripting = TRUE

You can optionally control the use of SAP GUI Scripting on user level. To do this, you specify the SAP Profile parameter:

sapgui/user_scripting_per_user = TRUE

and use the SAP authorization  „S_SCR“.

For further details see the „SAP GUI Scripting Security Guide“.

To activate the scripting in SAP GUI, click on Options->Accessibility & Scripting and tick the "Enable scripting" checkbox:

The settings are kept in the Windows registry:

[HKEY_CURRENT_USER\Software\SAP\SAPGUI Front\SAP Frontend Server\Security]
"UserScripting"=dword:00000001
"WarnOnAttach"=dword:00000000
"WarnOnConnection"=dword:00000000


How to invoke SAP GUI scrpting from GuiXT

  • With InputAssistant use the ApplyGuiScript statement

  • WIth GuiXT Controls you can call up a VB, VBScript or JavaScript function and then invoke SAP GUI scripting, see GUI Scripting in VB and the folowing tip


Alternative to the use of SAP GUI scripting
It is not always possible to have SAP GUI Scripting activated on your SAP Server. In this case, the Native Control Interface of GuiXT Controls is a good alternative for many practical needs.


Components
InputAssistant  (+ Controls depending on the selected solution)