0% found this document useful (0 votes)
8 views

Sap Gui Scripting API

The document is the Developer Guide for the SAP GUI Scripting API, version 8.00 PL07, released on May 13, 2024. It includes detailed information on various objects and components available in the API, such as GuiApplication, GuiButton, and GuiSession, among others. The guide serves as a comprehensive resource for developers working with SAP GUI scripting.

Uploaded by

Dileep Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Sap Gui Scripting API

The document is the Developer Guide for the SAP GUI Scripting API, version 8.00 PL07, released on May 13, 2024. It includes detailed information on various objects and components available in the API, such as GuiApplication, GuiButton, and GuiSession, among others. The guide serves as a comprehensive resource for developers working with SAP GUI scripting.

Uploaded by

Dileep Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 324

Developer Guide | PUBLIC

Document Version: 8.00 PL07 – 2024-05-13

SAP GUI Scripting API


© 2024 SAP SE or an SAP affiliate company. All rights reserved.

THE BEST RUN


Content

1 SAP GUI Scripting API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5


1.1 Requirements and Remarks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8
1.2 Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
GuiAbapEditor Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
GuiApoGrid Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
GuiApplication Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
GuiBarChart Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
GuiBox Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
GuiButton Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
GuiCalendar Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
GuiChart Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
GuiCheckBox Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
GuiCollection Collection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
GuiColorSelector Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
GuiComboBox Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
GuiComboBoxControl Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
GuiComboBoxEntry Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
GuiComponent Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
GuiComponentCollection Collection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
GuiConnection Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
GuiContainer Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
GuiContainerShell Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
GuiCTextField Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
GuiCustomControl Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
GuiDialogShell Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
GuiDockShell Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
GuiEAIViewer2D Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
GuiEAIViewer3D Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
GuiEnum Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105
GuiFrameWindow Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
GuiGOSShell Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
GuiGraphAdapt Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
GuiGridView Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
GuiHTMLViewer Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
GuiInputFieldControl Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
GuiLabel Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

SAP GUI Scripting API


2 PUBLIC Content
GuiMainWindow Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148
GuiMap Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
GuiMenu Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
GuiMenubar Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
GuiMessageWindow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
GuiModalWindow Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163
GuiNetChart Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
GuiOfficeIntegration Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
GuiOkCodeField Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
GuiPasswordField Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174
GuiPicture Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
GuiRadioButton Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180
GuiSapChart Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
GuiScrollbar Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
GuiScrollContainer Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
GuiSession Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
GuiSessionInfo Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
GuiShell Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
GuiSimpleContainer Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210
GuiSplit Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .213
GuiSplitterContainer Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
GuiStage Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
GuiStatusbar Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
GuiStatusBarLink. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .227
GuiStatusPane Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
GuiTab Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
GuiTableColumn Collection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
GuiTableControl Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
GuiTableRow Collection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
GuiTabStrip Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
GuiTextedit Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
GuiTextField. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
GuiTitlebar Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
GuiToolbar Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
GuiToolbarControl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
GuiTree Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263
GuiUserArea Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
GuiUtils Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
GuiVComponent Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
GuiVContainer Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
GuiVHViewSwitch Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288

SAP GUI Scripting API


Content PUBLIC 3
1.3 Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Change Event - Additional Remarks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
1.4 Enumerations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
GuiComponentType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
GuiErrorType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .298
GuiEventType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
GuiImageType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
GuiMagicDispIDs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
GuiMessageBoxOption. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
GuiMessageBoxResult. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
GuiMessageBoxType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
GuiScrollbarType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
GuiTableSelectionType. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316

2 SAP GUI Scripting ROT Entry Helper. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317


2.1 SapGuiAuto Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

3 SAP GUI Scripting ROT Access Helper. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319


3.1 CSapROTWrapper Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .319

SAP GUI Scripting API


4 PUBLIC Content
1 SAP GUI Scripting API

Purpose

In SAP R/3 4.6C active elements ("controls") were introduced in SAP GUI and consumed by many applications.
Since existing automation approaches at that point of time where not able to handle controls and, therefore,
could no longer be used to automate user interaction with modern applications, SAP GUI Scripting was
created.

Here are examples of use cases for SAP GUI Scripting:

• Automatic testing of SAP functionality


• Customized front-end applications replacing the SAP GUI
• Tools to customize applications on the SAP GUI level -> GuiXT
• E-Learning applications that guide a user through SAP transactions

Integration

Many of the available SAP GUI controls were designed exclusively with user interaction in mind. As their
business functionality is closely coupled with the user interface, they cannot be instantiated outside the SAP
GUI in a batch-like fashion.

We therefore decided not to add the business functionality of the SAP GUI controls to a low-level integration
component. Instead the controls run within the SAP GUI, which itself exposes a new interface allowing the
automation of tasks.

Features

We developed an object model representing the SAP GUI at runtime as a hierarchy of objects. Most of these
expose an interface to an element of the user interface. These interfaces can be used to perform all the actions
a user could do with the given element. In addition we offer outgoing interfaces through which an external
application can receive notifications about events occurring within the SAP GUI.

The SAP GUI Scripting API is available in SAP GUI for Windows and SAP GUI for Java. However, SAP GUI for
Java does not support the complete set of objects / methods / properties available in SAP GUI for Windows.
An example is the GuiOfficeIntegration object, which is only available in SAP GUI for Windows ("SAP Desktop
Office Integration").

Available uses for the scripting component include

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 5
• Listening to the actions a user performs in the SAP GUI and record them as a script
• Running a script that emulates user interaction
• Logging the SAP system information, such as response time

Runtime hierarchy overview

Top-level administrative objects


All objects defined in the scripting component's object model are available at runtime as members of a
hierarchical tree with the root object being GuiApplication.

SAP GUI Scripting API


6 PUBLIC SAP GUI Scripting API
The children of the GuiMainWindow are easily identified as the following examples show:

Please note that the availability of some of these objects depends on the design mode used. The titlebar, for
example, is not available in classic design, as can be seen in the following screenshot.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 7
1.1 Requirements and Remarks

SAP System

Scripting support is available for SAP R/3 3.1I, 4.0B, 4.5B, 4.6B, 4.6C, 4.6D, and for all products based on later
versions of SAP_BASIS.

For the releases 3.1I to 6.10 ABAP support packages and SAP kernel patches are available to add the support,
while they are already part of 6.20 and later releases. SAP Note 480149 lists the required patch levels.

The following settings can be used on server side to enable or restrict the scripting capabilities from server
side:

• sapgui/user_scripting
• sapgui/user_scripting_per_user
• sapgui/user_scripting_set_readonly

SAP GUI Scripting API


8 PUBLIC SAP GUI Scripting API
• sapgui/user_scripting_disable_recording
• sapgui/nwbc_scripting

You find more information on these settings in the SAP GUI Scripting Security Guide.

SAP GUI

The scripting interface can be installed with the SAP GUI release 6.20 and later releases. This document is
based on the current release of SAP GUI for Windows. Some of the functionality described here may be missing
in older versions of SAP GUI. Check the documentation belonging to the release you are using.

Remarks

SAP Notes on SAP GUI Scripting

480149 Describes the ABAP and kernel patch level requirements

587202 Limitations of SAP GUI Scripting

619459 SAP GUI Scripting support of SAP applications

692245 Additional server based security options for Scripting

839115 Load test with SAP GUI scripting

983990 SAP GUI Scripting security: Enable Scripting per system


user

1441550 SAP GUI scripting: Sample applications

SAP Support Component for SAP GUI Scripting


• BC-FES-GUI

See also SAP GUI Scripting Security Guide.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 9
1.2 Objects

Classes

Class Module Description

GuiAbapEditor Object [page 17] The GuiAbapEditor object represents the new ABAP editor
control available as of SAP_BASIS release 6.20 (see also
SAP Note 930742). GuiAbapEditor extends GuiShell.

GuiApoGrid Object [page 31] The GuiApoGrid object is component, which is similar to
GuiGridView, but which contains additional SCM specific
functions (used for example in transaction /sapapo/sdp94).
GuiApoGrid extends GuiShell.

GuiApplication Object [page 38] The GuiApplication represents the process in which all SAP
GUI activity takes place. If the scripting component is ac-
cessed by attaching to an SAPlogon process, then GuiAppli-
cation will represent SAPlogon. GuiApplication is a creatable
class. However, there must be only one component of this
type in any process. GuiApplication extends GuiContainer.

GuiBarChart Object [page 48] The GuiBarChart is a powerful tool to display and modify
time scale diagrams.

The object is of a very technical nature. It should only be


used for recording and playback, as most of the parame-
ters cannot be determined in any other way. GuiBarChart
extends GuiShell.

GuiBox Object [page 53] A GuiBox is a simple frame with a name. The items inside
the frame are not children of the box. GuiBox extends GuiV-
Component. The type prefix is box. The name property is the
ABAP fieldname.

GuiButton Object [page 54] GuiButton represents all push buttons that are on dynpros,
the toolbar or in table controls. GuiButton extends GuiV-
Component. The type prefix is btn, the name property is
the fieldname taken from the SAP data dictionary There is
one exception: for tabstrip buttons, it is the button id set in
screen painter that is taken from the SAP data dictionary.

GuiCalendar Object [page 57] The calendar control can be used to select single dates or
periods of time. GuiCalendar extends GuiShell.

GuiChart Object [page 63] The GuiChart object is of a very technical nature. It should
only be used for recording and playback, as most of the
parameters cannot be determined in any other way.

SAP GUI Scripting API


10 PUBLIC SAP GUI Scripting API
Class Module Description

GuiCheckBox Object [page 67] GuiCheckBox extends GuiVComponent. The type prefix is
chk, the name is the fieldname taken from the SAP data
dictionary.

GuiCollection Collection [page 70] GuiCollection is similar to GuiComponentCollection, but its


members are not necessarily extensions of GuiComponent.
It can be used to pass a collection as a parameter to func-
tions of scriptable objects. An object of this class is created
by calling the CreateGuiCollection function of the GuiAppli-
cation.

GuiColorSelector Object [page 72] GuiColorSelector displays a set of colors for selection. It
extends GuiShell.

GuiComboBox Object [page 75] The GuiComboBox looks somewhat similar to GuiCTextField,
but has a completely different implementation. While press-
ing the combo box button of a GuiCTextField will open a
new dynpro or control in which a selection can be made,
GuiComboBox retrieves all possible choices on initialization
from the server, so the selection is done solely on the client.
GuiComboBox extends GuiVComponent. The type prefix is
cmb, the name is the fieldname taken from the SAP data
dictionary.

GuiComboBoxControl Object [page 79] GuiComboboxControl offers a combo box that can be used
inside control containers (unlike the Dynpro element rep-
resented by GuiComboBox). GuiComboBoxControl extends
GuiShell.

GuiComboBoxEntry Object [page 81] Members of the Entries collection of a GuiComboBox are of
type GuiComBoxEntry.

GuiComponent Object [page 82] GuiComponent is the base class for most classes in the
Scripting API. It was designed to allow generic programming,
meaning you can work with objects without knowing their
exact type.

GuiComponentCollection Collection [page 83] The GuiComponentCollection is used for collections ele-
ments such as the children property of containers. Each
element of the collection is an extension of GuiComponent.

GuiConnection Object [page 85] A GuiConnection represents the connection between SAP
GUI and an application server. Connections can be opened
from SAPlogon or from GuiApplication’s openConnection
and openConnectionByConnectionString methods. GuiCon-
nection extends GuiContainer. The type prefix for GuiCon-
nection is con, the name is con plus the connection number
in square brackets.

GuiContainer Object [page 87] This interface resembles GuiVContainer. The only difference
is that it is not intended for visual objects but rather admin-
istrative objects such as connections or sessions. Objects
exposing this interface will therefore support GuiComponent
but not GuiVComponent. GuiContainer extends GuiCompo-
nent.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 11
Class Module Description

GuiContainerShell Object [page 88] A GuiContainerShell is a wrapper for a set of GuiShell ob-
jects. GuiContainerShell extends GuiVContainer. The type
prefix is shellcont, the name is the last part of the id, shell-
cont[n].

GuiCTextField Object [page 90] If the cursor is set into a text field of type GuiCTextField a
combo box button is displayed to the right of the text field.
Pressing this button is equivalent to pressing the F4 key.
The button is not represented in the scripting object model
as a separate object; it is considered to be part of the text
field. There are no other differences between GuiTextField
and GuiCTextField. GuiCTextField extends GuiTextField. The
type prefix is ctxt, the name is the Fieldname taken from the
SAP data dictionary.

GuiCustomControl Object [page 92] The GuiCustomControl is a wrapper object that is used to
place ActiveX controls onto dynpro screens. While GuiCus-
tomControl is a dynpro element itself, its children are of
GuiContainerShell type, which is a container for controls.
GuiCustomControl extends GuiVContainer. The type prefix
is cntl, the name is the fieldname taken from the SAP data
dictionary.

GuiDialogShell Object [page 95] The GuiDialogShell is an external window that is used as a
container for other shells, for example a toolbar. GuiDialog-
Shell extends GuiVContainer. The type prefix is shellcont, the
name is the last part of the id, shellcont[n].

GuiEAIViewer2D Object [page 100] The GuiEAIViewer2D control is used to view 2-dimensional
graphic images in the SAP system. The user can carry
out redlining over the loaded image. The scripting wrapper
for this control records all user actions during the redlin-
ing process and reproduces the same actions when the re-
corded script is replayed.

GuiEAIViewer2D extends GuiShell.

GuiEAIViewer3D Object [page 102] The GuiEAIViewer3D control is used to view 3-dimensional
graphic images in the SAP system. GuiEAIViewer3D extends
GuiShell.

GuiEnum Object [page 105] GuiEnum is the base class for some enumerators used in
SAP GUI Scripting.

GuiFrameWindow Object [page 105] A GuiFrameWindow is a high level visual object in the run-
time hierarchy. It can be either the main window or a mo-
dal popup window. See the GuiMainWindow and GuiModal-
Window sections for examples. GuiFrameWindow itself is an
abstract interface. GuiFrameWindow extends GuiVContainer.
The type prefix is wnd, the name is wnd plus the window
number in square brackets.

GuiGOSShell Object [page 112] The GuiGosShell is only available in New Visual Design
mode. GuiGOSShell extends GuiVContainer. The type prefix
is shellcont, the name is the last part of the id, shellcont[n].

SAP GUI Scripting API


12 PUBLIC SAP GUI Scripting API
Class Module Description

GuiGraphAdapt Object [page 114] For the graphic adapter control only basic members from
GuiShell are available. Recording and playback is not possi-
ble.

GuiGridView Object [page 117] The grid view is similar to the dynpro table control, but sig-
nificantly more powerful. GuiGridView extends GuiShell.

The GuiHTMLViewer is used to display an HTML document


GuiHTMLViewer Object [page 133]
inside SAP GUI. GuiHTMLViewer extends GuiShell.

GuiInputFieldControl Object [page 137] GuiInputFieldControl offers an input field that can be used
inside control containers (unlike the Dynpro element repre-
sented by GuiTextField). GuiInputFieldControl extends Gui-
Shell.

GuiLabel Object [page 140] GuiLabel extends GuiVComponent. The type prefix is lbl, the
name is the fieldname taken from the SAP data dictionary.

GuiMainWindow Object [page 148] This window represents the main window of an SAP GUI
session.

GuiMainWindow extends GuiFrameWindow.

GuiMap Object [page 154] For the map control only basic members from GuiShell are
available. Recording and playback is not possible.

GuiMenu Object [page 157] A GuiMenu may have other GuiMenu objects as children.
GuiMenu extends GuiVContainer. The type prefix is menu,
the name is the text of the menu item. If the item does not
have a text, which is the case for separators, then the name
is the last part of the id, menu[n].

GuiMenubar Object [page 158] Only the main window has a menubar. The children of the
menubar are menus. GuiMenubar extends GuiVContainer.
The type prefix and name are mbar.

GuiMessageWindow [page 160] GuiMessageWindow is a message box displayed by message


showMessageBox of GuiUtils.

GuiModalWindow Object [page 163] A GuiModalWindow is a dialog pop-up.

GuiModalWindow extends GuiFrameWindow.

GuiNetChart Object [page 166] The GuiNetChart is a powerful tool to display and modify
entity relationship diagrams. It is of a very technical nature
and should only be used for recording and playback, as most
of the parameters cannot be determined in any other way.

GuiOfficeIntegration Object [page 169] The GuiOfficeIntegration object (Desktop Office Integration)
offers a container for hosting different kinds of Office appli-
cations (Microsoft Word, Microsoft Excel, Microsoft Power-
point). GuiOfficeIntegration extends GuiShell.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 13
Class Module Description

GuiOkCodeField Object [page 172] The GuiOkCodeField is placed on the upper toolbar of the
main window. It is a combo box into which commands can be
entered. Setting the text of GuiOkCodeField will not execute
the command until server communication is started, for ex-
ample by emulating the Enter key (VKey 0). GuiOkCodeField
extends GuiVComponent. The type prefix is okcd, the name
is empty.

GuiPasswordField Object [page 174] The only difference between GuiTextField and GuiPassword-
Field is that the Text property cannot be read for a password
field. The returned text is always empty. GuiPasswordField
extends GuiTextField. The type prefix is pwd, the name is the
fieldname taken from the SAP data dictionary.

GuiPicture Object [page 176] The picture control displays a picture on an SAP GUI screen.
GuiPicture extends GuiShell.

GuiRadioButton Object [page 180] GuiRadioButton extends GuiVComponent. The type prefix
is rad, the name is the fieldname taken from the SAP data
dictionary.

GuiSapChart Object [page 184] For the SAP chart control only basic members from GuiShell
are available. Recording and playback is not possible.

GuiScrollbar Object [page 186] The GuiScrollbar class is a utility class used for example in
GuiScrollContainer or GuiTableControl.

GuiScrollContainer Object [page 187] This container represents scrollable subscreens. A sub-
screen may be scrollable without actually having a scrollbar,
because the existence of a scrollbar depends on the amount
of data displayed and the size of the GuiUserArea. GuiScroll-
Container extends GuiVContainer. The type prefix is ssub,
the name is generated from the data dictionary settings.

GuiSession Object [page 189] The GuiSession provides the context in which a user per-
forms a certain task such as working with a transaction. It
is therefore the access point for applications, which record
a user’s actions regarding a specific task or play back those
actions. GuiSession extends GuiContainer. The type prefix
is ses, the name is ses plus the session number in square
brackets.

GuiSessionInfo Object [page 203] GuiSessionInfo is a member of all GuiSession objects. It


makes available technical information about the session.
Some of its properties are displayed in the right corner of
the SAP GUI status line.

GuiShell Object [page 207] GuiShell is an abstract object whose interface is supported
by all the controls. GuiShell extends GuiVContainer. The type
prefix is shell, the name is the last part of the id, shell[n].

GuiSimpleContainer Object [page 210] This container represents non-scrollable subscreens. It does
not have any functionality apart from to the inherited inter-
faces. GuiSimpleContainer extends GuiVContainer. The type
prefix is sub, the name is generated from the data dictionary
settings.

SAP GUI Scripting API


14 PUBLIC SAP GUI Scripting API
Class Module Description

GuiSplit Object [page 213] GuiSplit extends GuiShell.

GuiSplitterContainer Object [page 217] The GuiSplitterContainer represents the dynpro splitter ele-
ment, which was introduced in the Web Application Server
ABAP in NetWeaver 7.1. The dynpro splitter element is sim-
ilar to the activeX based splitter control, but it is a plain
dynpro element.

GuiStage Object [page 219] For the stage control only basic members from GuiShell are
available. Recording and playback is not possible.

GuiStatusbar Object [page 222] GuiStatusbar represents the message displaying part of the
status bar on the bottom of the SAP GUI window. It does
not include the system and login information displayed in the
rightmost area of the status bar as these are available from
the GuiSessionInfo object. GuiStatusbar extends GuiVCom-
ponent. The type prefix is sbar.

GuiStatusBarLink [page 227] GuiStatusbarLink represents a so-called “service request


link” that can optionally be displayed in the GuiStatusBar by
an application. Clicking such a link executes an application
specific action, like launching a transaction for reporting a
functional issue. If GuiStatusbarLink is present, it is a child of
the first GuiStatusPane and its name is always link.

GuiStatusPane Object [page 228] The parent of the GuiStatusPane objects is the status bar
(see also GuiStatusbar Object). The GuiStatusPane objects
reflect the individual areas of the status bar, for example
"pane[0]" refers to the section of the status bar where the
messages are displayed.

GuiTab Object [page 230] The GuiTab objects are the children of a GuiTabStrip object.
GuiTab extends GuiVContainer. The type prefix is tabp, the
name is the id of the tab’s button taken from SAP data dic-
tionary.

GuiTableColumn Collection [page 232] GuiTableColumn represents a column in a table control. Gui-
TableColumn extends GuiComponentCollection.

GuiTableControl Object [page 234] The table control is a standard dynpro element, in contrast
to the GuiCtrlGridView, which looks similar. GuiTableControl
extends GuiVContainer. The type prefix is tbl, the name is
the fieldname taken from the SAP data dictionary.

GuiTableRow Collection [page 239] GuiTableRow represents a row in a table control. GuiTa-
bleRow extends GuiComponentCollection.

GuiTabStrip Object [page 240] A tab strip is a container whose children are of type GuiTab.
GuiTabStrip extends GuiVContainer. The type prefix is tabs,
the name is the fieldname taken from the SAP data diction-
ary.

GuiTextedit Object [page 244] GuiTextField extends GuiVComponent. The type prefix is txt,
the name is the fieldname taken from the SAP data diction-
ary.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 15
Class Module Description

GuiTextField [page 250] GuiTextField extends GuiVComponent. The type prefix is txt,
the name is the fieldname taken from the SAP data diction-
ary.

GuiTitlebar Object [page 254] The titlebar is only displayed and exposed as a separate
object in New Visual Design mode. GuiTitlebar extends GuiV-
Container. The type prefix and name of GuiTitlebar are titl.

GuiToolbar Object [page 256] Every GuiFrameWindow has a GuiToolbar. The GuiMain-
Window has two toolbars unless the second has been turned
off by the ABAP application. The upper toolbar is the system
toolbar, while the second toolbar is the application toolbar.

The children of a GuiToolbar are buttons. The indexes for


toolbar buttons are determined by the virtual key values de-
fined for the button.

GuiToolbar extends GuiVContainer. The type prefix and


name are tbar.

GuiToolbarControl [page 258] GuiToolbarControl represents a button bar control that can
host different types of buttons. GuiToolbarControl extends
GuiShell.

GuiTree Object [page 263] This object represents a tree control that can be displayed in
multiple different ways (simple tree, column tree,…). GuiTree
extends GuiShell and

GuiUserArea Object [page 276] The GuiUserArea comprises the area between the toolbar
and statusbar for windows of GuiMainWindow type and the
area between the titlebar and toolbar for modal windows,
and may also be limited by docker controls. The standard
dynpro elements can be found only in this area, with the
exception of buttons, which are also found in the toolbars.

GuiUserArea extends GuiVContainer. The type prefix and


name are usr.

GuiUtils Object [page 279] GuiUtils is a utility class that offers some methods for ac-
cessing files or showing message boxes.

GuiVComponent Object [page 281] The GuiVComponent interface is exposed by all visual ob-
jects, such as windows, buttons or text fields. Like GuiCom-
ponent, it is an abstract interface. Any object supporting the
GuiVComponent interface also exposes the GuiComponent
interface. GuiVComponent extends GuiComponent.

GuiVContainer Object [page 286] An object exposes the GuiVContainer interface if it is both
visible and can have children. It will then also expose Gui-
Component and GuiVComponent. Examples of this interface
are windows and subscreens, toolbars or controls having
children, such as the splitter control. GuiVContainer extends
GuiContainer and GuiVComponent.

SAP GUI Scripting API


16 PUBLIC SAP GUI Scripting API
Class Module Description

GuiVHViewSwitch Object [page 288] GuiVHViewSwitch represents the “View Switch” object that
was introduced with the Belize theme in SAP GUI. The View
Switch is placed in the header area of the SAP GUI main
window and can be used to select different views within an
application.

1.2.1 GuiAbapEditor Object

The GuiAbapEditor object represents the new ABAP editor control available as of SAP_BASIS release 6.20 (see
also SAP Note 930742). GuiAbapEditor extends GuiShell.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 17
Method

Syntax Description

AutoBraceEnabled Returns True if the auto brace facility is currently switched


on.
Public Function AutoBraceEnabled() As
Byte

AutoComplete Invokes the auto complete list box.

Public Sub AutoComplete()

AutoCorrectEnabled Returns True if the auto correct facility is currently switched


on.
Public Function AutoCorrectEnabled()
As Byte

AutoExpand Invokes the auto expand code template mechanism.

Public Sub AutoExpand()

AutoIndentEnabled Returns True if the auto indent facility is currently switched


on.
Public Function AutoIndentEnabled()
As Byte

Capitalize Makes the first alphabetic character of each word in the


selected text uppercase. All other characters are made lower
Public Sub Capitalize()
case.

ClipboardCopy Performs a clipboard copy operation on the currently se-


lected text.
Public Sub ClipboardCopy()

ClipboardCut Performs a clipboard cut operation on the currently selected


text.
Public Sub ClipboardCut()

ClipboardPaste Pastes the current contents of the clipboard beginning from


the current cursor position.
Public Sub ClipboardPaste()

ClipboardRingPaste Pastes an entry from the editor's clipboard ring to the editor.
Index : One-based index of the clipboard entry as it appears
Public Sub ClipboardRingPaste( _
ByVal Index As Long _ in the ABAP editor context menu.
)

CodeHintsEnabled Returns True if code hints are currently enabled.

Public Function CodeHintsEnabled() As


Byte

SAP GUI Scripting API


18 PUBLIC SAP GUI Scripting API
Method

Syntax Description

CommentSelectedLines Encloses the selected lines in comments.

Public Sub CommentSelectedLines()

CorrectCapsEnabled Returns True if the correct caps function is currently


switched on.
Public Function CorrectCapsEnabled()
As Byte

Delete Deletes the character, which proceeds the current cursor


position. Equivalent to pressing the <DEL> key.
Public Sub Delete()

DeleteBack Moves the cursor to the previous column, deleting the char-
acter currently residing there. Equivalent to pressing the
Public Sub DeleteBack()
backspace key.

DeleteRange Defines a region of text for deletion.

Public Sub DeleteRange( _ • LineStart specifies the line number from where deletion
ByVal LineStart As Long, _ is to begin.
ByVal ColumnStart As Long, _
ByVal LineEnd As Long, _ • ColumnStart (p2) specifies the number of the column
ByVal ColumnEnd As Long _ from where deletion is to begin.
)
• LineEnd (p3) specifies the number of the line where
deletion will end.
• ColumnEnd (p4) specifies the number of the column
where deletion will end.

DeleteSelection Deletes the currently selected text.

Public Sub DeleteSelection()

DeleteWord Deletes the word, which proceeds the current character po-
sition.
Public Sub DeleteWord()

DeleteWordBack Deletes the word, which precedes the current cursor posi-
tion.
Public Sub DeleteWordBack()

DuplicateLine Takes the contents of the line upon which the cursor cur-
rently resides and inserts a copy of the line contents on the
Public Sub DuplicateLine()
line below the cursor.

FormatSelectedLines Formats the selected lines according to "Pretty Printer" and


"Formatting" settings e.g. Auto Indent, Smart Tab.
Public Sub FormatSelectedLines()

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 19
Method

Syntax Description

GetAutoCompleteEntryCount Returns the number of available entries displayed in the auto


completion list box.
Public Function
GetAutoCompleteEntryCount() As Long

GetAutoCompleteEntryText Returns a string representing the auto completion list box


entry corresponding to the index supplied as a parameter.
Public Function
GetAutoCompleteEntryText( _
ByVal Index As Long _
) As String

GetAutoCompleteIconType Returns the index of the image associated with the auto
complete entry specified in Index. Returns -1 if no image is
Public Function
GetAutoCompleteIconType( _ associated.
ByVal Index As Long _
) As String

GetAutoCompleteSubIconType Returns the index of the sub image associated with the auto
complete entry specified in Index. Returns -1 if no sub image
Public Function
GetAutoCompleteSubIconType( _ is associated.
ByVal Index As Long _
) As String

GetAutoCompleteToolbarButtonToolTip Returns the tooltip text, which is displayed by the autocom-


plete toolbar button specified in Index.
Public Function
GetAutoCompleteToolbarButtonToolTip( _
ByVal Index As Long _
) As String

GetAutoCompleteToolTipDelay Returns the number of milliseconds, which elapse between


highlighting an entry in the autocomplete listbox and the
Public Function
GetAutoCompleteToolTipDelay() As Long appearance of the corresponding tooltip window.

GetCurrentToolTipText Retrieves the text in the currently displayed code hint or


autocomplete listbox tooltip window. Multiple lines are sepa-
Public Function
GetCurrentToolTipText() As String rated with \n characters.

GetCursorColumnPosition Returns the column number in which the cursor currently


resides.
Public Function
GetCursorColumnPosition() As Long

SAP GUI Scripting API


20 PUBLIC SAP GUI Scripting API
Method

Syntax Description

GetCursorLinePosition Returns the number of the line upon which the cursor cur-
rently resides.
Public Function
GetCursorLinePosition() As Long

GetFirstVisibleLine Returns the line number of the top-most visible line in the
current editor session.
Public Function GetFirstVisibleLine()
As Long

GetHTMLClipboardContents Returns a string containing the current contents of the clip-


board in HTML format. Returns an empty string if the clip-
Public Function
GetHTMLClipboardContents() As String board does not contain anything in HTML format.

GetLastVisibleLine Returns the line number of the bottom-most visible line in


the current editor session.
Public Function GetLastVisibleLine()
As Long

GetLineCount Returns the total number of lines contained in the document


in the current session.
Public Function GetLineCount() As Long

GetLineText Returns a string containing the contents of the line number


specified as a parameter.
Public Function GetLineText( _
ByVal Line As Long _
) As String

GetNumberedBookmarks Returns a collection of bookmark numbers assigned to the


line number passed as a parameter. The number of the
Public Function
GetNumberedBookmarks( _ bookmark can range from 0 to 9. If no numbered bookmark
ByVal Line As Long _ is assigned then the collection is empty.
) As Object

GetRTFClipboardContents Returns a string containing the current contents of the clip-


board in Rich Text format. Returns an empty string if the
Public Function
GetRTFClipboardContents() As String clipboard does not contain anything in Rich Text format.

GetSelectedAutoComplete Returns the zero based index of the currently selected entry
in the auto completion list box. The method will return -1 if no
Public Function
GetSelectedAutoComplete() As Long entry is selected.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 21
Method

Syntax Description

GetSelectedText Returns a string containing the text currently highlighted


or selected in the editor session. If the selected text spans
Public Function GetSelectedText() As
String more than one line then any line terminator characters will
be included in the string returned by this method.

GetStructureBlockEndLine Returns the end line of the structure block relevant to the
line number passed to the method. If the line does not reside
Public Function
GetStructureBlockEndLine( _ within a structure block at all then the method returns -1.
ByVal Line As Long _
) As Long

GetStructureBlockStartLine Returns the start line of the structure block relevant to the
line number passed to the method. If the line resides within a
Public Function
GetStructureBlockStartLine( _ nested block then the start line of the innermost block will be
ByVal Line As Long _ returned. If the line does not reside within a structure block
) As Long at all then the method returns -1.

GetUndoPosition Returns the current position of the document in the undo/


redo buffer.
Public Function GetUndoPosition() As
Long

GetWordWrapMode Returns an integer corresponding to the currently set Word


wrap mode:
Public Function GetWordWrapMode() As
Long • 0 - Word wrap disabled.
• 1 - Wrap at edge of window.
• 2 - Wrap by page width.
• 3 - Wrap by page width inserting hard break.

GetWordWrapPosition Returns the current page width assigned to word wrap. The
number returned is the number of columns after which word
Public Function GetWordWrapPosition()
As Long wrap will be applied.

GoNextBookMark Navigates to the line where the next none numbered book-
mark is set.
Public Sub GoNextBookMark()

GoNumberedBookmark Navigates to the line where the bookmark numbered Mark


resides.
Public Sub GoNumberedBookmark( _
ByVal Mark As Long _
)

SAP GUI Scripting API


22 PUBLIC SAP GUI Scripting API
Method

Syntax Description

GoPreviousBookMark Navigates to the line where the previous none numbered


bookmark is set.
Public Sub GoPreviousBookMark()

InsertTab Inserts a TAB at the current cursor position. Equivalent to


pressing the TAB key.
Public Sub InsertTab()

InsertText Places the text specified in Text at the position specified in


Line and Column as if the text had been typed into the editor
Public Sub InsertText( _
ByVal Text As String, _ from the keyboard.
ByVal Line As Long, _
ByVal Column As Long _
)

IsAutoCompleteEntryBold Returns True if the auto complete entry specified in Index is


bold.
Public Function
IsAutoCompleteEntryBold( _
ByVal Index As Long _
) As Byte

IsAutoCompleteOpen Returns True if the auto completion list box is currently open.

Public Function IsAutoCompleteOpen()


As Byte

IsAutoCompleteToolbarButtonPressed Returns True if the autocomplete toolbar button specified in


Index is currently pressed. Otherwise False is returned.
Public Function
IsAutoCompleteToolbarButtonPressed( _
ByVal Index As Long _
) As Byte

IsAutoCompleteToolTipVisible Returns True if the tooltip corresponding to an entry in the


auto complete listbox is currently visible.
Public Function
IsAutoCompleteToolTipVisible() As Byte

IsBookmark Returns True if the line is bookmarked with a standard book-


mark which is not numbered. The method does not provide
Public Function IsBookmark( _
ByVal Line As Long _ information about whether the line is marked using a num-
) As Byte bered bookmark.

IsBreakpointSet Returns True if a breakpoint is set on the line number passed


in as a parameter.
Public Function IsBreakpointSet( _
ByVal Line As Long _
) As Byte

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 23
Method

Syntax Description

IsLineCollapsed Returns True if the line number passed to it corresponds to


a line, which signifies the beginning of a collapsible block,
Public Function IsLineCollapsed( _
ByVal Line As Long _ which is currently in the collapsed state.
) As Byte

IsLineComment Returns True if the line number specified in Line contains


comments. Otherwise False is returned.
Public Function IsLineComment( _
ByVal Line As Long _
) As Byte

IsLineModified Returns True if the line has been modified during the course
of the current editor session.
Public Function IsLineModified( _
ByVal Line As Long _
) As Byte

IsModified Returns True if any part of the current document has been
modified during \ the course of the current editor session.
Public Function IsModified() As Byte

JoinSelectedLines Merges currently selected lines of text into a single line of


text.
Public Sub JoinSelectedLines()

LowerCase Forces selected text into lower case.

Public Sub LowerCase()

MoveCursorDocumentEnd Positions the cursor in the last column of the very last line of
the document.
Public Sub MoveCursorDocumentEnd()

MoveCursorLineDown Moves the cursor down one line from its current position.

Public Sub MoveCursorLineDown()

MoveCursorLineEnd Positions the cursor in the last column of the current line.

Public Sub MoveCursorLineEnd()

MoveCursorLineHome Positions the cursor in the first column of the current line.

Public Sub MoveCursorLineHome()

MoveCursorLineUp Moves the cursor up one line from its current position.

Public Sub MoveCursorLineUp()

SAP GUI Scripting API


24 PUBLIC SAP GUI Scripting API
Method

Syntax Description

MoveLineDown Moves the contents of the line where the cursor resides to
the line below and moves the contents of the line below the
Public Sub MoveLineDown()
cursor up one line.

MoveLineUp Moves the contents of the line where the cursor resides to
the line above and moves the contents of the line above the
Public Sub MoveLineUp()
cursor down one line.

MoveWordLeft Moves the cursor to the column preceding the next word
found to the left of the cursor's current position.
Public Sub MoveWordLeft()

MoveWordRight Moves the cursor to the column preceding the next word
found to the right of the cursor's current position.
Public Sub MoveWordRight()

OverwriteModeEnabled Returns True if Overwrite mode is enabled, False if in Insert


mode.
Public Function
OverwriteModeEnabled() As Byte

RemoveAllBookmarks Removes all types of bookmarks from the document. Both


numbered and none numbered bookmarks are removed.
Public Sub RemoveAllBookmarks()

RemoveAllBreakpoints Removes all breakpoints from the current document.

Public Sub RemoveAllBreakpoints()

RemoveBookmarks Removes all bookmarks specified in the supplied string.

Public Sub RemoveBookmarks( _


ByVal Bookmarks As String _
)

RemoveBreakpoint Removes the breakpoint on line number Line.

Public Sub RemoveBreakpoint( _


ByVal Line As Long _
)

ReplaceSelection Replaces the currently selected text with the text contained
in the Text parameter.
Public Sub ReplaceSelection( _
ByVal Text As String _
)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 25
Method

Syntax Description

SaveToFile

Public Sub SaveToFile( _


ByVal p1 As String _
)

ScrollToLine Scrolls to the line number specified in Line if not already


visible on the screen.
Public Sub ScrollToLine( _
ByVal Line As Long _
)

SelectAll Highlights all text in the current document for selection.

Public Sub SelectAll()

SelectBlockRange Highlights a region of text in block mode for selection. Equiv-


alent to holding down the ALT key while dragging the mouse
Public Sub SelectBlockRange( _
ByVal LineStart As Long, _ over the text.
ByVal ColumnStart As Long, _
ByVal LineEnd As Long, _ • LineStart specifies the line number from where selec-
ByVal ColumnEnd As tion is to begin.
Long _
) • ColumnStart specifies the number of the column from
where selection is to begin.
• LineEnd specifies the number of the line where selec-
tion will end.
• ColumnEnd specifies the number of the column where
selection will end.

SelectRange Highlights a region of text for selection.

Public Sub SelectRange( _ • LineStart specifies the line number from where selec-
ByVal LineStart As Long, _ tion is to begin.
ByVal ColumnStart As Long, _
ByVal LineEnd As Long, _ • ColumnStart specifies the number of the column from
ByVal ColumnEnd As where selection is to begin.
Long _
) • LineEnd specifies the number of the line where selec-
tion will end.
• ColumnEnd specifies the number of the column where
selection will end.

SelectWordLeft Selects the word to the left of the current cursor position.

Public Sub SelectWordLeft()

SelectWordRight Selects the word to the right of the current cursor position.

Public Sub SelectWordRight()

SAP GUI Scripting API


26 PUBLIC SAP GUI Scripting API
Method

Syntax Description

Sentencize Makes the first character of each sentence upper case. Sen-
tences are delimited by "." characters. All other characters
Public Sub Sentencize()
are made lower case.

SetAutoBrace Switches the auto brace facility on or off.

Public Sub SetAutoBrace( _


ByVal Status As Byte _
)

SetAutoCorrect Switches the auto complete facility on or off.

Public Sub SetAutoCorrect( _


ByVal Status As Byte _
)

SetAutoIndent Switches the auto indent facility on or off.

Public Sub SetAutoIndent( _


ByVal Status As Byte _
)

SetBookmarks Set bookmarks.

Public Sub SetBookmarks( _ Takes a string of the following format:


ByVal Bookmarks As String _
) <line>[(<no>)][,<line>] e.g. "10(1),22(2),33,42",
<line>={1,...,n}, <no>={1,...

SetBreakpoint Sets a breakpoint on line number Line.

Public Sub SetBreakpoint( _


ByVal Line As Long _
)

SetCodeHints Switches code hints on or off.

Public Sub SetCodeHints( _


ByVal Status As Byte _ )

SetCorrectCaps Switches the caps correction feature on or off.

Public Sub SetCorrectCaps( _


ByVal Status As Byte _
)

SetLineFeedStyle

Public Sub SetLineFeedStyle( _


ByVal p1 As Long _
)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 27
Method

Syntax Description

SetOverwriteMode Switches between Insert and Overwrite modes. If called with


True then Overwrite mode is enabled. Otherwise the editor is
Public Sub SetOverwriteMode( _
ByVal Status As Byte _ in Insert mode.
)

SetSelectionPosInLine Places the cursor on line <Line> and column <Column>.

Public Sub SetSelectionPosInLine( _


ByVal Line As Long, _
ByVal Column As
Long _
)

SetSmartTab Switches the smart tab facility on or off.

Public Sub SetSmartTab( _


ByVal Status As Byte _
)

SetWordWrapMode Sets the word wrap mode according to the number supplied
in Mode:
Public Sub SetWordWrapMode( _

)
ByVal Mode As Long _ • 0 - Word wrap disabled.
• 1 - Wrap at edge of window.
• 2 - Wrap by page width.
• 3 - Wrap by page width inserting hard break.

SetWordWrapPosition Pos specifies the number of columns to be displayed before


word wrap is applied.
Public Sub SetWordWrapPosition( _
ByVal Pos As Long _
)

SmartTabEnabled Switches the smart tab facility on or off.

Public Function SmartTabEnabled() As


Byte

SortSelectedLines Rearranges the selected lines in alphanumeric order.

Public Sub SortSelectedLines()

SwapCase Inverts the case setting for the selected text. Upper case
characters are switched to lower case and vice versa.
Public Sub SwapCase()

SAP GUI Scripting API


28 PUBLIC SAP GUI Scripting API
Method

Syntax Description

ToggleCapsLock Switches caps lock on or off.

Public Sub ToggleCapsLock()

ToggleNumberedBookmark Toggles the state of the numbered bookmark Mark on line


Line. If a book mark with the number Mark already exists on
Public Sub ToggleNumberedBookmark( _
ByVal Mark As Long, _ Line then it will be removed. Otherwise it will be added.
ByVal Line As
Long _
)

ToggleStructureBlock If the line number specified in Line is the first line of a


collapsible block of code then this method will toggle the
Public Sub ToggleStructureBlock( _
ByVal Line As Long _ expanded/collapsed status of the block.
)

TransposeLine Swaps the contents of the line where the cursor currently
resides with the contents of the line above the current cursor
Public Sub TransposeLine()
position.

UncommentSelectedLines Removes comments from the selected lines.

Public Sub UncommentSelectedLines()

Undo Performs either an undo or a redo depending on UndoPo-


sition. UndoPosition specifies a zero based position in the
Public Sub Undo( _
ByVal UndoPosition As Long _ undo/redo buffer. If -1 is passed then a single step undo is
) preformed.

UnTab Removes a TAB at the current cursor position. Equivalent to


pressing <SHIFT> + <TAB>.
Public Sub UnTab()

UpperCase Forces selected text into upper case.

Public Sub UpperCase()

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 29
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

SAP GUI Scripting API


30 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

1.2.2 GuiApoGrid Object

The GuiApoGrid is an object specifically created for SAP SCM applications. It implements a planning board,
which is similar to a GuiGridView control. GuiApoGrid extends GuiShell.

Remarks

The columns and rows are identified by their position starting with zero:

0 <= row < RowCount

0 <= column < ColumnCount

After a drill-down the rows are re-numbered so that the row number of any given row may change. Scrolling
horizontally does not affect the number of a column.

Example

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 31
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

CancelCut Abort the cut operation.

Public Sub CancelCut()

ClearSelection Calling clearSelection removes all row, column and cell se-
lections.
Public Sub ClearSelection()

ContextMenu Calling contextMenu emulates the context menu request.

Public Sub ContextMenu( _


ByVal Column As Long, _
ByVal Row As
Long _
)

Cut Cut the selected cells.

Public Sub Cut()

SAP GUI Scripting API


32 PUBLIC SAP GUI Scripting API
Method

Syntax Description

DeselectCell Deselect the specified cells. This function removes the


specified cells from the collection of selected cells.
Public Sub DeselectCell( _
ByVal Column As Long, _
ByVal Row As Long _
)

DeselectColumn This function removes the specified column from the collec-
tion of the selected columns.
Public Sub DeselectColumn( _
ByVal Column As Long _
)

DeselectRow This function removes the specified row from the collection
of the selected rows.
Public Sub DeselectRow( _
ByVal Row As Long _
)

DoubleClickCell This function emulates a mouse double-click on a given cell


if the parameters are valid and raises an exception other-
Public Sub DoubleClickCell( _
ByVal Column As Long, _ wise.
ByVal Row As
Long _
)

GetBgdColorInfo This function returns the background color of the specified


cell.
Public Function GetBgdColorInfo( _
ByVal Row As Long, _
ByVal Column As Long _
) As String

GetCellChangeable This function returns True if the specified cell is editable.

Public Function GetCellChangeable( _


ByVal Column As Long, _
ByVal Row As Long _
) As Byte

GetCellFormat

Public Function GetCellFormat( _


ByVal Column As Long, _
ByVal Row As Long _
) As String

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 33
Method

Syntax Description

GetCellTooltip This function returns the tooltip of the specified cell.

Public Function GetCellTooltip( _


ByVal Column As Long, _
ByVal Row As Long _
) As String

GetCellValue This function returns the value of the specified cell as a


string.
Public Function GetCellValue( _
ByVal Column As Long, _
ByVal Row As Long _
) As String

GetFgdColorInfo This function returns the font color of the specified cell.

Public Function GetFgdColorInfo( _


ByVal Row As Long, _
ByVal Column As Long _
) As String

GetIconInfo

Public Function GetIconInfo( _


ByVal Row As Long, _
ByVal Column As Long _
) As String

IsCellSelected Returns True if the specified cell is selected.

Public Function IsCellSelected( _


ByVal Column As Long, _
ByVal Row As Long _
) As Byte

IsColSelected Returns True if the specified column is selected.

Public Function IsColSelected( _


ByVal col As Long _
) As Byte

IsRowSelected Returns True if the specified row is selected.

Public Function IsRowSelected( _


ByVal Row As Long _
) As Byte

SAP GUI Scripting API


34 PUBLIC SAP GUI Scripting API
Method

Syntax Description

Paste Triggers a paste operation.

Public Function Paste( _


ByVal CellValues As Object, _
ByVal ColumnCount As Long _
) As Long

PressEnter This emulates pressing the Enter key.

Public Sub PressEnter()

SelectAll This function selects the whole grid content (i.e. all rows and
all columns).
Public Sub SelectAll()

SelectCell Select the specified cell.

Public Sub SelectCell( _


ByVal Column As Long, _
ByVal Row As
Long _ )

SelectColumn Select the specified column.

Public Sub SelectColumn( _


ByVal Column As Long _
)

SelectRow Select the specified row.

Public Sub SelectRow( _


ByVal Row As Long _
)

SetCellValue This function enters the specified value in the specified cell.

Public Function SetCellValue( _


ByVal Column As Long, _
ByVal Row As Long, _
ByVal Value As String _
) As String

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 35
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

SAP GUI Scripting API


36 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiContainer Object [page 87]:

• Children

ColumnCount (Read-only) This property represents the number of columns in the con-
trol.
Public Property ColumnCount As Long

CurrentCellColumn (Read-only) The index of the column that contains the current cell.

Public Property CurrentCellColumn As


Long

CurrentCellRow (Read-only) The row index of the current cell ranges from 0 to the num-
ber of rows less 1, with -1 being the index of the title row.
Public Property CurrentCellRow As Long

FirstVisibleColumn (Read-only) This property represents the first visible column of the scrol-
lable area of the APOGrid control.
Public Property FirstVisibleColumn As
Long

FirstVisibleRow (Read-only) This is the index of the first visible row in the grid. Setting
this property to an invalid row index will raise an exception.
Public Property FirstVisibleRow As
Long

FixedColumnsLeft (Read-only) The number of fixed columns at the left side of the grid.

Public Property FixedColumnsLeft As


Long

FixedColumnsRight (Read-only) The number of fixed columns at the right side of the grid.

Public Property FixedColumnsRight As


Long

FixedRowsBottom (Read-only) The number of fixed rows at the bottom of the grid.

Public Property FixedRowsBottom As


Long

FixedRowsTop (Read-only) The number of fixed rows at the top of the grid.

Public Property FixedRowsTop As Long

RowCount (Read-only) This property represents the number of rows in the control.

Public Property RowCount As Long

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 37
Property

Syntax Description

SelectedCells (Read-only) The collection of selected cells. Trying to set this property to
an invalid value will raise an exception.
Public Property SelectedCells As
Object

SelectedColumns (Read-only) The selected columns are available as a collection. Setting


this property can raise an exception, if the new collection
Public Property SelectedColumns As
String contains an invalid column.

SelectedColumnsObject (Read-only)

Public Property SelectedColumnsObject


As Object

SelectedRows (Read-only) The selected rows are available as a collection. Setting this
property can raise an exception, if the new collection con-
Public Property SelectedRows As String
tains an invalid row.

SelectedRowsObject (Read-only)

Public Property SelectedRowsObject As


Object

VisibleColumnCount (Read-only) Retrieves the number of visible columns of the grid.

Public Property VisibleColumnCount As


Long

VisibleRowCount (Read-only) Retrieves the number of visible rows of the grid.

Public Property VisibleRowCount As


Long

1.2.3 GuiApplication Object

Description

The GuiApplication represents the process in which all SAP GUI activity takes place. If the scripting
component is accessed by attaching to an SAP Logon process, then GuiApplication will represent SAP Logon.
GuiApplication is a creatable class. However, there must be only one component of this type in any process.
GuiApplication extends the GuiContainer Object [page 87].

SAP GUI Scripting API


38 PUBLIC SAP GUI Scripting API
Remarks

When running a recorded script in Excel you may receive an error message 'Invalid use of property'. This may
be caused by a name collision for the 'application' object. In Excel this name is predefined, and it will collide
with the code generated by the SAP GUI Scripting recorder. To fix the problem, rename the SAP GUI application
object.

Example

 Example

You can instantiate an SAP GUI application object using CreateObject.

Rem Create the GuiApplication object


Set Application = CreateObject( "Sapgui.ScriptingCtrl.1")
Rem Open a connection in synchronous mode
Set Connection = Application.OpenConnection( "U9C [PUBLIC]", True)
Set Session = Connection.Children(0)
Rem Do something: Either fill out the login screen
Rem or in case of Single-Sign-On start a transaction.
Session.SendCommand( "/nbibs")
MsgBox "Waiting..."
Rem Shutdown the connection
Set Session = Nothing
Connection.CloseSession( "ses[0]")
Set Connection = Nothing
Rem Wait a bit for the connection to be closed completely
Wscript.Sleep 1000
Set Application = Nothing
MsgBox "Done"

 Example

You can attach to a running instance of SAP GUI through the Running Object Table.

Rem Get the application object from the Running Object Table
Set rotEntry = GetObject( "SAPGUI")
Set application = rotEntry.GetScriptingEngine
Rem Get the first session of the first connection
Rem You may have to adjust this to access a different session
Set connection = application.Children(0)
Set session = connection.Children(0)
Rem Start a transaction
session.findById( "wnd[0]/tbar[0]/okcd").text = "/nbibs"
session.findById( "wnd[0]").sendVKey 0

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 39
Methods

Method

Syntax Description

All methods of the GuiContainer Object [page 87]:

• FindById

AddHistoryEntry SAP GUI for Windows has an input history functionality,


which displays for text fields the entries made in the past
Public Function AddHistoryEntry( _
ByVal Fieldname As String, _ as a suggestion. With this function, an entry can be added
ByVal Value As String _ to the history database so that it will be available the next
) As Byte time the end user accesses the text field with the given field
name.

CreateGuiCollection Some functions accept collections as parameters. This func-


tion creates a collection object that is independent of the
Public Function CreateGuiCollection()
As Object scripting language used, such as VBScript or JavaScript.

DropHistory Calling this function will delete all entries from the input his-
tory. The function returns True if the history data have been
Public Function DropHistory() As Byte
deleted successfully.

Attention: After dropping the history database, it cannot be


restored. Therefore this function must be used with caution.

Ignore eCATT uses this function to prevent scripts from accessing


the session in which eCATT itself runs. Otherwise the token
Public Sub Ignore( _
ByVal WindowHandle As Integer _ handling would cause a dead lock.
)

SAP GUI Scripting API


40 PUBLIC SAP GUI Scripting API
Method

Syntax Description

OpenConnection The parameter Description should contain one of the de-


scriptions displayed in SAP Logon, for example "XYZ [PUB-
Public Function OpenConnection( _
ByVal Description As String, _ LIC]". If you want to create a new SAP GUI instance and
Optional ByVal Sync As Variant, _ place it within your application you may add the suffix “/IN-
Optional ByVal Raise As Variant _ PLACE”.
) As GuiConnection
This function will raise the exception E_ACCESSDENIED if
the scripting support has been disabled by the administrator
or the user.

Remark: When opening connections manually SAP GUI exe-


cutes the request asynchronously, so that the SAP Logon di-
alog remains responsive after requesting a new connection.
This behaviour is also the default for SAP GUI Scripting.
In the Scripting context it means that the call to openCon-
nection may return before the new connection has been
opened. A side effect of this is that when opening a con-
nection fails SAP GUI displays an error popup that cannot
be handled from the script. This problem can be solved by
setting the sync parameter to True. Then the call to open-
Connection will not return until a connection has been es-
tablished, or an error has been detected. If sync is set to
True and an error occurs an exception is raised, unless the
parameter raise is set to False.

OpenConnectionByConnectionString The parameter ConnectString is the connection string for


the SAP server, for example “/R/ALR/G/SPACE”. See the
Public Function
OpenConnectionByConnectionString( _ description of the openConnection method for a discus-
ByVal ConnectString As String, _ sion of the sync and raise parameters.
Optional ByVal Sync As Variant, _
Optional ByVal Raise As Variant _ For detailed information refer to Method OpenConnection-
) As GuiConnection ByConnectionString [page 45].

RegisterROT Accessing the SAPGUI entry in the Running Object Table


from a C++ application may fail unless the interface is reg-
Public Function RegisterROT() As Byte
istered with a strong reference. This is not required when
using Visual Basic or scripting languages. The reference
must be released using revokeRot before shutting down
the Scripting component. Failing to do so will lead to unde-
fined behaviour. Most applications do not need to use this
method, and shouldn’t call it.

RevokeROT This method must be called before shutting down the Script-
ing component if registerROT was used.
Public Sub RevokeROT()

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 41
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

ActiveSession (Read-only) Returns the Session that the user is currently working with,
which will be the topmost window.
Public Property ActiveSession As
Object

AllowSystemMessages (Read-write) System messages are displayed when an administrator in-


vokes them on the server to send a notification to users
Public Property AllowSystemMessages
As Byte currently logged in. This may happen at any time and inter-
fere with the recording or playback of a script. Setting this
property to FALSE will prevent system messages from being
displayed.

ButtonbarVisible (Read-write) Setting this property to FALSE hides the application toolbar
of the main window for newly opened connections.
Public Property ButtonbarVisible As
Byte

Children (Read-only) The Children of GuiApplication are the connections (type


GuiConnection) opened in the GuiApplication.
Public Property Children As
GuiComponentCollection

ConnectionErrorText (Read-only) This property contains the text of a connection error mes-
sage. If openConnection fails, you can retrieve informa-
Public Property ConnectionErrorText
As String tion about the cause of the failure from this property.

Connections (Read-only) This property is another name for the Children property.
It has been added for better readability as all the children of
Public Property Connections As
GuiComponentCollection GuiApplication are connections.

SAP GUI Scripting API


42 PUBLIC SAP GUI Scripting API
Property

Syntax Description

HistoryEnabled (Read-write) The local history function can be enabled or disabled using
this property. Disabling it will significantly improve the per-
Public Property HistoryEnabled As Byte
formance of SAP GUI, which may be crucial during load
tests, for example.

MajorVersion (Read-only) Version of the SAP GUI release, for example ‘7.60’.

Public Property MajorVersion As Long

MinorVersion (Read-only) Build number of the scripting component.

Public Property MinorVersion As Long

NewVisualDesign (Read-only) Returns whether New Visual Design or Classic mode are
used for the user interface.
Public Property NewVisualDesign As
Byte

Patchlevel (Read-only) Patchlevel of SAP GUI.

Public Property Patchlevel As Long

Revision (Read-only) Revision of the SAP GUI release. In SAP GUI for Windows this
is the compilation number.
Public Property Revision As Long

StatusbarVisible (Read-write) Setting this property to FALSE hides the status bar of the
main window for newly opened connections.
Public Property StatusbarVisible As
Byte

TitlebarVisible (Read-write) Setting this property to FALSE hides the titlebar of the main
window for newly opened connections.
Public Property TitlebarVisible As
Byte

ToolbarVisible (Read-write) Setting this property to FALSE hides the system toolbar of
the main window for newly opened connections.
Public Property ToolbarVisible As Byte

Utils (Read-only) This property returns a global GuiUtils object.

Public Property Utils As GuiUtils

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 43
Events

Event

Syntax Description

CreateSession This event is raised whenever a new session is created, irre-


spective of whether of the session being created manually,
Public Event CreateSession( _
ByVal Session As GuiSession _ from ABAP or by a script. The event is only raised for a
) session if the scripting support has been enabled for the
corresponding backend.

 Example
The following script attaches itself to the SAPlogon
process and displays a pop-up whenever a new session
is created.

Dim objSapGui
Set objSapGui = GetObject("SAPGUI")
Dim objScriptingEngine
Set objScriptingEngine =
objSapGui.GetScriptingEngine
WScript.ConnectObject
objScriptingEngine, "Engine_"
Dim Waiting
Waiting = 1
Do While (Waiting = 1)
WScript.Sleep(100)
Loop
Set objScriptingEngine = Nothing
Set objSapGui = Nothing
Sub Engine_CreateSession(ByVal
Session)
Dim result
result = MsgBox("Session
created", vbOKCancel)
If result = vbCancel then
Waiting = 0
End If
End Sub

SAP GUI Scripting API


44 PUBLIC SAP GUI Scripting API
Event

Syntax Description

DestroySession This event is raised before a session is destroyed . This can


be done either by closing the main window manually, or by
Public Event DestroySession( _
ByVal Session As GuiSession _ calling the closeSession method of GuiConnection.
)
 Example
You can handle this event from VBScript by adding the
following procedure to the sample script on previous
page:

Sub Engine_DestroySession(ByVal
Session)
Dim result
result = MsgBox("Session
destroyed",vbOKCancel)
If result = vbCancel then
Waiting = 0
End If
End Sub

Error An error event is currently only raised, if the wrapper library


required to access a SAP GUI ActiveX control from a script is
Public Event Error( _
ByVal ErrorId As Long, _ not available. This event is also available on the GuiSession
ByVal Desc1 As String, _ in which the error occurred.
ByVal Desc2 As String, _
ByVal Desc3 As String, _
ByVal Desc4 As String _
)

IgnoreSession The event is fired when a session is set to ‘Ignored’ using


IgnoreSession function. This event is only fired when using
Public Event IgnoreSession( _
ByVal SessionMainWindowHandle As SAP GUI Scripting while running eCATT in parallel.
Integer _
)

1.2.3.1 Method OpenConnectionByConnectionString

Connection Strings

Connection String is a technical term used within SAP GUI. A connection string describes a connection address
for a destination, e.g. an SAP system's application server, similar to an Internet URL describes a location for a
web page.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 45
Simple Connection Strings

In its simplest form, a connection string contains an IP address and a port number. This information is
sufficient for SAP GUI to open a direct TCP connection to a destination, e.g. an application server. IP address
and port number are marked with the prefixes '/H/' (for host) and '/S/' (for service). Note that the port
number for an SAP application server is by convention 3200 plus the two-digit SAP system number.

 Example

Example for a simple connection string with an application server's IP address (172.16.64.17) and port
number (3200):

/H/172.16.64.17/S/3200

If your network environment supports DNS (Domain Name Services), a hostname can be used instead of the IP
address in all kinds of connection strings. (This requires a correct DNS configuration on the client, e.g. via the
hosts file).

 Example

Example with an application server's hostname (iwdf8997.wdf.sap-ag.de) and port number (3200):

/H/iwdf8997.wdf.sap-ag.de/S/3200

If your network environment supports symbolic service names for well-known ports, the symbolic service
name can be used instead of the port number in all kinds of connection strings. (This requires a correct service
configuration on the client, e.g. in the services file). Note that SAP application server ports are by convention
named 'sapdp<SID>', where <SID> is the SAP system id

 Example

Example with host name (iwdf8997.wdf.sap-ag.de) and symbolic service name (sapdpIWD):

/H/iwdf8997.wdf.sap-ag.de/S/sapdpIWD

Simple connection strings need not to be resolved by the SAP GUI application. Resolution of host names and
symbolic service names is done by the operating system's network layer.

SAP Routers

In a WAN (Wide Area Network) environment, SAP routers are used to make connections to remote SAP
systems that cannot be reached with a direct TCP connection. Passwords may be used for each SAP router to
control access. In order to make a connection, the client is responsible for providing the complete route to the
destination, possibly including a chain of several SAP routers. Path information is not provided by the routers.
(Strictly speaking, an SAP router is actually better described as an application level proxy with password
capabilities and strict source routing). The address for each router is specified by a simple connection string
(with the router's host name and port number), optionally followed by '/P/' and the router password. The path
from the current location to the destination is described by concatenating all router addresses, followed by
the address of the destination SAP system. Thus, a connection string with SAP routers generally has the form
<router 1><router 2>...<router n><destination>.

SAP GUI Scripting API


46 PUBLIC SAP GUI Scripting API
 Example

Example with two routers (gate.acme.com, port 3299, and gate.sap.com, port 3298), the first using a
password (secret), for a connection to the application server iwdf8997.sap.com, port 3200):

/H/gate.acme.com/S/3299/P/secret/H/gate.sap.com/S/3298/H/iwdf8997.sap.com/S/
3200<-------- 1st router ----------><---- 2nd router ----><------ app_server
------>

Connection strings including SAP routers are passed to SAP GUI's communication layer and resolved step by
step by the routers on the path. If host names and symbolic service names are used, each router must have
access to correct network configuration information to resolve them.

Message Servers and Logon Groups

For load balancing purposes, application servers from one SAP system are usually configured in logon groups,
where each group serves a particular kind of user. The application servers in each group are assigned to users
by a least-heavily-loaded strategy. This load balancing is done by message servers. Each SAP system has
exactly one message server, which can be reached via TCP on a specific message server port.

 Note

Care should be taken that the application server's port number is not confused with the message server's
port number. Although the message server's host name may in small installations often be identical to
the hostname of an application server, the port number is always different. Symbolic service names for
message servers by convention have the form 'sapms<SID>', where <SID> is the SAP system id.

Message server and group information can be used to address an SAP system in a connection string. The
address of the message server is specified as a combination of message server host name, message server
port and group name. This information is marked with the prefixes '/M/'(message server host name), '/S/'
(message server port) and '/G/' (logon group).

 Example

Example with message server (hostname alrmain, port number 4253) and logon group (SPACE):

/M/alrmain.wdf.sap-ag.de/S/4253/G/SPACE

Connection strings with message servers are resolved by SAP GUI by contacting the message server and
retrieving the (simple) connection string of an application server for the specified group. This requires network
access to the message server at the time the address is resolved. SAP router connection strings may be used
in combination with message server connection strings simply by specifying the router address before the
message server address. The router is then used for contacting the message server as well as for contacting
the resolved application server.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 47
Symbolic System Names

The most user-friendly form of connection string addresses an SAP system only by its symbolic name (per
convention, the system id) and the logon group name. This information is marked with the prefixes '/R/' (for
the symbolic SAP system name) and '/G/' (for the logon group name).

 Example

Example with SAP system (ALR) and logon group (SPACE):

/R/ALR/G/SPACE

Connection strings with symbolic system names are resolved by SAP GUI by looking up the symbolic SAP
system name in the Message Server List (a text file containing a mapping between symbolic system names
and message server addresses) and replacing the /R/ part of the connection string with the resulting
message server address.

The result is a complete message server connection string, which is then further resolved as explained
above.

Formal Syntax

For the technically interested reader, the following BNF grammar formally describes the syntax of connection
strings:

 Sample Code

<connection string> := [<router prefix>]<local>


<local> := <simple>|<message server>|<symbolic>
<simple> := "/H/"<host>"/S/"<service>
<host> := <hostname>|<ipaddr>
<hostname> := (any DNS hostname)
<ipaddr> := (any IP address, in dotted decimal form)
<service> := <servicename>|<port number>
<servicename> := (any IP service name)
<port number> := (any decimal number)
<messageserver> := "/M/"<host>"/S/"<service>"/G/"<group>
<group> := (any ASCII string not containing '/')
<symbolic> := "/R/"<system>"/G/"<group>
<system> := (any ASCII string not containing '/')
<router prefix> := <router>*
<router> := "/H/"<host>"/S/"<service>["/P/"<password>]
<password> := (any ASCII string not containing '/')

1.2.4 GuiBarChart Object

SAP GUI Scripting API


48 PUBLIC SAP GUI Scripting API
Description

The GuiBarChart is a powerful tool to display and modify time scale diagrams.

The object is of a very technical nature. It should only be used for recording and playback, as most of the
parameters cannot be determined in any other way. GuiBarChart extends the GuiShell Object [page 207].

Example

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 49
Method

Syntax Description

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

BarCount Returns the number of bars in the given chart.

Public Function BarCount( _


ByVal chartId As Long _
) As Long

GetBarContent Returns the content of the bar.

Public Function GetBarContent( _


ByVal chartId As Long, _
ByVal barId As Long, _
ByVal textId As Long _
) As String

GetGridLineContent Returns the content of the grid line.

Public Function GetGridLineContent( _


ByVal chartId As Long, _
ByVal gridlineId As Long, _
ByVal textId As Long _
) As String

GridCount Returns the number of grids within the chart.

Public Function GridCount( _


ByVal chartId As Long _
) As Long

LinkCount Returns the number of links within the given chart.

Public Function LinkCount( _


ByVal chartId As Long _
) As Long

SAP GUI Scripting API


50 PUBLIC SAP GUI Scripting API
Method

Syntax Description

SendData Send data to the server.

Public Sub SendData( _


ByVal Data As String _
)

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 51
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

ChartCount (Read-only) Number of charts.

Public Property ChartCount As Long

SAP GUI Scripting API


52 PUBLIC SAP GUI Scripting API
1.2.5 GuiBox Object

Description

A GuiBox is a simple frame with a name (also called a "Group Box"). The items inside the frame are not children
of the box. The type prefix is "box".

GuiBox extends the GuiVComponent Object [page 281].

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 53
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

CharHeight (Read-only) Height of the GuiBox in character metric.

Public Property CharHeight As Long

CharLeft (Read-only) Left coordinate of the GuiBox in character metric.

Public Property CharLeft As Long

CharTop (Read-only) Top coordinate of the GuiBox in character metric.

Public Property CharTop As Long

CharWidth (Read-only) Width of the GuiBox in character metric.

Public Property CharWidth As Long

1.2.6 GuiButton Object

SAP GUI Scripting API


54 PUBLIC SAP GUI Scripting API
Description

GuiButton represents all push buttons that are on dynpros, the toolbar or in table controls. GuiButton extends
the GuiVComponent Object [page 281]. The type prefix is btn, the name property is the fieldname taken from
the SAP data dictionary There is one exception: For tabstrip buttons, it is the button id set in screen painter that
is taken from the SAP data dictionary.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

Press This emulates manually pressing a button. Pressing a button


will always cause server communication to occur, rendering
all references to elements below the window level invalid.
The following code will therefore fail:

Set TextField = session.findById(".../


txtF1")
session.findById(".../btnPB5").press
TextField.text = "Hello"

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 55
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

Emphasized (Read-only) This property is True if the button is displayed empha-


sized (in Fiori Visual Themes: The leftmost button in the
Public Property Emphasized As Byte
footer and buttons configured as "Fiori Usage D Display<-
>Change").

 Note
• If SAP GUI is running without a Fiori Visual Theme
(like Belize) this property is always False.
• This property is available as of SAP GUI for Win-
dows 7.60.

LeftLabel Left label of the GuiButton. The label is assigned in the


Screen Painter, using the flag 'assign left'.
Public Property LeftLabel As
GuiVComponent

RightLabel Right label of the GuiButton. This property is set in Screen


Painter using the 'assign right' flag.
Public Property RightLabel As
GuiVComponent

SAP GUI Scripting API


56 PUBLIC SAP GUI Scripting API
1.2.7 GuiCalendar Object

Description

The calendar control can be used to select single dates or periods of time. GuiCalendar extends the GuiShell
Object [page 207].

Example

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 57
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

ContextMenu Calling this function opens a context menu.

Public Sub ContextMenu( _ Parameter CtxMenuId indicates the cell type of the cell in
ByVal CtxMenuId As Long, _ which the context menu was opened:
ByVal CtxMenuCellRow As Long, _
ByVal CtxMenuCellCol As Long, _
ByVal DateBegin As String, _ Value Cell Type Description
ByVal DateEnd As String _
) 0 Date Invocation on a
cell with a single
date

1 Weekday Weekday Invoca-


tion on a button
for a certain day
of the week

2 Week Invocation on a
button for a spe-
cific week

SAP GUI Scripting API


58 PUBLIC SAP GUI Scripting API
Method

Syntax Description

CreateDate Creates a date string in format “YYYYMMDD” out of the pa-


rameters. This is the format expected by a number of other
Public Function CreateDate( _ methods available in GuiCalendar.
ByVal day As Long, _
ByVal month As Long, _
ByVal year As Long _
) As String

GetColor Returns the color code (from 0-9) of the date cell specified
as parameter (in format “YYYYMMDD”) as Integer. If no
Public Function GetColor( _ semantic colors are used in the concrete cell, the method
ByVal from As String _ returns “0”.
) As Long

GetColorInfo Returns the explanation defined by the application for se-


mantic colors used in the GuiCalendar (starting with index
Public Function GetColorInfo( _ 0).
ByVal Color As Long _
) As String

GetDateTooltip Returns the tooltip text of the date specified as parameter


(in format “YYYYMMDD”).
Public Function GetDateTooltip( _
ByVal date As String _
) As String

GetDay Returns the day of the date specified as parameter (in for-
mat “YYYYMMDD”).
Public Function GetDay( _
ByVal date As String _
) As Long

GetMonth Returns the month of the date specified as parameter (in


format “YYYYMMDD”).
Public Function GetMonth( _
ByVal date As String _
) As Long

GetWeekday Returns the week day of the date specified as parameter (in
format “YYYYMMDD”).
Public Function GetWeekday( _
ByVal date As String _
) As String

GetWeekNumber Returns the week number of the date specified as parameter


(in format “YYYYMMDD”).
Public Function GetWeekNumber( _
ByVal date As String _
) As Long

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 59
Method

Syntax Description

GetYear Returns the year of the date specified as parameter (in for-
mat “YYYYMMDD”).
Public Function GetYear( _
ByVal date As String _
) As Long

IsWeekend Returns True if the date specified by the parameter is at a


weekend.
Public Function IsWeekend( _
ByVal date As String _
) As Long

SelectMonth Selects the month specified by the parameters (starting with


index 1).
Public Sub SelectMonth( _
ByVal month As Long, _
ByVal year
As Long _ )

SelectRange Selects the range specified by the parameters (in format


“YYYYMMDD”).
Public Sub SelectRange( _
ByVal from As String, _
ByVal to As
String _
)

SelectWeek Selects the week specified by the parameters (starting with


index 0).
Public Sub SelectWeek( _
ByVal week As Long, _
ByVal year
As Long _
)

SAP GUI Scripting API


60 PUBLIC SAP GUI Scripting API
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 61
Property

Syntax Description

All properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

endSelection (Read-only) The last day of the selected date range (in format
“YYYYMMDD”).
Public Property endSelection As String

FirstVisibleDate (Read-write) This is the earliest date visible in the calendar control. In the
example above the value would be “20171225”.
Public Property FirstVisibleDate As
String

FocusDate (Read-write) The currently focused date (identified by the focus border;
see picture above) in the calendar control is available in the
Public Property FocusDate As String
format “YYYYMMDD”. In this example it is “20180130”.

FocusedElement (Read-only) This property indicates which part of a composite GuiCalen-


dar control currently has focus. The following values are pos-
Public Property FocusedElement As Long
sible:

• 0 - "InputField": The input field (picker) to manually


enter a date currently has focus
• 1 - "Button": The push button to open the navigator
pane currently has focus
• 2 - "Navigator": The popup navigator pane is open and
currently has focus

 Note
This property is available as of SAP GUI for Windows
7.50 patchlevel 8 and SAP GUI for Windows 7.60.

horizontal (Read-only) This property contains True if the GuiCalendar has a horizon-
tal orientation, else it contains False.
Public Property horizontal As Long

LastVisibleDate (Read-write) The last date that is currently displayed by the GuiCalendar
(in format “YYYYMMDD”).
Public Property LastVisibleDate As
String

SAP GUI Scripting API


62 PUBLIC SAP GUI Scripting API
Property

Syntax Description

SelectionInterval (Read-write) The interval is represented by two concatenated date strings


separated by a comma.
Public Property SelectionInterval As
String

startSelection (Read-only) The starting day of the selected date range (in format
“YYYYMMDD”).
Public Property startSelection As
String

Today (Read-only) The current day (in format “YYYYMMDD”).

Public Property Today As String

1.2.8 GuiChart Object

Description

The GuiChart object is of a very technical nature. It should only be used for recording and playback, as most of
the parameters cannot be determined in any other way.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 63
Example

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

SAP GUI Scripting API


64 PUBLIC SAP GUI Scripting API
Method

Syntax Description

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

ValueChange Series: Number of the data set within the row that should
be changed.
Public Sub ValueChange( _
ByVal Series As Long, _ Point: Number of the data point within the row that should
ByVal Point As Long, _ be changed.
ByVal XValue As String, _
ByVal YValue As String, _ XValue: New x value.
ByVal DataChange As Byte, _
ByVal Id As String, _ YValue: New y value.
ByVal ZValue As String, _
ByVal ChangeFlag As Long _
DataChange: Setting this parameter to True means the
)
value was not changed interactively within the graphic but
rather by entering the new value on the DataPoint property
page.

Id: GFW data container id of the changed point. May be


used instead of the pair series/point.

ZValue: New z value.

ChangeFlag: Notify which value was changed or if it was a


time value. The value is set as a bit array, using the lower 5
bits.

1 x

2 y

4 x is time value

8 y is time value

16 z

If the new value is a point in time, it should be set using a


string of the format mm/dd/yyyy hh:mm:ss.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 65
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All additional properties of the GuiContainer Object [page 87]:

• Children

SAP GUI Scripting API


66 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

1.2.9 GuiCheckBox Object

Description

GuiCheckBox extends the GuiVComponent Object [page 281]. The type prefix is chk, the name is the fieldname
taken from the SAP data dictionary.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

GetListProperty For more information refer to the documentation about


method GetListProperty within GuiLabel Object [page
Public Function GetListProperty( _ 140].
ByVal Property As String _
) As String

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 67
Method

Syntax Description

GetListPropertyNonRec This method returns information that is compiled on the


server to enhance the ABAP lists with accessibility informa-
Public Function
GetListPropertyNonRec( _ tion. See GuiLabel Object [page 140] -> GetListProperty
ByVal Property As String _ for a description of available attributes. In contrast to the
) As String method GetListProperty, GetListPropertyNonRec will only
return information that is set for the specific element and
ignore list properties set for parent elements.For more infor-
mation, refer to the documentation about method GetList-
PropertyNonRec within GuiLabel Object [page 140].

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


68 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

ColorIndex (Read-only) This number defines the index of the list color of this ele-
ment.
Public Property ColorIndex As Long

ColorIntensified (Read-only) This property is True if the Intensified flag is set in Screen
Painter for this dynpro element.
Public Property ColorIntensified As
Byte

ColorInverse (Read-only) This property is True if the inverse color style is set in Screen
Painter for the element.
Public Property ColorInverse As Byte

Flushing (Read-only) Some components such as radio buttons or checkboxes


may cause a round trip when their value is changed. If this is
Public Property Flushing As Byte
the case, the Flushing property is True.

IsLeftLabel (Read-only) This property is True if the component has the 'assign left'
flag.
Public Property IsLeftLabel As Byte

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 69
Property

Syntax Description

IsListElement (Read-only) This property is True if the element is on an ABAP list, not a
dynpro screen.
Public Property IsListElement As Byte

IsRightLabel (Read-only) This property is True if the component has the 'assign right'
flag.
Public Property IsRightLabel As Byte

LeftLabel (Read-only) Left label of the component. The label is assigned in the
Screen Painter, using the flag 'assign left'.
Public Property LeftLabel As
GuiVComponent

RightLabel (Read-only) Right label of the component. This property is set in Screen
Painter using the 'assign right' flag.
Public Property RightLabel As
GuiVComponent

RowText (Read-only) This property is only available in ABAP list screens. It returns
the text of the while line containing the current component.
Public Property RowText As String
 Note
This property can only provide useful data when Acces-
sibility mode is activated and the respective ABAP list
has been properly enabled for accessibility. In this case
the ABAP list contains substructures of type GuiSimple-
Container which, for example, model the rows of the list.

Selected (Read-write) Like radio buttons, checking a checkbox can cause server
communication, depending on the ABAP Screen Painter def-
Public Property Selected As Byte
inition.

1.2.10 GuiCollection Collection

Description

GuiCollection is similar to the GuiComponentCollection Collection [page 83], but its members are not
necessarily extensions of the GuiComponent Object [page 82]. It can be used to pass a collection
as a parameter to functions of scriptable objects. An object of this class is created by calling the
CreateGuiCollection function of the GuiApplication Object [page 38].

SAP GUI Scripting API


70 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

Add After a GuiCollection has been created, items can be added


by calling the add function.
Public Sub Add( _
ByVal Item As Variant _
)

ElementAt This function returns the member in the collection at posi-


tion index, where index may range from 0 to count-1. If no
Public Function ElementAt( _
ByVal Index As Long _ member can be found for the given index, an exception is
) As Variant raised.

Item This function returns the member in the collection at posi-


tion index, where index may range from 0 to count-1. It has
Public Function Item( _
ByVal Index As Variant _ been added for compatibility with Microsoft Visual Basic col-
) As Variant lections. If no member can be found for the given index, an
exception is raised.

Properties

Property

Syntax Description

Count (Read-only) The number of elements in the collection. This property has
been added for compatibility with Microsoft Visual Basic col-
Public Property Count As Long
lections.

Length (Read-only) The number of elements in the collection.

Public Property Length As Long

NewEnum (Read-only) This property has been added for compatibility with Micro-
soft Visual Basic collections.
Public Property NewEnum As Unknown

Type (Read-only) The type information can be used to determine which prop-
erties and methods an object supports. The value is the
Public Property Type As String
name of the type taken from this documentation.

The value for GuiCollection is ‘GuiCollection’.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 71
Property

Syntax Description

TypeAsNumber (Read-only) While the Type property is a string value, the


TypeAsNumber property is a long value that can alterna-
Public Property TypeAsNumber As Long tively be used to identify an object's type . It was added
for better performance in methods such as FindByIdEx.
Possible values for this property are taken from the GuiCom-
ponentType [page 297]enumeration.

1.2.11 GuiColorSelector Object

Description

GuiColorSelector displays a set of colors for selection. It extends the GuiShell Object [page 207].

Example

SAP GUI Scripting API


72 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

ChangeSelection This function emulates the user’s selection of the color at


the given index position.
Public Sub ChangeSelection( _
ByVal i As Integer _
)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 73
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

SAP GUI Scripting API


74 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

1.2.12 GuiComboBox Object

Description

The GuiComboBox looks somewhat similar to GuiCTextField, but has a completely different implementation.
While pressing the combo box button of a GuiCTextField will open a new dynpro or control in which a selection
can be made, GuiComboBox retrieves all possible choices on initialization from the server, so the selection
is done solely on the client. GuiComboBox extends the GuiVComponent Object [page 281]. The type prefix
is cmb, the name is the fieldname taken from the SAP data dictionary. GuiComboBox inherits from the
GuiVComponent Object [page 281].

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

SetKeySpace This function sets the key property of the combo box to the
space character. It was introduced for eCATT.
Public Sub SetKeySpace()

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 75
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Tooltip
• Top
• Width

CharHeight (Read-only) Height of the GuiComboBox in character metric.

Public Property CharHeight As Long

CharLeft (Read-only) Left coordinate of the GuiComboBox in character metric.

Public Property CharLeft As Long

CharTop (Read-only) Top coordinate of the GuiComboBox in character metric.

Public Property CharTop As Long

SAP GUI Scripting API


76 PUBLIC SAP GUI Scripting API
Property

Syntax Description

CharWidth (Read-only) Width of the GuiComboBox in character metric.

Public Property CharWidth As Long

CurListBoxEntry (Read-only) The currently focused entry of the dropdown list.

Public Property CurListBoxEntry As


GuiComboBoxEntry

Entries (Read-only) All members of this collection are of GuiComboBoxEntry


type and have just the three properties, key and value, both
Public Property Entries() As
GuiCollection of type String, and pos of type Long, see also GuiComboBox-
Entry Object [page 81]. The key data can be displayed in
SAP GUI by setting the ‘Show keys…’ options in SAP GUI
options dialog.

In this example the first column contains the key property


and the second column contains the value property.

Flushing (Read-only) Some components such as radio buttons, checkboxes or


combo boxes may cause a round trip when their value is
Public Property Flushing As Byte
changed. If this is the case, the Flushing property is True.

Highlighted (Read-only) This property is True if the Highlighted flag is set in the
Screen Painter for the combo box.
Public Property Highlighted As Byte

IsLeftLabel (Read-only) This property is True if the combo box has the 'assign left'
flag.
Public Property IsLeftLabel As Byte

IsListBoxActive (Read-only) This property is True if the list box of the combo box is
currently open.
Public Property IsListBoxActive As
Byte

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 77
Property

Syntax Description

IsRightLabel (Read-only) This property is True if the combo box has the 'assign right'
flag.
Public Property IsRightLabel As Byte

Key (Read-write) This is the key of the currently selected item. You can change
this item by setting the Key property to a new value.
Public Property Key As String

LeftLabel (Read-only) This label has been defined in ABAP Screen Painter to be the
left label of the combo box.
Public Property Modified As Byte

Required (Read-only) If the required flag is set for a combo box then the empty
entry is not selectable from the list.
Public Property Required As Byte

RightLabel (Read-only) This label has been defined in ABAP Screen Painter to be the
right label of the combo box.
Public Property RightLabel As
GuiVComponent

ShowKey (Read-only) This property is True, if the ABAP application configured


the combo box to always show both keys and values via
Public Property ShowKey As Byte setting the property Dropdown to Listbox with key in the
screenpainter. This has nothing to do with the setting Show
keys… in SAP GUI options dialog.

Text (Read-only) The value of this property contains the current text of the
combobox.
Public Property Text As String
 Note
As opposed to other UI elements, you cannot write this
property, because the texts in the dropdown list are typ-
ically language-dependent. Therefore, you need to use
the Key Property to change the selected item and with
this the text of the combobox.

Value (Read-write) This is the value of the currently selected item. You can
change this item by setting the value property to a new
Public Property Value As String
value.

SAP GUI Scripting API


78 PUBLIC SAP GUI Scripting API
1.2.13 GuiComboBoxControl Object

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

FireSelected This method sends the “selected” event to the application.

Public Sub FireSelected()

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 79
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

SAP GUI Scripting API


80 PUBLIC SAP GUI Scripting API
Property

Syntax Description

CurListBoxEntry (Read-only) The currently focused entry of the dropdown list. The entry
is of GuiComboBoxEntry type and has just the three proper-
Public Property CurListBoxEntry As
GuiComboBoxEntry ties key and value, both of type String, and pos of type Long;
see also GuiComboBoxEntry Object [page 81].

Entries (Read-only) This property contains the entries of the combobox control.
All members of this collection are of GuiComboBoxEntry
Public Property Entries As
GuiCollection type and have just the three properties: key and value, both
of type String, and pos of type Long. See also GuiCombo-
BoxEntry Object [page 81].

IsListBoxActive (Read-only) This property is True if the list box of the combo box control
is currently open.
Public Property IsListBoxActive As
Byte

LabelText (Read-only) Text of the label belonging to the combobox control.

Public Property LabelText As String

Selected (Read-write) The key of the currently selected entry of the combo box.

Public Property Selected As String

Text (Read-only) The value of this property contains the current text of the
combobox.
Public Property Text As String
 Note
As opposed to other UI elements, you cannot write this
property, because the texts in the dropdown list are typ-
ically language-dependent. Therefore, you need to use
the Key Property to change the selected item and with
this the text of the combobox.

1.2.14 GuiComboBoxEntry Object

Description

Members of the Entries collection of a GuiComboBox are of type GuiComBoxEntry.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 81
Properties

Property

Syntax Description

Key (Read-only) Key value of the combo box entry.

Public Property Key As String

Pos (Read-only) Position of the combo box entry. The range is from 1 to the
number of entries in the combo box.
Public Property Pos As Long

Value (Read-only) Value of the combo box entry.

Public Property Value As String

1.2.15 GuiComponent Object

Description

GuiComponent is the base class for most classes in the Scripting API. It was designed to allow generic
programming, meaning you can work with objects without knowing their exact type.

Properties

Property

Syntax Description

ContainerType (Read-only) This property is TRUE, if the object is a container and there-
fore has the Children property.
Public Property ContainerType As Byte

Id (Read-only) An object id is a unique textual identifier for the object. It is


built in a URLlike formatting, starting at the GuiApplication
Public Property Id As String object and drilling down to the respective object.

SAP GUI Scripting API


82 PUBLIC SAP GUI Scripting API
Property

Syntax Description

Name (Read-only) The name property is especially useful when working with
simple scripts that only access dynpro fields. In that case
Public Property Name As String a field can be found using its name and type information,
which is easier to read than a possibly very long id. However,
there is no guarantee that there are no two objects with the
same name and type in a given dynpro.

Parent (Read-only) The parent of an object is one level higher in the runtime
hierarchy. An object is always in the children collection of its
Public Property Parent As Object parent.

Type (Read-only) The type information of GuiComponent can be used to de-


termine which properties and methods an object supports.
Public Property Type As String The value of the type string is the name of the type taken
from this documentation.

TypeAsNumber (Read-only) While the Type property is a string value, the


TypeAsNumber property is a long value that can alterna-
Public Property TypeAsNumber As Long tively be used to identify an object's type . It was added
for better performance in methods such as FindByIdEx.
Possible values for this property are taken from the GuiCom-
ponentType [page 297]enumeration.

1.2.16 GuiComponentCollection Collection

Description

The GuiComponentCollection is used for collections elements such as the Children property of containers.
Each element of the collection is an extension of GuiComponent.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 83
Methods

Method

Syntax Description

ElementAt This function returns the member in the collection at posi-


tion index, where index may range from 0 to count-1. If no
Public Function ElementAt( _
ByVal Index As Long _ member can be found for the given index, the exception
) As GuiComponent Gui_Err_Enumerator_Index (614) is raised.

Item This function returns the member in the collection at posi-


tion index, where index may range from 0 to count-1. It has
Public Function Item( _
ByVal Index As Variant _ been added for compatibility with Microsoft Visual Basic col-
) As GuiComponent lections. If no member can be found for the given index the
exception Gui_Err_Enumerator_Index (614) is raised.

Properties

Property

Syntax Description

Count (Read-only) The number of elements in the collection. This property is


used implicitly from Visual Basic applications.
Public Property Count As Long

Length (Read-only) The number of elements in the collection.

Public Property Length As Long

NewEnum (Read-only) This property is used implicitly from Visual Basic applica-
tions.
Public Property NewEnum As Unknown

Type (Read-only) The type information can be used to determine which prop-
erties and methods an object supports. The value of the type
Public Property Type As String
string is the name of the type taken from this documenta-
tion.

The value is ‘GuiComponentCollection’.

TypeAsNumber (Read-only) While the Type property is a string value, the


TypeAsNumber property is a long value that can alterna-
Public Property TypeAsNumber As Long tively be used to identify an object's type . It was added
for better performance in methods such as FindByIdEx.
Possible values for this property are taken from the GuiCom-
ponentType [page 297]enumeration.

SAP GUI Scripting API


84 PUBLIC SAP GUI Scripting API
1.2.17 GuiConnection Object

Description

A GuiConnection represents the connection between SAP GUI and an application server. Connections can be
opened from SAP Logon or from GuiApplication’s openConnection and openConnectionByConnectionString
methods. GuiConnection extends the GuiContainer Object [page 87]. The type prefix for GuiConnection is
con, the name is con plus the connection number in square brackets.

Remarks

It is possible to connect to an application server from ABAP using the following command:

CALL FUNCTION func DESTINATION dest.

However, this connection is implemented as a re-direction between the two application servers involved. There
will therefore be no new GuiConnection object available and the existing object will not reflect the server
switch.

Methods

Method

Syntax Description

All methods of the GuiContainer Object [page 87]:

• FindById

CloseConnection This method closes a connection along with all its sessions.

Public Sub CloseConnection()

CloseSession A session can be closed by calling this method of the con-


nection. Closing the last session of a connection will close
Public Sub CloseSession( _
ByVal Id As String _ the connection, too.
)
The parameter "Id" must contain the id of the session to
close (like "/app/con[0]/ses[0]").

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 85
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

Children (Read-only) This collection contains all direct children of the object.

Public Property Children As


GuiComponentCollection

ConnectionString (Read-only) This property contains the connection string defining the
backend connection. It is more difficult to read, but it doesn’t
Public Property ConnectionString As
String rely on the SAP Logon entries.

More information on connection strings can be found in


chapter Method OpenConnectionByConnectionString [page
45].

Description (Read-only) This description is only available if the connection was


started either from SAP Logon or using GuiApplica-
Public Property Description As String
tion.OpenConnection. In both cases the description can then
be used when calling the OpenConnection method to
play back a script on the same system.

DisabledByServer (Read-only) This property is set to True if the scripting support has not
been enabled for the application server.
Public Property DisabledByServer As
Byte

Sessions (Read-only) This property is another name for the Children property.
It was added for better readability as all the children of
Public Property Sessions As
GuiComponentCollection GuiConnection are sessions. Accessing either the children
property or the Sessions property can cause the excep-
tion Gui_Err_Scripting_Disabled_Srv (624) to be raised if the
respective application server has not enabled the scripting
support.

SAP GUI Scripting API


86 PUBLIC SAP GUI Scripting API
1.2.18 GuiContainer Object

Description

This interface resembles GuiVContainer. The only difference is that it is not intended for visual objects but
rather administrative objects such as connections or sessions. Objects exposing this interface will therefore
support GuiComponent but not GuiVComponent. GuiContainer extends the GuiComponent Object [page 82].

Methods

Method

Syntax Description

FindById Search through the object's descendants for a given id. If the
parameter is a fully qualified id, the function will first check if
Public Function FindById( _
ByVal Id As String, _ the container object's id is a prefix of the id parameter. If that
Optional ByVal Raise As Variant _ is the case, this prefix is truncated. If no descendant with the
) As GuiComponent given id can be found the function raises an exception unless
the optional parameter raise is set to False.

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 87
Property

Syntax Description

Children (Read-only) This collection contains all direct children of the object.

Public Property Children As


GuiComponentCollection

1.2.19 GuiContainerShell Object

Description

A GuiContainerShell is a wrapper for a set of the GuiShell Object [page 207]. GuiContainerShell extends the
GuiVContainer Object [page 286]. The type prefix is shellcont, the name is the last part of the id, shellcont[n].

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

SAP GUI Scripting API


88 PUBLIC SAP GUI Scripting API
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

AccDescription (Read-only) Accessibility description of the shell. This description can be


used for shells that do not have a title element.
Public Property AccDescription As
String

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 89
1.2.20 GuiCTextField Object

Description

If the cursor is set into a text field of type GuiCTextField a combo box button is displayed to the right of the text
field. Pressing this button is equivalent to pressing the F4 key. The button is not represented in the scripting
object model as a separate object; it is considered to be part of the text field.

There are no other differences between GuiTextField and GuiCTextField. GuiCTextField extends the GuiTextField
[page 250]. The type prefix is ctxt, the name is the Fieldname taken from the SAP data dictionary.

Example

This is an example of GuiCTextField type text field, where the upper field has the focus. Please note that the
button is only displayed when the corresponding input field has the focus unless the ABAP application has
defined the button to be shown permanently.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

SAP GUI Scripting API


90 PUBLIC SAP GUI Scripting API
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 91
Property

Syntax Description

All properties of the GuiTextField [page 250] with one exception: Property IsListElement in not available for this object
since F4 help is not available for input fields within ABAP lists!

• CaretPosition
• DisplayedText
• Highlighted
• HistoryCurEntry
• HistoryCurIndex
• HistoryIsActive
• HistoryList
• IsHotspot
• IsLeftLabel
• IsOField
• IsRightLabel
• LeftLabel
• MaxLength
• Numerical
• Required
• RightLabel

1.2.21 GuiCustomControl Object

Description

The GuiCustomControl is a wrapper object that is used to place ActiveX controls onto dynpro screens. While
GuiCustomControl is a dynpro element itself, its children are of GuiContainerShell type, which is a container for
controls. GuiCustomControl extends the GuiVContainer Object [page 286]. The type prefix is cntl, the name is
the fieldname taken from the SAP data dictionary.

SAP GUI Scripting API


92 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All additional methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 93
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

CharHeight (Read-only) Height of the GuiCustomControl in character metric.

Public Property CharHeight As Long

CharLeft (Read-only) Left coordinate of the GuiCustomControl in character met-


ric.
Public Property CharLeft As Long

CharTop (Read-only) Top coordinate of the GuiCustomControl in character metric.

Public Property CharTop As Long

CharWidth (Read-only) Width of the GuiCustomControl in character metric.

Public Property CharWidth As Long

SAP GUI Scripting API


94 PUBLIC SAP GUI Scripting API
1.2.22 GuiDialogShell Object

Description

The GuiDialogShell is an external window that is used as a container for other shells, for example a toolbar.
GuiDialogShell extends the GuiVContainer Object [page 286]. The type prefix is shellcont, the name is the last
part of the id, shellcont[n].

Example

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All additional methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 95
Method

Syntax Description

Close This method closes the external window.

Public Sub Close()

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

SAP GUI Scripting API


96 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiContainer Object [page 87]:

• Children

Title (Read-only) Title of the dialog.

Public Property Title As String

1.2.23 GuiDockShell Object

Description

A GuiDockShell is a special kind of GuiContainerShell Object [page 88], which represents a docking container.
GuiDockShell extends the GuiVContainer Object [page 286]. The type prefix is shellcont, the name is the last
part of the id, shellcont[n].

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 97
Method

Syntax Description

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


98 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

AccDescription (Read-only) Accessibility description of the shell. This description can be


used for shells that do not have a title element.
Public Property AccDescription As
String

DockerIsVertical (Read-only) Is TRUE if the container is a vertical docker control.

Public Property DockerIsVertical As


Byte

DockerPixelSize (Read-write) Returns the size of the docker control in pixels.

Public Property DockerPixelSize As


Long

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 99
1.2.24 GuiEAIViewer2D Object

Description

The GuiEAIViewer2D control is used to view 2-dimensional graphic images in the SAP system. The user can
carry out redlining over the loaded image. The scripting wrapper for this control records all user actions during
the redlining process and reproduces the same actions when the recorded script is replayed.

GuiEAIViewer2D extends the GuiShell Object [page 207].

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

annotationTextRequest

Public Sub annotationTextRequest( _


ByVal strText As String _
)

SAP GUI Scripting API


100 PUBLIC SAP GUI Scripting API
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 101
Property

Syntax Description

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

AnnotationEnabled (Read-write) The value of this property is set to 1 when redlining is


started. The wrapper control starts recording user actions
Public Property AnnotationEnabled As
Long as soon as this property is set to value 1.

AnnotationMode (Read-write) During redlining, the selected redlining mode is stored in this
property.
Public Property AnnotationMode As
Integer

RedliningStream (Read-write) This property stores the redlining layer as BLOB (Binary
large data object). During recording, the whole BLOB is cop-
Public Property RedliningStream As
String ied into the generated script.

1.2.25 GuiEAIViewer3D Object

The GuiEAIViewer3D control is used to view 3-dimensional graphic images in the SAP system.

GuiEAIViewer3D extends the GuiShell Object [page 207].

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

SAP GUI Scripting API


102 PUBLIC SAP GUI Scripting API
Method

Syntax Description

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 103
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

SAP GUI Scripting API


104 PUBLIC SAP GUI Scripting API
1.2.26 GuiEnum Object

Methods

Method

Syntax Description

Clone

Public Function Clone( _


ByRef ppenum As GuiEnum _
) As HResult

Next

Public Function Next( _


ByVal celt As ULong, _
ByRef rgvar As Variant, _
ByRef pceltFetched As ULong _
) As HResult

Reset

Public Function Reset() As HResult

Skip

Public Function Skip( _


ByVal celt As ULong _
) As HResult

1.2.27 GuiFrameWindow Object

Description

A GuiFrameWindow is a high level visual object in the runtime hierarchy. It can be either the main window or a
modal popup window. See the GuiMainWindow and GuiModalWindow sections for examples. GuiFrameWindow
itself is an abstract interface. GuiFrameWindow extends the GuiVContainer Object [page 286]. The type prefix
is wnd, the name is wnd plus the window number in square brackets.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 105
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

Close The function attempts to close the window. Trying to close


the last main window of a session will not succeed imme-
Public Sub Close()
diately; the dialog ‘Do you really want to log off?’ will be
displayed first.

CompBitmap This method compares two bitmap files pixel by pixel.

Public Function CompBitmap( _ Return Type


ByVal Filename1 As String, _
ByVal Filename2 As String _ The method returns one of the following values:
) As Long
• 0: The files do not differ
• 1: The files differ in size
• 2: The files have different content
• 3: There was an error

SAP GUI Scripting API


106 PUBLIC SAP GUI Scripting API
Method

Syntax Description

HardCopy This function dumps a hardcopy of the window as a bitmap


file to disk. The parameter is the name of the file. If the func-
Public Function HardCopy( _
ByVal Filename As String, _ tion succeeds, then the return value will be the fully qualified
Optional ByVal ImageType As path of the file. If no path information is given, then the file
Variant, _ will be written to the SAP GUI Documents Folder.
Optional ByVal xPos As Variant, _
Optional ByVal yPos As Variant, _
Optional ByVal nWidth As Variant, _ Filename
Optional ByVal nHeight As Variant _
) As String ImageType The following values are
valid:

• 0: BMP
• 1: JPG
• 2: PNG
• 3: GIF
• 4: TIFF

BMP is the default format.

xPos If the optional parameters


xPos, yPos, nWidth and
nHeight are set, only the
specified rectangle of the
main window will be cap-
tured.

yPos If the optional parameters


xPos, yPos, nWidth and
nHeight are set, only the
specified rectangle of the
main window will be cap-
tured.

nWidth If the optional parameters


xPos, yPos, nWidth and
nHeight are set, only the
specified rectangle of the
main window will be cap-
tured.

nHeight If the optional parameters


xPos, yPos, nWidth and
nHeight are set, only the
specified rectangle of the
main window will be cap-
tured.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 107
Method

Syntax Description

HardCopyToMemory This function returns a hardcopy of the window as a safe


array of bytes.
Public Function HardCopyToMemory( _
Optional ByVal ImageType As The following values are valid:
Variant _
) As Variant • 0: BMP
• 1: JPG
• 2: PNG
• 3: GIF

BMP is the default format.

 Sample Code
The following example shows the hardcopy of an SAP
GUI main window ("wnd[0]").

If Not IsObject(application) Then


Set SapGuiAuto =
GetObject("SAPGUI")
Set application =
SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection =
application.Children(0)
End If
If Not IsObject(session) Then
Set session =
connection.Children(0)
End If
Image =
session.findById("wnd[0]").HardCopy
ToMemory()
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2

Dim BinaryStream
Set BinaryStream =
CreateObject("ADODB.Stream")

BinaryStream.Type = adTypeBinary
BinaryStream.Open
BinaryStream.Write Image
BinaryStream.SaveToFile
"C:\screenshot.bmp",
adSaveCreateOverWrite
MsgBox "Done"

Iconify This will set a window to the iconified state. It is not possible
to iconify a specific window of a session; both the main win-
Public Sub Iconify()
dow and all existing modals will be iconfied.

SAP GUI Scripting API


108 PUBLIC SAP GUI Scripting API
Method

Syntax Description

IsVKeyAllowed This function returns True if the virtual key VKey is currently
available. The VKeys are defined in the menu painter.
Public Function IsVKeyAllowed( _
ByVal VKey As Integer _
) As Byte

JumpBackward Execute the Ctrl+Shift+Tab key on the window to jump back-


ward one block.
Public Sub JumpBackward()

JumpForward Execute the Ctrl+Tab key on the window to jump forward one
block.
Public Sub JumpForward()

Maximize This will maximize a window. It is not possible to maximize


a modal window; it is always the main window which will be
Public Sub Maximize()
maximized.

Restore This will restore a window from its iconified state. It is not
possible to restore a specific window of a session; both the
Public Sub Restore()
main window and all existing modals will be restored.

SendVKey The virtual key VKey is executed on the window. The VKeys
are defined in the menu painter.
Public Sub SendVKey( _
ByVal VKey As Integer _
)

ShowMessageBox This method shows the message box modal to the GuiFra-
meWindow. The title and text parameters set the title and
Public Function ShowMessageBox( _
ByVal Title As String, _ text of the message box. The return value will be one of the
ByVal Text As String, _ MESSAGE_RESULT_* values.
ByVal MsgIcon As Long, _
ByVal MsgType As Long _
) As Long Title

Text

MsgIcon The msgIcon parameter


sets the icon to be used for
the message box and should
be set to one of the MES-
SAGE_TYPE_* constants.

MsgType msgType sets the buttons


available on the message
box and should be set to one
of the MESSAGE_OPTION*
constants.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 109
Method

Syntax Description

TabBackward Execute the Shift+Tab key on the window to jump backward


one element.
Public Sub TabBackward()

TabForward Execute the Tab key on the window to jump forward one
element.
Public Sub TabForward()

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


110 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

ElementVisualizationMode (Read-write) When elementVisualizationMode is enabled, a hit test can be


performed on SAP GUI by moving the cursor over the win-
Public Property
ElementVisualizationMode() As Boolean dow. The hit event of the session is fired when a component
was found at the mouse position.

GuiFocus (Read-only) The SystemFocus only supports dynpro elements. To receive


information about the currently focused ActiveX control you
Public Property GuiFocus() As
GuiVComponent can access the GuiFocus property.

Handle (Read-only) The window handle of the control that is connected to the
GuiShell. This is the handle of the underlying window in Mi-
Public Property Handle() As Long
crosoft Windows.

Iconic (Read-only) This property is True if the window is iconified. It is possible


to execute script commands on an iconified window , but
Public Property Iconic() As Boolean
there may be undefined results, especially when controls are
involved, as these may have invalid size settings.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 111
Property

Syntax Description

SystemFocus (Read-only) The systemFocus specifies the component that the SAP sys-
tem is currently seeing as being focused. This value is only
Public Property SystemFocus() As
GuiVComponent valid for dynpro elements and might therefore differ from the
focus as seen on the frontend.

WorkingPaneHeight (Read-only) This is the height of the working pane in character metric.

Public Property WorkingPaneHeight()


As Long

WorkingPaneWidth (Read-only) This is the width of the working pane in character metric.
The working pane is the area between the toolbars in the
Public Property WorkingPaneWidth() As
Long upper area of the window and the status bar at the bottom of
the window.

1.2.28 GuiGOSShell Object

Description

The GuiGosShell is not available in Classic Theme. GuiGOSShell extends the GuiVContainer Object [page 286].
The type prefix is shellcont, the name is the last part of the id, shellcont[n].

Example

SAP GUI Scripting API


112 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 113
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

1.2.29 GuiGraphAdapt Object

Description

For the graphic adapter control only basic members from GuiShell are available. Recording and playback is not
possible.

SAP GUI Scripting API


114 PUBLIC SAP GUI Scripting API
Remarks

In addition to the new, activeX based controls SAP GUI also comes with a set of external graphics executables,
for example to display a GANTT chart. These executables are not supported within the API. If during the
execution of a script one of these executables is launched, then the script will be blocked.

If you need to automate a process during which a graphics executable is displayed, then you need an
automation tool then allows you to both manipulate SAP GUI using the Scripting API, and other Windows
applications using native methods.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 115
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

SAP GUI Scripting API


116 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

1.2.30 GuiGridView Object

Description

The grid view is similar to the dynpro table control, but significantly more powerful. GuiGridView extends the
GuiShell Object [page 207].

Example

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 117
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

ClearSelection Calling clearSelection removes all row, column and cell se-
lections.
Public Sub ClearSelection()

Click This function emulates a mouse click on a given cell if the


parameters are valid and raises an exception otherwise.
Public Sub Click( _
ByVal Row As Long, _
ByVal Column As String _
)

ClickCurrentCell This function emulates a mouse click on the current cell.

Public Sub ClickCurrentCell()

ContextMenu Calling contextMenu emulates the context menu request.

Public Sub ContextMenu()

CurrentCellMoved This function notifies the server that a different cell has been
made the current cell. It must be called whenever the cur-
Public Sub CurrentCellMoved()
rent cell is changed.

SAP GUI Scripting API


118 PUBLIC SAP GUI Scripting API
Method

Syntax Description

DeleteRows The parameter rows is a comma separated string of indices


or index ranges, for example “3,5-8,14,15”. The entries must
Public Sub DeleteRows( _
ByVal Rows As String _ be ordered and not overlap, otherwise an exception is raised.
)

DeselectColumn This function removes the specified column from the collec-
tion of the selected columns.
Public Sub DeselectColumn( _
ByVal Column As String _
)

DoubleClick This function emulates a mouse double click on a given cell if


the parameters are valid and raises an exception otherwise.
Public Sub DoubleClick( _
ByVal Row As Long, _
ByVal Column As String _
)

DoubleClickCurrentCell This function emulates a mouse double click on the current


cell.
Public Sub DoubleClickCurrentCell()

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 119
Method

Syntax Description

DuplicateRows The parameter rows is a comma separated string of indices


or index ranges, for example “3,5-8,14,15”. For any single
Public Sub DuplicateRows( _
ByVal Rows As String _ index a copy of the row will be inserted at the given index.
) If a range of indexes is duplicated then all the new lines are
inserted as one block, before the old lines. The entries must
be ordered and not overlap, otherwise an exception is raised.

Example

0 Value A

1 Value B

If rows is “0,1” then the resulting table would be:

0 Value A

1 Value A

2 Value B

3 Value B

If on the other hand rows is “0-1” then the resulting table is:

0 Value A

1 Value B

2 Value A

3 Value B

GetCellChangeable This function returns True if the specified cell is changeable.

Public Function GetCellChangeable( _


ByVal Row As Long, _
ByVal Column As String _
) As Byte

GetCellCheckBoxChecked Returns True if the checkbox at the specified position is


checked. Throws an exception if there is no checkbox in the
Public Function
GetCellCheckBoxChecked( _ specified cell.
ByVal Row As Long, _
ByVal Column As String _
) As Byte

SAP GUI Scripting API


120 PUBLIC SAP GUI Scripting API
Method

Syntax Description

GetCellColor Returns an identifier for the color of the cell. This can be
used to retrieve the color information using GetColorInfo.
Public Function GetCellColor( _
ByVal Row As Long, _
ByVal Column As String _
) As Long

GetCellHeight Returns the height of the cell in pixels.

Public Function GetCellHeight( _


ByVal Row As Long, _
ByVal Column As String _
) As Long

GetCellHotspotType Returns information on whether the cell is a hotspot or a


link. Method isCellHotspot cannot distinguish hotspots
Public Function GetCellHotspotType( _ and links, so this method can be used if you need to know
ByVal Row As Long, _ what the exact type is. Possible values are:
ByVal Column As String _
) As String • None (the cell does not have a hotspot nor a link)
• Hotspot (the cell has a hotspot or a hotspot AND a link)
• Link (the cell has a link)

GetCellIcon Return the icon string of the cell, if the cell contains an icon.
The string has the ABAP icon format '@xy@', where xy is a
Public Function GetCellIcon( _
ByVal Row As Long, _ number or character.
ByVal Column As String _
) As String

GetCellLeft Returns the left position of the cell in client coordinates.

Public Function GetCellLeft( _


ByVal Row As Long, _
ByVal Column As String _
) As Long

GetCellListBoxCount Returns the number of entries in the listbox of the cell.


Throws an exception if there is no listbox (valuelist / drop-
Public Function GetCellListBoxCount( _ down) in the specified cell. Also throws an exception if an
ByVal Row As Long, _ invalid row or column is specified.
ByVal Column As String _

) As Long

GetCellListBoxCurIndex Returns the index (0-based) of the currently selected listbox


entry. Throws an exception if there is no listbox (valuelist /
Public Function dropdown) in the specified cell. Also throws an exception
GetCellListBoxCurIndex( _ if an invalid row or column is specified. Default value (no
ByVal Row As Long, _ selection) is -1.
ByVal Column As String _

) As String

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 121
Method

Syntax Description

GetCellMaxLength Returns the maximum length of the cell in number of bytes.

Public Function GetCellMaxLength( _


ByVal Row As Long, _
ByVal Column As String _
) As Long

GetCellState Returns the state of the cell. Possible values are:

Public Function GetCellState( _ • Normal


ByVal Row As Long, _
ByVal Column As String _ • Error
) As String • Warning
• Info

GetCellTooltip Returns the tooltip of the cell.

Public Function GetCellTooltip( _


ByVal Row As Long, _
ByVal Column As String _
) As String

GetCellTop Returns the top position of the cell in client coordinates.

Public Function GetCellTop( _


ByVal Row As Long, _
ByVal Column As String _
) As Long

GetCellType This function returns the type of the specified cell. Possible
values are:
Public Function GetCellType( _
ByVal Row As Long, _ • Normal
ByVal Column As String _
) As String • Button
• Checkbox
• ValueList
• RadioButton

GetCellValue Returns the value of the cell as a string.

Public Function GetCellValue( _


ByVal Row As Long, _
ByVal Column As String _
) As String

GetCellWidth Returns the width of the cell in pixels.

Public Function GetCellWidth( _


ByVal Row As Long, _
ByVal Column As String _
) As Long

SAP GUI Scripting API


122 PUBLIC SAP GUI Scripting API
Method

Syntax Description

GetColorInfo Returns the description for the color of the cell.

Public Function GetColorInfo( _


ByVal Color As Long _
) As String

GetColumnDataType Returns the data type of the column according to the 'built-in
datatypes' of the XML schema standard.
Public Function GetColumnDataType( _
ByVal Column As String _
) As String

GetColumnOperationType Returns the type of mathematical operation applied to the


column. Possible values are:
Public Function
GetColumnOperationType ( _ • None
ByVal Column As String _ • Mean
) As String
• Minimum
• Maximum

This method as available as of SAP GUI for Windows 7.70


Patchlevel 1.

GetColumnPosition Returns the position of the column as shown on the screen,


starting from 1.
Public Function GetColumnPosition( _
ByVal Column As String _
) As Long

GetColumnSortType Returns the sort type of the column. Possible values are:

Public Function GetColumnSortType( _ • None


ByVal Column As String _
) As String • Ascending
• Descending

GetColumnTitles This function returns a collection of strings that are used


to display the title of a column. The control chooses the
Public Function GetColumnTitles( _
ByVal Column As String _ appropriate title according to the width of the column.
) As Object

GetColumnTooltip The tooltip of a column contains a text which is designed to


help the user understands the meaning of the column.
Public Function GetColumnTooltip( _
ByVal Column As String _
) As String

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 123
Method

Syntax Description

GetColumnTotalType Returns the total type of the column. Possible values are:

Public Function GetColumnTotalType( _ • None


ByVal Column As String _
) As String • Total
• Subtotal

GetDisplayedColumnTitle This function returns the title of the column that is currently
displayed. This text is one of the values of the collection
Public Function
GetDisplayedColumnTitle( _ returned from the function “getColumnTitles”.
ByVal Column As String _
) As String

GetRowTotalLevel Returns the level of the row.

Public Function GetRowTotalLevel( _


ByVal Row As Long _
) As Long

GetSymbolInfo Returns the description for the symbol in the cell.

Public Function GetSymbolInfo( _


ByVal Symbol As String _
) As String

GetToolbarButtonChecked Returns True if the button is currently checked (pressed).

Public Function
GetToolbarButtonChecked( _
ByVal ButtonPos As Long _
) As Byte

GetToolbarButtonEnabled Indicates if the button can be pressed.

Public Function
GetToolbarButtonEnabled( _
ByVal ButtonPos As Long _
) As Byte

GetToolbarButtonIcon Returns the name of the icon of the specified toolbar button.

Public Function
GetToolbarButtonIcon( _
ByVal ButtonPos As Long _
) As String

GetToolbarButtonId Returns the ID of the specified toolbar button, as defined in


the ABAP data dictionary.
Public Function GetToolbarButtonId( _
ByVal ButtonPos As Long _
) As String

SAP GUI Scripting API


124 PUBLIC SAP GUI Scripting API
Method

Syntax Description

GetToolbarButtonText Returns the text of the specified toolbar button.

Public Function
GetToolbarButtonText( _
ByVal ButtonPos As Long _
) As String

GetToolbarButtonTooltip Returns the tooltip of the specified toolbar button.

Public Function
GetToolbarButtonTooltip( _
ByVal ButtonPos As Long _
) As String

GetToolbarButtonType Returns the type of the specified toolbar button. Possible


values are
Public Function
GetToolbarButtonType( _ • Button
ByVal ButtonPos As Long _
) As String • ButtonAndMenu
• Menu
• Separator
• Group
• CheckBox

GetToolbarFocusButton Returns the position of the toolbar button that has the focus.
If no button in the toolbar has the focus, the method returns
Public Function
GetToolbarFocusButton() As Long -1.

HasCellF4Help Returns True if the cell has a value help.

Public Function HasCellF4Help( _


ByVal Row As Long, _
ByVal Column As String _
) As Byte

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 125
Method

Syntax Description

HistoryCurEntry Returns the text of the presently selected entry of the his-
tory list in the specified cell.
Public Function HistoryCurEntry( _
ByVal Row As Long, _
ByVal Column As String _  Note
) As String
• You can only use this method from an external pro-
gram (like Freedom Scientific JAWS), because the
history list is collapsed when a script accesses SAP
GUI
• If an invalid row index or column
name is specified, the method raises
an exception (RowIndexOutOfRange /
WrongColumnName)
• This method is available as of SAP GUI for Windows
7.60

HistoryCurIndex Returns the index (0-based) of the presently selected entry


of the history list in the specified cell.
Public Function HistoryCurIndex( _
ByVal Row As Long, _
ByVal Column As String _  Note
) As Long
• You can only use this method from an external pro-
gram (like Freedom Scientific JAWS), because the
history list is collapsed when a script accesses SAP
GUI
• If an invalid row index or column
name is specified, the method raises
an exception (RowIndexOutOfRange /
WrongColumnName)
• This method is available as of SAP GUI for Windows
7.60

HistoryIsActive This method returns true if the input history list is open for
the specified cell
Public Function HistoryIsActive( _
ByVal Row As Long, _
ByVal Column As String _  Note
) As Byte
• You can only use this method from an external pro-
gram (like Freedom Scientific JAWS), because the
history list is collapsed when a script accesses SAP
GUI
• If an invalid row index or column
name is specified, the method raises
an exception (RowIndexOutOfRange /
WrongColumnName)
• This method is available as of SAP GUI for Windows
7.60

SAP GUI Scripting API


126 PUBLIC SAP GUI Scripting API
Method

Syntax Description

HistoryList This method retrieves the list of input history entries of the
specified GuiGridView cell as a GuiCollection.
Public Function HistoryList( _
ByVal Row As Long, _  Note
ByVal Column As String _
) As GuiCollection • The values of the history list depend on the current
value contained in the cell
• If an invalid row index or column
name is specified, the method raises
an exception (RowIndexOutOfRange /
WrongColumnName)
• This method is available as of SAP GUI for Windows
7.60

InsertRows The parameter rows is a comma separated text of indices or


index ranges, for example “3,5-8,14,15”. For any single index,
Public Sub InsertRows( _
ByVal Rows As String _ a new row will be added at the given index, moving the old
) row one line down. If a range of indexes is inserted then
all the new lines are inserted as one block, before any of
the old lines. The entries must be ordered and not overlap,
otherwise, an exception is raised.

Example

0 Value A

1 Value B

If rows is “0,1”, then the resulting table would be:

1 Value A

3 Value B

If, on the other hand, rows is “0-1”, then the resulting table is:

2 Value A

3 Value B

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 127
Method

Syntax Description

IsCellHotspot Returns True if the cell is a link.

Public Function IsCellHotspot( _


ByVal Row As Long, _
ByVal Column As String _
) As Byte

IsCellSymbol Returns True if the text in the cell is displayed in the SAP
symbol font.
Public Function IsCellSymbol( _
ByVal Row As Long, _
ByVal Column As String _
) As Byte

IsCellTotalExpander Returns True if the cell contains a total expander button.

Public Function IsCellTotalExpander( _


ByVal Row As Long, _
ByVal Column As String _
) As Byte

IsColumnFiltered Returns True if a filter was applied to the column.

Public Function IsColumnFiltered( _


ByVal Column As String _
) As Byte

IsColumnKey Returns True if the column is marked as a key column.

Public Function IsColumnKey( _


ByVal Column As String _
) As Byte

IsTotalRowExpanded Returns true if the row containing an expander is currently


expanded.
Public Function IsTotalRowExpanded( _
ByVal Row As Long _
) As Byte

ModifyCell If row and column identify a valid editable cell and value has
a valid type for this cell, then the value of the cell is changed.
Public Sub ModifyCell( _
ByVal Row As Long, _ Otherwise, an exception is raised.
ByVal Column As String, _
ByVal Value As String _
)

SAP GUI Scripting API


128 PUBLIC SAP GUI Scripting API
Method

Syntax Description

ModifyCheckBox If row and column identify a valid editable cell containing a


checkbox, then the value of the cell is changed. Otherwise,
Public Sub ModifyCheckBox( _
ByVal Row As Long, _ an exception is raised.
ByVal Column As String, _
ByVal Checked As Boolean _
)

MoveRows The rows with an index greater than or equal to fromRow up


to an index less than or equal to toRow are moved to the
Public Sub MoveRows( _
ByVal FromRow As Long, _ position of destRow.
ByVal ToRow As Long, _
ByVal DestRow As Long _ Passing invalid index values as parameters raises an excep-
) tion.

PressButton This function emulates pressing a button placed in a given


cell. It will raise an exception if the cell does not contain a
Public Sub PressButton( _
ByVal Row As Long, _ button, or does not even exist.
ByVal Column As String _
)

PressButtonCurrentCell This function emulates pressing a button placed in the cur-


rent cell. It will raise an exception if the cell does not contain
Public Sub PressButtonCurrentCell()
a button.

PressColumnHeader This function emulates a mouse click on the header of the


column if the parameter identifies a valid column and raises
Public Sub PressColumnHeader( _
ByVal Column As String _ an exception otherwise.
)

PressEnter This emulates pressing the Enter key.

Public Sub PressEnter()

PressF1 This emulates pressing the F1 key while the focus is on the
grid view.
Public Sub PressF1()

PressF4 This emulates pressing the F4 key.

Public Sub PressF4()

PressToolbarButton This function emulates clicking a button in the grid view’s


toolbar.
Public Sub PressToolbarButton( _
ByVal Id As String _
)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 129
Method

Syntax Description

PressToolbarContextButton This emulates opening the context menu of the grid view’s
toolbar.
Public Sub
PressToolbarContextButton( _
ByVal Id As String _
)

PressTotalRow Pressing the total row button expands or condenses the


grouped rows. If the selected cell is not a total row cell an
Public Sub PressTotalRow( _
ByVal Row As Long, _ exception is raised.
ByVal Column As String _
)

PressTotalRowCurrentCell This function differs from pressTotalRow only in that it tries


to press the expansion button on the current cell.
Public Sub PressTotalRowCurrentCell()

SelectAll This function selects the whole grid content (i.e. all rows and
all columns).
Public Sub SelectAll()

SelectColumn This function adds the specified column to the collection of


the selected columns.
Public Sub SelectColumn( _
ByVal Column As String _
)

SelectionChanged This function notifies the server that the selection has
changed.
Public Sub SelectionChanged()

SelectToolbarMenuItem This function emulates the selection of an item from the


context menu of the grid view’s toolbar. The parameter
Public Sub SelectToolbarMenuItem( _
ByVal Id As String _ should be the function code of the item.
)

SetColumnWidth The width of a column can be set using this function. The
width is given in characters. For proportional fonts this re-
Public Sub SetColumnWidth( _
ByVal Column As String, _ fers to the width of an average character. Depending on the
ByVal Width As Long _ contents of the cell more or less characters may fit in the
) column. If the parameter is invalid an exception is raised.

SetCurrentCell If row and column identify a valid cell, this cell becomes the
current cell. Otherwise, an exception is raised.
Public Sub SetCurrentCell( _
ByVal Row As Long, _
ByVal Column As String _
)

SAP GUI Scripting API


130 PUBLIC SAP GUI Scripting API
Method

Syntax Description

TriggerModified Notifies the server of multiple changes in cells. Typically this


method should be called after multiple calls to ModifyCell.
Public Sub TriggerModified()

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 131
Property

Syntax Description

All properties of the GuiContainer Object [page 87]:

• Children

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

ColumnCount (Read-only) This property represents the number of columns in the con-
trol.
Public Property ColumnCount As Long

ColumnOrder (Read-write) This collection contains all the column identifiers in the or-
der in which they are currently displayed. Passing an invalid
Public Property ColumnOrder As Object
column identifier to this property will raise an exception.

CurrentCellColumn (Read-write) The string identifying a column is the field name defined in
the SAP data dictionary. In the example above the identifiers
Public Property CurrentCellColumn As
String are named CARRID, CONNID, FLDATE, PRICE etc.

CurrentCellRow (Read-write) The row index of the current cell ranges from 0 to the num-
ber of rows less 1, with -1 being the index of the title row.
Public Property CurrentCellRow As Long

FirstVisibleColumn (Read-write) This property represents the first visible column of the scrol-
lable area of the grid view. Fixed columns are ignored. Set-
Public Property FirstVisibleColumn As
String ting the property to an invalid column identifier will raise an
exception.

FirstVisibleRow (Read-write) This is the index of the first visible row in the grid. Setting
this property to an invalid row index will raise an exception.
Public Property FirstVisibleRow As
Long

FrozenColumnCount (Read-only) This property represents the number of columns that are
excluded from horizontal scrolling.
Public Property FrozenColumnCount As
Long

RowCount (Read-only) This property represents the number of rows in the control.

Public Property RowCount As Long

SAP GUI Scripting API


132 PUBLIC SAP GUI Scripting API
Property

Syntax Description

SelectedCells (Read-write) The collection of selected cells contains strings, each of


which has the format “<index of the row>,<column identi-
Public Property SelectedCells As
Object fier>”, such as “0,CARRID”. Trying to set this property to an
invalid value will raise an exception.

SelectedColumns (Read-write) The selected columns are available as a collection of strings


like the currentCellColumn string. Setting this property can
Public Property SelectedColumns As
Object raise an exception, if the new collection contains an invalid
column identifier.

SelectedRows (Read-write) The string is a comma separated list of row index numbers
or index ranges, such as “1,2,4-8,10”.Setting this property to
Public Property SelectedRows As String
an invalid string or a string containing invalid row indices will
raise an exception.

SelectionMode (Read-only) Possible values are

Public Property SelectionMode As • RowsAndColumns: Only rows and columns can be se-
String lected. Individual rectangular areas of cells are not al-
lowed.
• ListboxSingle: Only one single row can be selected.
• ListboxMultiple: One or more rows can be selected.
• Free: Any kind of selection can be made.

Title (Read-only) This property represents title of the grid control.

Public Property Title As String

ToolbarButtonCount (Read-only) The number of toolbar buttons including separators.

Public Property ToolbarButtonCount As


Long

VisibleRowCount (Read-only) Retrieves the number of visible rows of the grid.

Public Property VisibleRowCount As


Long

1.2.31 GuiHTMLViewer Object

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 133
Description

The GuiHTMLViewer is used to display an HTML document inside SAP GUI. GuiHTMLViewer extends the
GuiShell Object [page 207].

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

ContextMenu Calling contextMenu emulates the context menu request.


Note that this function applies only to context menus pro-
Public Sub ContextMenu()
vided by the backend, not to the local context menu, which is
generated by the HTML control.

GetBrowerControlType The returned number indicates which browser control is


used to host the HTML content within the HTML Control.
Public Function In SAP GUI for Windows 7.70, an alternative browser control
GetBrowerControlType() As Long based on Chromium Edge was implemented and it may be
required for a script developer to know which browser con-
trol is used at runtime:

• 0: Internet Explorer Control


• 1: Edge Control (based on Chromium) – available as of
SAP GUI for Windows 7.70

SAP GUI Scripting API


134 PUBLIC SAP GUI Scripting API
Method

Syntax Description

SapEvent This function submits an HTML form to the backend.

Public Sub SapEvent( _ Remarks


ByVal FrameName As String, _
ByVal PostData As String, _ If the form is to be submitted using the GET method, the
ByVal Url As String _ data is appended to the event name in the usual http URL
)
fashion, for example:

 Sample Code

sapEvent("Frame1","","
sapevent:SUBMIT_FORM_AS_GET_METHOD?
FirstName=John&LastName=Smith");

In this case, postData is always an empty string.

If the form is to be submitted using the POST method, the


data is transported in the postData parameter:

 Sample Code

sapEvent("Frame1",
"FirstName=John&LastName=Smith","
sapevent:SUBMIT_FORM_AS_POST_METHOD
");

FrameName This is the name of the


frame in which the HTML
form that has been submit-
ted lives.

PostData Contains the form data


when a submit is made us-
ing the POST method.

Url This is the URL, which is


submitted to the backend.
The protocol name for the
URL string is “sapevent:”.
This is followed by the name
of the event as defined in the
Action Property of the HTML
form, which is called.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 135
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

SAP GUI Scripting API


136 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

BrowserHandle (Read-only) Retrieves the handle of the browser control used inside SAP
GUI to display the HTML content.
Public Property BrowserHandle As
Object
 Note
In SAP GUI for Windows this property is only supported
when the Internet Explorer based HTML control is used,
because the Microsoft WebView2 control – the technical
foundation of the Microsoft Edge based HTML control –
does not support access to the handle.

DocumentComplete (Read-only)

Public Property DocumentComplete As


Long

1.2.32 GuiInputFieldControl Object

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 137
Method

Syntax Description

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

Submit Submits the input to the application.

Public Sub Submit()

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


138 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

ButtonTooltip (Read-only) Tooltip of the submit / find button.

Public Property ButtonTooltip As


String

FindButtonActivated (Read-only) This property is True when the current focus is on the Find
button.
Public Property FindButtonActivated
As Boolean

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 139
Property

Syntax Description

HistoryCurEntry (Read-only) Text of the currently focused entry in the history list box.
This property is empty, if the history list box is closed.
Public Property HistoryCurEntry As
String

HistoryCurIndex (Read-only) Currently focused index in the history dropdown list box.
This property contains -1, if the history list box is closed.
Public Property HistoryCurIndex As
Long

HistoryIsActive (Read-only) This property is True when the input history list box is cur-
rently opened.
Public Property HistoryIsActive As
Byte

HistoryList (Read-only) List of entries (strings) in the local history list box.

Public Property HistoryList As


GuiCollection

LabelText (Read-only) The text of the label belonging to the input field.

Public Property LabelText As String

PromptText (Read-only) The prompt text that is displayed in an empty input field, if
assigned by the application.
Public Property PromptText As String

Text (Read-write) Text content of the input field itself.

Public Property Text As String

1.2.33 GuiLabel Object

Description

GuiLabel extends the GuiVComponent Object [page 281]. The type prefix is lbl, the name is the fieldname
taken from the SAP data dictionary.

SAP GUI Scripting API


140 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 141
Method

Syntax Description

GetListProperty Remarks

Public Function GetListProperty( _


ByVal Property As String _
 Note
) As String
This method can only provide useful data when Accessi-
bility mode is activated and the respective ABAP list has
been properly enabled for accessibility. In this case, the
ABAP list contains substructures of type GuiSimpleCon-
tainer which, for example, model the rows of the list.

Attributes of containers in general

• ContainerType
• L: Entire list
• T: A table
• G: A group inside a table
• S: A subgroup (inside a group)
• R: A line in the body of a table
• B: A text box
• E: A tree
• F: Simple "free" text outside any box
• ContainerTitle: Title of a table (if provided) or of a text
box
• ContainerInputFields: Number of input fields, used if a
table or a tree has input fields (incl. checkboxes)

Attributes of containers of type L (Entire list)

• ListTablesTotal: Number of tables on the list


• ListTextBoxesTotal: Number of text boxes on the list
• ListTreesTotal: Number of trees on the list
• ListErrorMessage: Used if the structure recognition de-
tected a (severe) error.
• ListInputType
• N: list contains no input fields
• C: list contains check boxes
• E: list contains edit fields
• A: list contains edit fields and check boxes

Attributes of containers of type T (Table), G (Group) and S


(Subgroup)

• RowsTotal: Number of logical rows in the table body. If


this is an attribute of a (sub-)group, number of logical
rows until the next (sub-)group starts. The numbers do
NOT include summation lines and inserted lines.

SAP GUI Scripting API


142 PUBLIC SAP GUI Scripting API
Method

Syntax Description

• RowsSummation: Number of rows with color


COL_SUMMING INTENSIFIED ON (if there are any).
• RowsSubSummation: Number of rows with color
COL_SUMMING INTENSIFIED OFF (if there are any).
• RowsInserted: Number of inserted rows (if there are
any).

Attributes of containers of type T (Table)

• TableNo: Number of the table if there is more than one


table on the list
• ColumnsTotal: Number of logical columns
• SuperColumnsTotal: Used if the table has a hierarchical
header
• TableHierarchical: Used if the table is hierarchical-se-
quential
• A: ALV-like 2-level hierarchical-seq.
• 2: 2-level hierarchical-seq.
• 3: 3-level hierarchical-seq.
• TableGroupsTotal: Used if the table is hierarchical-seq.:
Number of groups (not counting subgroups)
• Columns2LevelALV: Used if TableHierarchical is "A":
Number of columns in the group header
• HeaderRows2LevelALV: Used if TableHierarchical is "A":
Number of lines in the group header
• TableHierarchicalHeader: Used if the table has a hier-
archical header
• TableMultipleRows: Used if the table is a multiple-line
table: Number of physical lines per logical line

Attributes of containers of type G (Group) and S (Subgroup)

• GroupNo: Number of current group if container is of


type G.
• SubGroupNo: Number of current subgroup if container
is of type S
• SubgroupsTotal: Number of subgroups if table is 3-level
hierarchical-sequential and container is of type G
• GroupHeaderRows: Number of physical lines in the
group header
• GroupHeaderValues: Number of label-value pairs in the
group header if the table is 2- or 3- level hierarchical-se-
quential

Attributes of containers of type R (Row)

• RowType: Used if the row has a special type


• S: Color COL_SUMMING INTENSIFIED ON
• U: Color COL_SUMMING INTENSIFIED OFF

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 143
Method

Syntax Description

• I: Inserted line
• RowNo: Number of current (logical) row, relative to the
beginning of the (sub-)group if the table is 3- or 2-level
hierarchical-seq.
• RowMultipleRows: Number of physical lines for current
logical line; used if > 1 (multiple-line tables). Lines with
totals may or may not be multiple lines
• RowInputFields: Number of input fields in the current
line (if any)

Attributes of fields in tables

• FieldHeader: The text of the column header (unavailable


if the field itself is in the header, or the field is the label
of a label-value pair in a hierarchical-sequential table, or
the field is in an inserted line and does not belong to any
column).
• FieldSuperHeader: Text of the supercolumn if the field is
in the lower line of a hierarchical header or in the table
body (and belongs to a column).
• ColumnNo: The number of the logical column (if the
field belongs to a column).
• LabelType: Used if the field is in the header or is a label
of a label-value pair in a hierarchical-seq. table.
• N: normal header field (lowest level in hierar.-seq.
tables)
• H: header field in a supercolumn (upper line of a
hierarchical header)
• A: group header field (COL_GROUPING INTENSI-
FIED ON) in table whereTableHierarchical is A
• G: group header field (COL_GROUPING INTENSI-
FIED ON) in 2-level hierarchical-sequential table
• S: subgroup header field (COL_HEADING INTENSI-
FIED ON) in 3-level hierarchical-sequential table
• T: title-field COL_NORMAL INTENSIFIED ON
• ColumnType: Used if the field is a column header of a
special column.
• C: column contains checkboxes
• S: column contains symbols and/or icons
• SubordinateColumns: Number of subordinate columns
if the field is in the upper line of a hierarchical header.
• FieldMultipleRows: Used if the field is in a table header
and word wrapping was done: Number of physical lines
of the "logical field".
• FieldWithEllipsis: The field is directly followed by
SYM_ELLIPSIS, i.e. "...".

Attributes of fields in tables, trees or title lines of text boxes

SAP GUI Scripting API


144 PUBLIC SAP GUI Scripting API
Method

Syntax Description

• FieldPhysRowNo: If we are in the body of a multiple-line


table or in a multiple-line node of a tree or word wrap-
ping is used in the table header: Current physical line
number within the logical line.

Attributes of text boxes

• TextBoxNo: Number of the text box if there is more than


one text box on the list

Attributes of containers in an SEUT tree

• TreeNo: Number of the tree if there is more than one


tree on the list and the current container is the root
node
• NodeName: Text of the first field of the node (STREE-
NODE-NAME)
• NodeLevelNo: The current level number; the root has
level 0
• NodeNo: The current node number; the "oldest brother"
has number 1.
• NodeExpandable: Used if the current node can be ex-
panded (folder with "+").
• NodeMarked: Node has been marked (yellow in SEUT).
• NodeChildrenTotal: Used if the current node is ex-
panded (folder with "-"): Number of children. (Grand
children are not counted.)
• NodeMultipleRows: Used if the current node has more
than one physical line: Number of physical lines

GetListPropertyNonRec
 Note
Public Function This method can only provide useful data when Accessi-
GetListPropertyNonRec( _
ByVal Property As String _ bility mode is activated and the respective ABAP list has
) As String been properly enabled for accessibility. In this case, the
ABAP list contains substructures of type GuiSimpleCon-
tainer which, for example, model the rows of the list.

This method returns information that is compiled on the


server to enhance the ABAP lists with accessibility informa-
tion. See GuiLabel Object [page 140] → GetListProperty
for a description of available attributes. In contrast to the
method GetListProperty, GetListPropertyNonRec will only
return information that is set for the specific element and
ignore list properties set for parent elements.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 145
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

CaretPosition (Read-write) Setting the caret position within a label is possible even
though it is not visualized as a caret by SAP GUI. However,
Public Property CaretPosition As Long
the position is transmitted to the server, so ABAP application
logic may depend on this position.

Height of the GuiLabel in character metric.


CharHeight (Read-only)

Public Property CharHeight As Long

SAP GUI Scripting API


146 PUBLIC SAP GUI Scripting API
Property

Syntax Description

Left coordinate of the GuiLabel in character metric.


CharLeft (Read-only)

Public Property CharLeft As Long

Top coordinate of the GuiLabel in character metric.


CharTop (Read-only)

Public Property CharTop As Long

Width of the GuiLabel in character metric.


CharWidth (Read-only)

Public Property CharWith As Long

ColorIndex (Read-only) This number defines the index of the list color of this ele-
ment.
Public Property ColorIndex As Long

ColorIntensified (Read-only) This property is True if the Intensified flag is set in screen
painter for this dynpro element.
Public Property ColorIntensified As
Byte

ColorInverse (Read-only) This property is True if the inverse color style is set in screen
painter for the element.
Public Property ColorInverse As Byte

DisplayedText (Read-only) This property contains the text as it is displayed on the


screen, including preceding or trailing blanks. These blanks
Public Property DisplayedText As
String are stripped from the text property.

Highlighted (Read-only) This property is True if the Highlighted flag is set in the
screen painter for the dynpro element.
Public Property Highlighted As Byte

IsHotspot (Read-only) Dynpro elements such as labels may be configured to cause


a round trip when they are clicked. In that case the mouse
Public Property IsHotspot As Byte
cursor changes to the hand shape. This is called a hot spot.

IsLeftLabel (Read-only) This property is set if the label has been assigned as the left
label of another control.
Public Property IsLeftLabel As Byte

IsListElement (Read-only) This property is True if the element is on an ABAP list, not a
dynpro screen.
Public Property IsListElement As Byte

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 147
Property

Syntax Description

IsRightLabel (Read-only) This property is set if the label has been assigned as the
right label of another control.
Public Property IsRightLabel As Byte

MaxLength (Read-only) The maximum text length of a label is counted in code units.
On non-Unicode clients these are equivalent to bytes.
Public Property MaxLength As Long

Numerical (Read-only) This flag is True if the label may only contain numbers.

Public Property Numerical As Byte

RowText (Read-only) This property is only available in ABAP list screens. It returns
the text of the while line containing the current component.
Public Property RowText As String
 Note
This property can only provide useful data when Acces-
sibility mode is activated and the respective ABAP list
has been properly enabled for accessibility. In this case,
the ABAP list contains substructures of type GuiSimple-
Container which, for example, model the rows of the list.

1.2.34 GuiMainWindow Object

Description

This window represents the main window of an SAP GUI session.

GuiMainWindow extends the GuiFrameWindow Object [page 105].

SAP GUI Scripting API


148 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All additional methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All additional methods of the GuiFrameWindow Object [page 105]:

• Close
• CompBitmap
• HardCopy
• HardCopyToMemory
• Iconify
• IsVKeyAllowed
• JumpBackward
• JumpForward
• Maximize
• Restore
• SendVKey
• ShowMessageBox
• TabBackward
• TabForward

ResizeWorkingPane The ResizeWorkingPane function will resize the window so


that the available working area has the given width and
Public Sub ResizeWorkingPane( _
ByVal Width As Long, _ height in character metric.
ByVal Height As Long, _
ByVal ThrowOnFail As Boolean _ ThrowOnFail: The throwOnFail parameter has been
) added for use in the SAP GUI for Java because some window
managers may not support a program driven resize of a
window.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 149
Method

Syntax Description

ResizeWorkingPaneEx The ResizeWorkingPaneEx function will resize the window


so that the available working area has the given width and
Public Sub ResizeWorkingPaneEx( _
ByVal Width As Long, _ height in pixels.
ByVal Height As Long, _
ByVal ThrowOnFail As Boolean _ Remarks
)
This method is only used during recording if the DWORD
registry key ResizeWorkingPaneEx in patch HKCU\Soft-
ware\SAP\SAPGUI Front\SAP Frontend Server\Scripting ex-
ists and has the value 1.

Table GUI_FKEY
Refer to Table GUI_FKEY [page 152]

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


150 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All properties of the GuiFrameWindow Object [page 105]:

• ElementVisualizationMode
• GuiFocus
• Handle
• Iconic
• SystemFocus
• WorkingPaneHeight
• WorkingPaneWidth

ButtonbarVisible (Read-write) This property it True if the application toolbar, the lower tool-
bar within SAP GUI, is visible. Setting this property to False
Public Property ButtonbarVisible As
Byte will hide the application toolbar.

StatusbarVisible (Read-write) This property it True if the status bar at the bottom of the
SAP GUI window is visible. Setting this property to False will
Public Property StatusbarVisible As hide the status bar. When the status bar is hidden, messages
Byte will be displayed in a popup instead.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 151
Property

Syntax Description

TitlebarVisible (Read-write) This property it True if the title bar is visible. Setting this
property to False will hide the title bar.
Public Property TitlebarVisible As
Byte Remarks

The title bar is only available in New Visual Design, not in


Classic Design.

ToolbarVisible (Read-write) This property it True if the system toolbar, the upper toolbar
within SAP GUI, is visible. Setting this property to False will
Public Property ToolbarVisible As Byte
hide the system toolbar.

1.2.34.1 Table GUI_FKEY

VKey Keyboard Combination

00 Enter

01 F1

02 F2

03 F3

04 F4

05 F5

06 F6

07 F7

08 F8

09 F9

10 F10

11 Ctrl+S

12 F12

13 Shift+F1

14 Shift+F2

15 Shift+F3

16 Shift+F4

17 Shift+F5

18 Shift+F6

19 Shift+F7

SAP GUI Scripting API


152 PUBLIC SAP GUI Scripting API
VKey Keyboard Combination

20 Shift+F8

21 Shift+F9

22 Shift+Ctrl+0

23 Shift+F11

24 Shift+F12

25 Ctrl+F1

26 Ctrl+F2

27 Ctrl+F3

28 Ctrl+F4

29 Ctrl+F5

30 Ctrl+F6

31 Ctrl+F7

32 Ctrl+F8

33 Ctrl+F9

34 Ctrl+F10

35 Ctrl+F11

36 Ctrl+F12

37 Ctrl+Shift+F1

38 Ctrl+Shift+F2

39 Ctrl+Shift+F3

40 Ctrl+Shift+F4

41 Ctrl+Shift+F5

42 Ctrl+Shift+F6

43 Ctrl+Shift+F7

44 Ctrl+Shift+F8

45 Ctrl+Shift+F9

46 Ctrl+Shift+F10

47 Ctrl+Shift+F11

48 Ctrl+Shift+F12

70 Ctrl+E

71 Ctrl+F

72 Ctrl+/

73 Ctrl+\

74 Ctrl+N

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 153
VKey Keyboard Combination

75 Ctrl+O

76 Ctrl+X

77 Ctrl+C

78 Ctrl+V

79 Ctrl+Z

80 Ctrl+PageUp

81 PageUp

82 PageDown

83 Ctrl+PageDown

84 Ctrl+G

85 Ctrl+R

86 Ctrl+P

1.2.35 GuiMap Object

Description

For the map control only basic members from GuiShell are available. Recording and playback is not possible.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

SAP GUI Scripting API


154 PUBLIC SAP GUI Scripting API
Method

Syntax Description

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All additional methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 155
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

SAP GUI Scripting API


156 PUBLIC SAP GUI Scripting API
1.2.36 GuiMenu Object

Description

A GuiMenu may have other GuiMenu objects as children. GuiMenu extends the GuiVContainer Object [page
286]. The type prefix is menu, the name is the text of the menu item. If the item does not have a text, which is
the case for separators, then the name is the last part of the id, menu[n].

Methods

Method

Syntax Description

The following methods of the GuiVComponent Object [page 281] (SetFocus is not supported):

• DumpState
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

Select Select the menu.

Public Sub Select()

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 157
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

The following properties of the GuiVComponent Object [page 281] (some properties like the Accessibility properties are
not supported, because they are not needed):

• Changeable
• DefaultTooltip
• Height
• IconName
• Left
• Modified
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

1.2.37 GuiMenubar Object

Description

Only the main window has a menubar. The children of the menubar are menus. GuiMenubar extends the
GuiVContainer Object [page 286]. The type prefix and name are mbar.

SAP GUI Scripting API


158 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 159
Property

Syntax Description

The following properties of the GuiVComponent Object [page 281] (some properties like the Accessibility properties are
not supported, because they are not needed):

• Changeable
• DefaultTooltip
• Height
• IconName
• Left
• Modified
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

1.2.38 GuiMessageWindow

GuiMessageWindow objects are used to display success, warning and error messages raised by ABAP
applications when the respective options in the SAP GUI options dialog are activated ( Interaction Design
Notifications ).

GuiMessageWindow extends GuiVComponent and offers a title, a text and two buttons which can be accessed
via scripting. The name of the GuiMessageWindow object is msgwnd.

SAP GUI Scripting API


160 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

The following properties of the GuiVComponent Object [page 281]:

• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• Text
• Tooltip
• Top
• Width

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 161
Property

Syntax Description

FocusedButton (Read-only) This property contains the value 1 if the OK button is fo-
cused.
Public Property FocusedButton As Long

HelpButtonHelpText (Read-only) This property contains the tooltip (help text) of the help
button (if any).
Public Property HelpButtonHelpText As
String

HelpButtonText (Read-only) This property contains the text of the help button.

Public Property HelpButtonText As


String

MessageText (Read-only) This property contains the text of the message displayed in
the message box.
Public Property MessageText As String

MessageType (Read-only) This property contains the type of the message displayed.
The following values are possible:
Public Property MessageType As Long
• 2: Warning message
• 3: Error message
• 5: Success message

OKButtonHelpText (Read-only) This property contains the tooltip (help text) of the OK but-
ton (if any).
Public Property OKButtonHelpText As
String

OKButtonText (Read-only) This property contains the text of the OK button.

Public Property OKButtonText As String

ScreenLeft (Read-write) The y position of the component in screen coordinates.

For GuiMessageWindow, this property can be written to


Public Property ScreenLeft As Long
move the message window to the desired coordinates.

ScreenTop (Read-write) The x position of the component in screen coordinates.

For GuiMessageWindow, this property can be written to


Public Property ScreenTop As Long
move the message window to the desired coordinates.

Visible (Read-only) This property is True if a GuiMessageWindow is presently


displayed.
Public Property Visible As Byte

SAP GUI Scripting API


162 PUBLIC SAP GUI Scripting API
1.2.39 GuiModalWindow Object

Description

A GuiModalWindow is a dialog pop-up.

GuiModalWindow extends the GuiFrameWindow Object [page 105].

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 163
Method

Syntax Description

All methods of the GuiFrameWindow Object [page 105]:

• Close
• CompBitmap
• HardCopy
• HardCopyToMemory
• Iconify
• IsVKeyAllowed
• JumpBackward
• JumpForward
• Maximize
• Restore
• SendVKey
• ShowMessageBox
• TabBackward
• TabForward

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


164 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All properties of the GuiFrameWindow Object [page 105]:

• ElementVisualizationMode
• GuiFocus
• Handle
• Iconic
• SystemFocus
• WorkingPaneHeight
• WorkingPaneWidth

IsPopupDialog (Read-write) Some modal windows represent popup dialogs. In this case
the IsPopupDialog property is True. Popup dialogs are identi-
Public Property IsPopupDialog() As
Boolean fied by checking the ABAP source name and dynpro number.
Currently the following are supported:

• SAPLSPO1 / 500 (Function module Popup_To_Confirm)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 165
Property

Syntax Description

PopupDialogText (Read-write) The text of the input fields of the popup dialog in a concaten-
ated form.
Public Property PopupDialogText As
String

1.2.40 GuiNetChart Object

Description

The GuiNetChart is a powerful tool to display and modify entity relationship diagrams. It is of a very technical
nature and should only be used for recording and playback, as most of the parameters cannot be determined in
any other way.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

SAP GUI Scripting API


166 PUBLIC SAP GUI Scripting API
Method

Syntax Description

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

GetLinkContent Returns the content of the link.

Public Function GetLinkContent( _ linkId: Index of the link


ByVal linkId As Long, _
ByVal textId As Long _ textId: Internal value, do be determined during recording.
) As String

GetNodeContent Returns the content of the node.

Public Function GetNodeContent( _ nodeId: Index of the node.


ByVal nodeId As Long, _
ByVal textId As Long _ textId: Internal value, do be determined during recording.
) As String

SendData This function emulates the output of each action triggered at


the control side. The result of the action is sent to the server.
Public Sub SendData( _
ByVal Data As String _ It’s currently not possible to select – deselect single objects
)
at the client-side and to replay/script these “local” actions.

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 167
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

LinkCount (Read-only) Number of links in the net.

Public Property LinkCount As Long

NodeCount (Read-only) Number of Nodes in the net.

Public Property NodeCount As Long

SAP GUI Scripting API


168 PUBLIC SAP GUI Scripting API
1.2.41 GuiOfficeIntegration Object

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All additional methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All additional methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

AppendRow This function appends a new row to a table specified by the


parameter name in the table collection. The parameter row
Public Sub AppendRow( _
ByVal Name As String, _ is the base64 representation of the binary row.
ByVal Row As
String _
)

CloseDocument This function sends the close event of the document speci-
fied by the parameter cookie to the server.
Public Sub CloseDocument( _
ByVal Cookie As Long, _
ByVal EverChanged As Byte, _
ByVal ChangedAfterSave As
Byte _
)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 169
Method

Syntax Description

CustomEvent This function sends the custom event eventName to the


server. The document specified by the parameter cookie is
Public Sub CustomEvent( _
ByVal Cookie As Long, _ the source.
ByVal EventName As String, _
ByVal ParamCount As Long, _
Optional ByVal Par1 As Variant, _
Optional ByVal Par2 As Variant, _
Optional ByVal Par3 As Variant, _
Optional ByVal Par4 As Variant, _
Optional ByVal Par5 As Variant, _
Optional ByVal Par6 As Variant, _
Optional ByVal Par7 As Variant, _
Optional ByVal Par8 As Variant, _
Optional ByVal Par9 As Variant, _
Optional ByVal Par10 As Variant, _
Optional ByVal Par11 As Variant, _
Optional ByVal Par12 As Variant _
)

RemoveContent This function removes the content of a table in the table


collection. The parameter name is the name of the table.
Public Sub RemoveContent( _
ByVal Name As String _
)

SaveDocument This function sends the save event of the document speci-
fied by the parameter cookie to the server.
Public Sub SaveDocument( _
ByVal Cookie As Long, _
ByVal Changed As Byte _
)

SetDocument This function replaces or adds a new document with the


specified index. The parameter document is the base64-rep-
Public Sub SetDocument( _
ByVal Index As Long, _ resentation of the binary document.
ByVal Document As String _
)

SAP GUI Scripting API


170 PUBLIC SAP GUI Scripting API
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 171
Property

Syntax Description

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

Document (Read-only) The document hosted inside the GuiOfficeIntegration object.

Public Property Document As Object

HostedApplication (Read-only) This property contains an index identifying the application


hosted in the GuiOfficeIntegartion object. Possible values
Public Property HostedApplication As are:
Long
1. Microsoft Word (value = "1")
2. Microsoft Excel (value = "2")
3. Microsoft Powerpoint (value = "3")

1.2.42 GuiOkCodeField Object

Description

The GuiOkCodeField is placed on the upper toolbar of the main window. It is a combo box into which
commands can be entered. Setting the text of GuiOkCodeField will not execute the command until server
communication is started, for example by emulating the Enter key (VKey 0). GuiOkCodeField extends the
GuiVComponent Object [page 281]. The type prefix is okcd, the name is empty.

Example

SAP GUI Scripting API


172 PUBLIC SAP GUI Scripting API
Methods

Method Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

PressF1 Emulate pressing the F1 key while the focus is on the GuiOk-
CodeField.
Public Sub PressF1()

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

The following properties of the GuiVComponent Object [page 281] (some properties are not supported, because the
GuiOkCodeField is not an object that can be influenced by the ABAP application):

• Changeable
• Height
• IconName
• Left
• Modified
• ScreenLeft
• ScreenTop
• Text
• Top
• Width

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 173
Property

Syntax Description

Opened (Read-only) In SAP GUI designs newer than Classic design the GuiOkCo-
deField can be collapsed using the arrow button to the right
Public Property Opened As Byte
of it. In SAP GUI for Windows the GuiOkCodeField may also
be collapsed via a setting in the Windows registry.

This property contains False is the GuiOkCodeField is col-


lapsed.

1.2.43 GuiPasswordField Object

Description

There are some differences between GuiTextField and GuiPasswordField:

• The Text and DisplayedText properties cannot be read for a password field. The returned text is always
empty. During recording the password is also not saved in the recorded script.

• The properties HistoryCurEntry, HistoryCurIndex, HistoryIsActive and HistoryList are not supported,
because password fields do not offer an input history

• The property IsListElement is not supported, because password fields cannot be placed on ABAP lists

GuiPasswordField extends the GuiTextField [page 250]. The type prefix is pwd, the name is the fieldname taken
from the SAP data dictionary.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

SAP GUI Scripting API


174 PUBLIC SAP GUI Scripting API
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 175
Property

Syntax Description

All properties of the GuiTextField [page 250]:

• CaretPosition
• DisplayedText
• Highlighted
• IsHotspot
• sLeftLabel
• IsOField
• IsRightLabel
• LeftLabel
• MaxLength
• Numerical
• Required
• RightLabel

1.2.44 GuiPicture Object

Description

The picture control displays a picture on an SAP GUI screen. GuiPicture extends the GuiShell Object [page
207].

Methods

Method Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

SAP GUI Scripting API


176 PUBLIC SAP GUI Scripting API
Method Description

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

Click This function emulates a single mouse click on a picture.

Public Sub Click()

ClickControlArea The function emulates a click on a given position. The coor-


dinates should be given in pixels with respect to the picture
Public Sub ClickControlArea( _
ByVal x As Long, _ control as it is displayed on the screen.
ByVal y As
Long _
)

ClickPictureArea The function emulates a click on a given position. The coor-


dinates should be given in pixels with respect to the original
Public Sub ClickPictureArea( _
ByVal x As Long, _ picture file. They may differ from the pixel coordinates of the
ByVal y As displayed picture because of scaling.
Long _
)

ContextMenu The function opens a context menu on the given position.


The coordinates should be given in pixels with respect to the
Public Sub ContextMenu( _
ByVal x As Long, _ picture control as it is displayed on the screen.
ByVal y As
Long _
)

DoubleClick This function emulates a double-click on a picture.

Public Sub DoubleClick()

DoubleClickControlArea The function emulates a double-click on a given position.


The coordinates should be given in pixels with respect to the
Public Sub DoubleClickControlArea( _
ByVal x As Long, _ picture control as it is displayed on the screen.
ByVal y As
Long _
)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 177
Method Description

DoubleClickPictureArea The function emulates a double-click on a given position.


The coordinates should be given in pixels with respect to
Public Sub DoubleClickPictureArea( _
ByVal x As Long, _ the original picture file. They may differ from the pixel coor-
ByVal y As dinates of the displayed picture because of scaling.
Long _
)

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


178 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

AltText (Read-only) This property contains the alternative text that can be as-
signed to an image (for example used for visually impaired
Public Property AltText() As String people when a screenreader is used).

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 179
Property

Syntax Description

DisplayMode (Read-only) Possible values of this property are:

Public Property DisplayMode() As • ”Normal”: This value indicated that the picture is shown
String in its original size. If the picture’s size is larger than the
size of the control, the control provides scrollbars. If the
picture’s size is smaller than the size of the control, the
picture is shown in the upper left corner of the control.
• “Stretch”: The picture is resized in a way that it always
occupies the complete area of the control.
• “Fit”: The picture is resized on way that it fits into the
control area without having the need to show scrollbars.
In contrast to “Strech” the mode “Fit” preserves the
ratio of width and height of the picture.
• “NormalCenter”: Like “Normal” except that the picture
is not shown in the upper left corner but in the center of
the control.
• “FitCenter”: Like “Fit” except that the picture is not
shown in the upper left corner but in the center of the
control.

Icon (Read-only) Returns the SAPGUI icon code (e.g. “@01@”) of the dis-
played icon. If no icon is displayed, the property contains
Public Property Icon() As String
an empty string.

Url (Read-only) Returns the URL of the displayed picture. If an icon is


displayed (see property “icon”), the property contains an
Public Property Url() As String
empty string. Depending in the application that used the
control the URL may contain temporary URL parts (e.g.
UUIDs).

1.2.45 GuiRadioButton Object

Description

GuiRadioButton extends the GuiVComponent Object [page 281]. The type prefix is rad, the name is the
fieldname taken from the SAP data dictionary.

SAP GUI Scripting API


180 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

Select Selecting a radio button automatically deselects all the other


buttons within that group. This may cause a server round-
Public Sub Select()
trip, depending on the definition of the button in the screen
painter.

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 181
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

CharHeight (Read-only) Height of the GuiRadioButton in character metric.

Public Property CharHeight As Long

CharLeft (Read-only) Left coordinate of the GuiRadioButton in character metric.

Public Property CharLeft As Long

CharTop (Read-only) Top coordinate of the GuiRadioButton in character metric.

Public Property CharTop As Long

CharWidth (Read-only) Width of the GuiRadioButton in character metric.

Public Property CharWidth As Long

Flushing (Read-only) Some components such as radio buttons or checkboxes


may cause a round trip when their value is changed. If this is
Public Property Flushing As Byte
the case, the Flushing property is True.

GroupCount (Read-only) The number of radio buttons in the same group the current
object belongs to.
Public Property GroupCount As Long

SAP GUI Scripting API


182 PUBLIC SAP GUI Scripting API
Property

Syntax Description

GroupMembers (Read-only)
 Example
Public Property GroupMembers As The collection of GuiRadioButton objects belonging to
GuiComponentCollection
the same radio button group.

Example:

Set GroupMembers
= session.findById("wnd[0]/usr/
radRB2").GroupMembers
For Each GroupMember In
GroupMembers
MsgBox GroupMember.Text
Next

GroupPos (Read-only) The position of the radio button in the respective radio but-
ton group (ranging from 1 to GroupCount).
Public Property GroupPos As Long

IsLeftLabel (Read-only) This property is True if the component has the 'assign left'
flag.
Public Property IsLeftLabel As Byte

IsRightLabel (Read-only) This property is True if the component has the 'assign right'
flag.
Public Property IsRightLabel As Byte

LeftLabel Left label of the GuiRadioButton. The label is assigned in the


Screen Painter, using the flag 'assign left'.
Public Property LeftLabel As
GuiVComponent

RightLabel Right label of the GuiRadioButton. This property is set in


Screen Painter using the 'assign right' flag.
Public Property RightLabel As
uiVComponent

Selected (read-only) This property is True if the GuiRadioButton is selected. In a


group of radiobuttons, only a single button can be selected.
Public Property Selected As Byte This means, when selecting a radiobutton via this property,
the previously selected radiobutton in the same group be-
comes deselected. As an alternative to this property, you can
also use method Select to select a radiobutton.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 183
1.2.46 GuiSapChart Object

Description

For the SAP chart control only basic members from GuiShell are available. Recording and playback is not
possible.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

SAP GUI Scripting API


184 PUBLIC SAP GUI Scripting API
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 185
Property

Syntax Description

All properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

1.2.47 GuiScrollbar Object

Description

The GuiScrollbar class is a utility class used for example in GuiScrollContainer or GuiTableControl.

Properties

Property

Syntax Description

Maximum (Read-only) This is the maximum position of the scrollbar thumb in pix-
els.
Public Property Maximum As Long

Minimum (Read-only) This is the minimum position of the scrollbar thumb in pixels.

Public Property Minimum As Long

PageSize (Read-only) When the user scrolls down a page, position will be increased
by the value of pageSize.
Public Property PageSize As Long

Position (Read-write) The position of the thumb of the scrollbar can be set to
values from minimum to maximum.
Public Property Position As Long

SAP GUI Scripting API


186 PUBLIC SAP GUI Scripting API
Property

Syntax Description

Range (Read-only) The value of this property depends on the element the scroll-
bar belongs to. In a Table Control, for example, it specifies
Public Property Range As Long
the number of scrollable columns or rows.

1.2.48 GuiScrollContainer Object

Description

This container represents scrollable subscreens. A subscreen may be scrollable without actually having a
scrollbar, because the existence of a scrollbar depends on the amount of data displayed and the size of the
GuiUserArea. GuiScrollContainer extend sthe GuiVContainer Object [page 286]. The type prefix is ssub, the
name is generated from the data dictionary settings.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 187
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

HorizontalScrollbar (Read-write) The horizontal scrollbar of the scroll container.

Public Property HorizontalScrollbar


As GuiScrollbar

SAP GUI Scripting API


188 PUBLIC SAP GUI Scripting API
Property

Syntax Description

VerticalScrollbar (Read-write) The vertical scrollbar of the scroll container.

Public Property VerticalScrollbar As


GuiScrollbar

1.2.49 GuiSession Object

Description

The GuiSession provides the context in which a user performs a certain task such as working with a
transaction. It is therefore the access point for applications, which record a user’s actions regarding a specific
task or play back those actions. GuiSession extends GuiContainer. The type prefix is ses, the name is ses plus
the session number in square brackets.

Remarks

GuiSession is self-contained in that ids within the context of a session remain valid independently of other
connections or sessions being open at the same time. Usually an external application will first determine with
which session to interact. Once that is clear, the application will work more or less exclusively on that session.
Traversing the object hierarchy from the GuiApplication to the user interface elements, it is the session among
whose children the highest level visible objects can be found. In contrast to objects like buttons or text fields,
the session remains valid until the corresponding main window has been closed, whereas buttons, for example,
are destroyed during each server communication.

Methods

Method

Syntax Description

All methods of the GuiContainer Object [page 87]:

• FindById

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 189
Method

Syntax Description

AsStdNumberFormat Depending on the system's number format the minus sign


of numbers may be placed to the right of the number. Using
Public Function AsStdNumberFormat( _
ByVal Number As String _ this function the minus sign is moved to the left.
) As String

ClearErrorList This method clears the list of errors that may be created
when ActiveX controls are found on a screen that do not
Public Sub ClearErrorList()
support SAP GUI Scripting. Otherwise the list is cleared after
an error event was raised. This happens at the end of a
round trip.

CreateSession This function opens a new session, which is then visualized


by a new main window. This resembles the “/o” command
Public Sub CreateSession()
that can be executed from the command field.

EnableJawsEvents Enable the sending of events to the screenreader Freedom


Scientific JAWS, which communicates with SAP GUI for Win-
Public Sub EnableJawsEvents() dows via the Scripting API. By default the sending of events
is activated.

EndTransaction Calling this function has the same effect as SendCom-


mand("/n").
Public Sub EndTransaction()

FindByPosition This method can be used to do a hittest on an SAP GUI


session. The parameters x and y should be given in screen
Public Function FindByPosition( _
ByVal x As Long, _ coordinates. If no component is found an exception is raised
ByVal y As Long, _ unless raise is set to False. In that case a Null/Nothing object
Optional ByVal Raise As Variant _ is returned.
) As GuiCollection

GetIconResourceName In SAP GUI icons are often described as text in the format
@nn@ where nn is a number. The function getIconResource-
Public Function GetIconResourceName( _
ByVal Text As String _ Name translates the @nn@ notation into the name of the
) As String resource in sapbtmp.dll.

SAP GUI Scripting API


190 PUBLIC SAP GUI Scripting API
Method

Syntax Description

GetObjectTree This method was introduced in SAP GUI for Windows 7.70
patchlevel 3.
Public Function GetObjectTree ( _
ByVal Id As String, _ GetObjectTree returns the object tree of the current SAP GUI
Optional ByVal props As Variant _
) As String tree as a JSON string. You can use this JSON to determine
the information on the SAP GUI UI elements you need.

Some SAP GUI Scripting based applications need to parse


the SAP GUI Object tree to get the values of certain prop-
erties for all objects on a screen. This could be achieved
via individual COM calls to the elements, but this approach
is very time consuming due to a large overhead in COM
itself. Therefore, the performance may not be good enough
in many cases.

Via parameter Id you can limit the output to a subnode of the


object tree and all its children (for example for a dialog win-
dow). If this parameter is supplied as an empty string, the
complete object tree of the respective session is exported
along with Screen Number, Program and Transaction code.

The parameter props can be used to specify which proper-


ties of all elements are required. If this parameter is not
supplied, only the id property of each object is put into the
output. The parameter needs to contain an array with names
or GuiDispIds of the properties to be exported, see also Gui-
MagicDispIDs [page 301].

 Note
The properties can only be of simple types: String,
Integer, Bool. Exceptions are LetfLabel and RightLabel.
Even though these properties return objects they can be
gathered, but instead of an object the id of the respec-
tive GuiLabel will be retrieved.

 Example
The following is a vbs example

 Sample Code

arrayOfStrings = Array()
arrayOfStrings =
AddItem(arrayOfStrings, "Id")
arrayOfStrings =
AddItem(arrayOfStrings, "Text")

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 191
Method

Syntax Description

arrayOfStrings =
AddItem(arrayOfStrings, "Type")
arrayOfStrings =
AddItem(arrayOfStrings,
"IconName")
or
arrayOfDispIds = Array()
arrayOfDispIds =
AddItem(arrayOfDispIds, 32025)
arrayOfDispIds =
AddItem(arrayOfDispIds, 32000)
arrayOfDispIds =
AddItem(arrayOfDispIds, 32015)
arrayOfDispIds =
AddItem(arrayOfDispIds, 32037)
Both lead to the same output.
Overall example:
arrayOfStrings = Array()
arrayOfStrings =
AddItem(arrayOfStrings, "Id")
arrayOfStrings =
AddItem(arrayOfStrings, "Text")
arrayOfStrings =
AddItem(arrayOfStrings, "Type")
arrayOfStrings =
AddItem(arrayOfStrings,
"IconName")
session.GetObjectTree
("wnd[1]", arrayOfStrings)
exports all elements of a
dialog window and the values
of the properties “Id”, “Text”,
“Type” and “IconName”.
' add item to array
Function AddItem(arr, val)
ReDim Preserve
arr(UBound(arr) + 1)
arr(UBound(arr)) = val
AddItem = arr
End Function

SAP GUI Scripting API


192 PUBLIC SAP GUI Scripting API
Method

Syntax Description

This can look like this:

 Sample Code
The following is a c# example

With names:
string[] strArr = new string[]
{"Id", "Text", "Type", "IconName",
"Tooltip"};
With Magic DispIDs:
int[] intArr = new int[] { 32025,
32000, 32015, 32037};
Execution restricted to wnd[1]:
string json;
json = ses.GetObjectTree("wnd[1]",
strArr);

GetVKeyDescription When a script is recorded, it will often contain sendVKey(n)


calls, where n is a number. The method getVKeyDescription
Public Function GetVKeyDescription( _
ByVal VKey As Long _ translates these numbers into a readable text. For example
) As String the number 0 is translated into the text “Enter”.

LockSessionUI This method locks the session so that no user interaction


is possible until the session is unlocked using UnlockSessio-
Public Sub LockSessionUI()
nUI.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 193
Method

Syntax Description

SendCommand Using this function you can execute any command string,
which could otherwise be entered in the command field
Public Sub SendCommand( _
ByVal Command As String _ combo box.
)

SendCommandAsync Using this function, you can execute any command string,
which could otherwise be entered in the command field
SendCommandAsync combo box. The difference to the method SendCommand
Public Sub SendCommandAsync( _ is that SAP GUI does not wait for the response of the server
ByVal Command As String _ before continuing.
)
 Note
When creating a script using this command, you need
to make sure to find out if scripting is possible when
running the next command. This can be achieved
by checking the Busy property of listening to the
SapSessionEndRequest event.

StartTransaction Calling this function with parameter "xyz" has the same ef-
fect as SendCommand("/nxyz").
Public Sub StartTransaction( _
ByVal Transaction As String _
)

UnlockSessionUI This method unlocks the session after it was locked using
LockSessionUI.
Public Sub UnlockSessionUI()

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


194 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiContainer Object [page 87]:

• Children

AccEnhancedTabChain (Read-write) This property is True if the respective option "Include read-
only and disabled elements in tab chain" has been set in the
Public Property AccEnhancedTabChain SAP GUI options dialog.
As Byte

AccSymbolReplacement (Read-write) This property is True if the respective option "Display sym-
bols in lists as letters" has been set in the SAP GUI options
Public Property AccSymbolReplacement dialog.
As Byte

ActiveWindow (Read-only) All windows can be found in the children collection of Gui-
Session. However, most of the time an application will ac-
Public Property ActiveWindow As
GuiFrameWindow cess the currently activated window of the session, as that
is the window with which a user will probably interact. This
property is intended as a shortcut to this window.

Busy (Read-write) While SAP GUI is waiting for data from the server, any Script-
ing call will not return, which blocks the executing thread.
Public Property Busy As Byte
This may not be acceptable for advanced applications.

A way to prevent this is to check the busy property of the


session. If this property is True, then a subsequent Scripting
call will wait for the server communication to be finished.

ErrorList (Read-write)

Public Property ErrorList As


GuiCollection

Info (Read-only) Info is of type GuiSessionInfo. It contains technical informa-


tion about the current connection, the login data, the run-
Public Property Info As GuiSessionInfo
ning SAP application and more.

IsActive (Read-write) TRUE if the session window is active.

Public Property IsActive As Byte FALSE overwise.

IsListBoxActive (Read-only) This property is True if a listbox is currently open (for a


GuiComboBox).
Public Property IsListBoxActive As
Byte

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 195
Property

Syntax Description

ListBoxCurrEntry (Read-only) The index of the currently selected listbox entry.

Public Property ListBoxCurrEntry As


Long

ListBoxCurrEntryHeight (Read-only) The height of the current entry of the listbox in pixels.

Public Property
ListBoxCurrEntryHeight As Long

ListBoxCurrEntryLeft (Read-only) The left position of the current entry of the listbox in pixels.

Public Property ListBoxCurrEntryLeft


As Long

ListBoxCurrEntryTop (Read-only) The top position of the current entry of the listbox in pixels.

Public Property ListBoxCurrEntryTop


As Long

ListBoxCurrEntryWidth (Read-only) The width of the current entry of the listbox in pixels.

Public Property ListBoxCurrEntryWidth


As Long

ListBoxHeight (Read-only) The height of the open listbox in pixels.

Public Property ListBoxHeight As Long

ListBoxLeft (Read-only) The left position of the open listbox in pixels.

Public Property ListBoxLeft As Long

ListBoxTop (Read-only) The top position of the open listbox in pixels.

Public Property ListBoxTop As Long

ListBoxWidth (Read-only) The width of the open listbox in pixels.

Public Property ListBoxWidth As Long

PassportPreSystemId (Read-write) The pre-system ID. Part of the passport information.

Public Property PassportPreSystemId


As String

PassportSystemId (Read-write) The system ID. Part of the passport information.

Public Property PassportSystemId As


String

SAP GUI Scripting API


196 PUBLIC SAP GUI Scripting API
Property

Syntax Description

PassportTransactionId (Read-write) The unique ID of the transaction. Part of the passport infor-
mation.
Public Property PassportTransactionId
As String

ProgressPercent (Read-only) The percentage displayed by the SAP GUI progress indicator.

Public Property ProgressPercent As


LongPublic

ProgressText (Read-only) The text displayed by the progress indicator.

Public Property ProgressText As String

Record (Read-write) Setting this property to True enables the recording mode of
the session. In this mode changes to elements of the user in-
Public Property Record As Byte
terface are recorded within SAP GUI and sent to a recording
application using the Change event described later.

Remarks

Some elements of the user interface may behave differently


in record mode than during playback or manual interaction.

• The F4 help dialog is always displayed as a modal win-


dow.
• Drag & Drop is disabled.

RecordFile (Read-write) A simple way to record a script it to set the recordFile prop-
erty to a valid filename and then enable the record property.
Public Property RecordFile As String
A Visual Basic Script file of the given name will be created in
the SAP GUI Scripts Folder on the client PC.

Remarks

This property only accepts simple filenames without path


information.

SaveAsUnicode (Read-write) If this property is set to TRUE, the recorded scripts will be
saved in UNICODE encoding. Overwise is the current system
Public Property SaveAsUnicode As Byte
codepage.

ShowDropdownKeys (Read-write) If this property is TRUE, the dropdowns show not only the
text of dropdown entries, but also the keys.
Public Property ShowDropdownKeys As
Byte

SuppressBackendPopups (Read-write)

Public Property SuppressBackendPopups


As Byte

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 197
Property

Syntax Description

TestToolMode (Read-write) During internal tests some aspects of the user interface
proved to be difficult to handle with test tools using the
Public Property TestToolMode As Long
Scripting API to automate SAP GUI. For this reason a special
mode has been added in which the following changes are
administered.

• While success (S), warning (W) and error (E) messages


are always displayed in the status bar, information (I)
and abort (A) messages are displayed as pop-up win-
dows unless testToolMode is set.
• The update mode of the application server is changed
to immediate mode for the connection.
• System messages are ignored so that they do not inter-
rupt the recording or playback of scripts.

Remarks

The test tool mode requires one of the following versions of


the SAP kernel:

• 6.20 Patch level 29 and all following kernel versions


• 4.6D Patch level 1208, see note 511310.

Currently only the following values are allowed for this prop-
erty:

• 0: Disable testToolMode
• 1: Enable testToolMode

Events

Event

Syntax Description

AbapScriptingEvent

Public Event AbapScriptingEvent( _


ByVal param As String _
)

Activated

Public Event Activated( _


ByVal Session As GuiSession _
)

SAP GUI Scripting API


198 PUBLIC SAP GUI Scripting API
Event

Syntax Description

AutomationFCode The event is only fired when using the SAP Workplace. It
notifies the listener that SAP GUI executes a function code
Public Event AutomationFCode( _
ByVal Session As GuiSession, _ that was set by the Workplace framework.
ByVal FunctionCode As String _
)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 199
Event

Syntax Description

Change In record mode, the session collects changes to elements


of the user interface and sends these changes to a listening
Public Event Change( _
ByVal Session As GuiSession, _ application whenever server communication is about to start
ByVal Component As GuiComponent, _ or if the record mode is turned off. The change events are
ByVal CommandArray As Variant _ raised immediately before the startRequest event. There is
)
at least one event for every modified element in the recorded
session.

Remarks

 Note
When developing a handler for this event, you must
not include any action that may trigger the same event
again, because this will lead to an infinite loop. For
example, you must not call the press() function of a
button, because this would cause another roundtrip to
the server and would thus raise another Change/EndRe-
quest/StartRequest event.

Only changes made at the SAP GUI level are recorded. Trans-
actions may preset some of the entry fields with values from
parameters stored in the SAP system. If these data are not
changed in SAP GUI, they will not be recorded. This may
cause problems during playback of scripts, if the entry fields
are preset with different values.

If any of the following techniques is used in a transaction, the


user should manually modify all the entries he wants to see
recorded:

• Usage of SAP parameters


• Variants
• Hold Data, from the menu System -> User Profile

Playback of the changes will only work, if the order of the


calls is the same as during recording.

Each event represents one line of script code. The Compo-


nent parameter specifies the object on which to invoke a
method or property. Therefore the first thing to record is
Component.id for later use with findById. The recorder may
however also decide to record other properties of Compo-
nent. If, for example, a line in a table control or list is se-
lected, it may be prudent not to record the position of the
line, but rather the values in it. That way, a script can be
generated that is more robust with respect to changes in the
number, and therefore in the position, of lines.

SAP GUI Scripting API


200 PUBLIC SAP GUI Scripting API
Event

Syntax Description

If new function modules have been added, selecting a line


from the list might return the wrong function module.

Method/Property
Type name Parameters

"SP" "Text" "Hello World"

This sets the parameter Text to value “Hello World”.

Method/Property
Type name Parameters

"SP" "RecordMode" True

This sets the parameter RecordMode to the Boolean value


True. It is up to the recorder to generate a script line with
a valid textual representation of Boolean values, such as
“true”, “True” or “TRUE” for example.

Method/Property
Type name Parameters

"SP" "TestToolMode" 0

This sets the parameter TestToolMode to value 0.

Method/Property
Type name Parameters

"M" "Resize" 96

32

False

The method Resize is called with three parameters. In this


case the third member of the CommandArray is an array
with 3 elements.

ContextMenu The contextMenu event is fired when SAP GUI is about to


display a context menu. There are currently the following
Public Event ContextMenu( _
ByVal Session As GuiSession, _ limitations:
ByVal Component As GuiVComponent _
) • Only context menus of controls of type GuiShell are
supported.
• The event is not fired for “cached” context menus,
which are not retrieved from the server when being
opened.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 201
Event

Syntax Description

Destroy This event is raised before a session is destroyed.

Public Event Destroy( _


ByVal Session As GuiSession _
)

EndRequest endRequest is called immediately after the session is un-


locked after server communication.
Public Event EndRequest( _
ByVal Session As GuiSession _
)  Note
When developing a handler for this event, you must
not include any action that may trigger the same event
again, because this will lead to an infinite loop. For
example, you must not call the press() function of a
button, because this would cause another roundtrip to
the server and would thus raise another Change/EndRe-
quest/StartRequest event.

Error An error event is currently only raised, if the wrapper library


required to access an SAP GUI ActiveX control from a script
Public Event Error( _
ByVal Session As GuiSession, _ is not available. error events from all sessions are also availa-
ByVal ErrorId As Long, _ ble at the GuiApplication.
ByVal Desc1 As String, _
ByVal Desc2 As String, _
ByVal Desc3 As String, _
ByVal Desc4 As String _
)

FocusChanged This event is triggered when the focus in SAP GUI is moved
to a new item. Using the parameters one can identify which
Public Event FocusChanged( _ item in which session received focus.
ByVal Session As GuiSession, _
ByVal NewFocusedControl As
GuiVComponent _
)

HistoryOpened This event is triggered when the SAP GUI input history is
opened. Using the parameters one can identify the session
Public Event HistoryOpened( _ and the object for which the history was opened.
ByVal Session As GuiSession, _
ByVal NewFocusedControl As
GuiVComponent _
)

SAP GUI Scripting API


202 PUBLIC SAP GUI Scripting API
Event

Syntax Description

Hit The hit event is only raised when elementVisualizationMode


is set to True, which turns on the hit test mode of SAP GUI. If
Public Event Hit( _
ByVal Session As GuiSession, _ in this mode a SAP GUI component is identified, the hit event
ByVal Component As GuiComponent, _ is raised. The parameters of this event are
ByVal InnerObject As String _
) • The session on which the component was hit
• The component that was hit
• A description of an inner object of the component if an
inner object was hit

ProgressIndicator This event is triggered when the SAP GUI progress indicator
is displayed. The properties contain the current percentage
Public Event ProgressIndicator( _ and the text of the progress indicator.
ByVal percentage As Long, _
ByVal Text As String _
)

StartRequest The startRequest event is raised before the session is locked


during server communication. At this point user input can be
Public Event StartRequest( _
ByVal Session As GuiSession _ checked before it is sent to the server. It is not possible to
) prevent server communication from this event.

 Note
When developing a handler for this event, you must
not include any action that may trigger the same event
again, because this will lead to an infinite loop. For
example, you must not call the press() function of a
button, because this would cause another roundtrip to
the server and would thus raise another Change/EndRe-
quest/StartRequest event.

1.2.50 GuiSessionInfo Object

Description

GuiSessionInfo is a member of all GuiSession objects. It makes available technical information about the
session. Some of its properties are displayed in the system information area (either in the status bar or the title
area depending on the SAP GUI theme used).

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 203
Properties

Property

Syntax Description

ApplicationServer (Read-only) The name of the application server is set only if the session
belongs to a connection that was started without load bal-
Public Property ApplicationServer As
String ancing, by specifying an application server.

Client (Read-only) The client selected on the login screen.

Public Property Client As String

Codepage (Read-only) The codepage specified in SAP Logon in the properties of the
connection.
Public Property Codepage As Long

Flushes (Read-only) The property flushes counts the number of flushes in the
automation queue during server communication.
Public Property Flushes As Long

Group (Read-only) The login group information is available only if the session
belongs to a connection which was started using load bal-
Public Property Group As String
ancing.

GuiCodepage (Read-only) A list of codepages is available in table TCP00A of the SAP


system. On a client running Microsoft Windows with code-
Public Property GuiCodepage As Long
page 1252 (Latin I) the property guiCodepage is 1160.

I18NMode (Read-only) The I18N mode of SAP GUI is required for multi-byte charac-
ter sets.
Public Property I18NMode As Byte

InterpretationTime (Read-only) The interpretation time begins after the data have arrived
from the server. It comprises the parsing of the data and dis-
Public Property InterpretationTime As
Long tribution to the SAP GUI elements. The unit is milliseconds.

IsLowSpeedConnection (Read-only) The property is True if the connection to which the session
belongs runs with the low speed connection flag. This flag
Public Property IsLowSpeedConnection
As Byte can be set on the advanced connection properties page of
the SAPLogon dialog. The SAP GUI Scripting support is very
limited for low speed connections, because information re-
quired to identify SAP GUI objects is not being sent.

Language (Read-only) The language specified on the login screen.

Public Property Language As String

SAP GUI Scripting API


204 PUBLIC SAP GUI Scripting API
Property

Syntax Description

MessageServer (Read-only) The message server information is available only if the ses-
sion belongs to a connection which was started using load
Public Property MessageServer As
String balancing.

Program (Read-only) The name of the source program that is currently being exe-
cuted.
Public Property Program As String

ResponseTime (Read-only) This is the time that is spent on network communication


from the moment data are sent to the server to the moment
Public Property ResponseTime As Long
the server response arrives. The unit is milliseconds.

RoundTrips (Read-only) Before SAP GUI sends data to the server it locks the user
interface. In many cases it will not unlock the interface once
Public Property RoundTrips As Long
data arrive from the server, but instead will send a new re-
quest to the server immediately. Controls in particular use
this technology to load the data they need for visualization.
The count of these token switches between SAP GUI and the
server is the roundTrips property.

ScreenNumber (Read-only) The number of the screen currently displayed.

Public Property ScreenNumber As Long

ScriptingModeReadOnly (Read-only) The read-only mode can be enabled using an application


server profile parameter. In this mode, the state of SAP
Public Property ScriptingModeReadOnly
As Byte applications cannot be changed through the Scripting API,
which means:

• Properties can only be read, but not set.


• Functions can only be called if they do not change the
control’s state.

Remarks

In this mode, scripts can be recorded and information about


the application can be read from SAP GUI. However a trans-
action cannot be run from a script. Additional documenta-
tion is available in note 692245 and in the SAP GUI
Scripting security documentation on the Help Portal.

ScriptingModeRecordingDisabled (Read-only) The recording disabled mode can be enabled using an ap-
plication server profile parameter. In this mode SAP GUI
Public Property
ScriptingModeRecordingDisabled As Byte Scripting does not fire any events. This implies that user
interaction cannot be recorded. However data can be read
from SAP GUI and scripts can be used to run transactions.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 205
Property

Syntax Description

SessionNumber (Read-only) The number of the session is also displayed in SAP GUI on
the status bar.
Public Property SessionNumber As Long

SystemName (Read-only) This is the name of the SAP system.

Public Property SystemName As String

SystemNumber (Read-only) The system number is set only if the session belongs to a
connection that was started without load balancing, by spec-
Public Property SystemNumber As Long
ifying an application server.

SystemSessionId (Read-only) All SAP GUI sessions of the same connection are repre-
sented on the server with the same SystemSessionId. Using
Public Property SystemSessionId As
String SystemSessionId and SessionNumber, it is possible to find a
matching SAP GUI session from an ABAP application.

Transaction (Read-only) The transaction that is currently being executed.

Public Property Transaction As String

UI_GUIDELINE (Read-only) This property can be used to identify whether the SAP GUI
session is running with enabled SAP Fiori features or not.
Public Property UI_GUIDELINE As String
The return value is

• 1 if the session is running with deactivated SAP Fiori


features (SAP Fiori features off)
• 2 if the session is running with activated SAP Fiori fea-
tures (SAP Fiori features on)

 Note
• SAP Fiori features are only available as of
theme Belize. This means that for all previous
themes you always get 1 as the value of this
property.
• You can activate and deactivate the SAP Fiori
features in the SAP GUI options dialog.

User (Read-only) The SAP name of the user logged into the system.

Public Property User As String

SAP GUI Scripting API


206 PUBLIC SAP GUI Scripting API
1.2.51 GuiShell Object

Description

GuiShell is an abstract object whose interface is supported by all the controls. GuiShell extends the
GuiVContainer Object [page 286]. The type prefix is shell, the name is the last part of the id, shell[n].

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

SelectContextMenuItem Select an item from the control’s context menu.

Public Sub SelectContextMenuItem( _


ByVal FunctionCode As String _
)

SelectContextMenuItemByPosition This method allows you to select a context menu item using
the position of the item. It is therefore independent of the
Public Sub
SelectContextMenuItemByPosition( _ menu item text.
ByVal PositionDesc As String _
)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 207
Method

Syntax Description

SelectContextMenuItemByText Select a menu item of a context menu using the text of the
item and possible higher level menus.
Public Sub
SelectContextMenuItemByText( _
ByVal Text As String _
)

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


208 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All additional properties of the GuiContainer Object [page 87]:

• Children

AccDescription (Read-only) Accessibility description of the shell. This description can be


used for shells that do not have a title element.
Public Property AccDescription As
String

DragDropSupported (Read-only) This property is True if the shell allows drag and drop opera-
tions.
Public Property DragDropSupported As
Byte

Handle (Read-only) The window handle of the control that is connected to the
GuiShell.
Public Property Handle As Long

OcxEvents (Read-only) Returns a collection containing the event ids of the ActiveX
control. These are the events that the control may send to
Public Property OcxEvents As
GuiCollection the server.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 209
Property

Syntax Description

SubType (Read-only) Additional type information to identify the control repre-


sented by the shell, for example Picture, TextEdit, GridView…
Public Property SubType As String

1.2.52 GuiSimpleContainer Object

Description

This container represents non-scrollable subscreens. It does not have any functionality apart from to the
inherited interfaces. GuiSimpleContainer extends the GuiVContainer Object [page 286]. The type prefix is sub,
the name is is generated from the data dictionary settings.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

SAP GUI Scripting API


210 PUBLIC SAP GUI Scripting API
Method

Syntax Description

GetListProperty For more information refer to the documentation about


method GetListProperty within GuiLabel Object [page
Public Function GetListProperty( _ 140].
ByVal Property As String _
) As String

GetListPropertyNonRec For more information, refer to the documentation about


method GetListPropertyNonRec within GuiLabel Object
Public Function [page 140].
GetListPropertyNonRec( _
ByVal Property As String _
) As String

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 211
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

IsListElement (Read-only) This property is True if the element is on an ABAP list, not a
dynpro screen.
Public Property IsListElement As Byte

IsStepLoop (Read-only) This property is True if the container is a step loop container.

Public Property IsStepLoop As Byte

IsStepLoopInTableStructure (Read-only) If the container is a step loop container, this property is True,
if the step loop has the same number of columns for each
IsStepLoopInTableStructure As Long row. In this case, it is assumed that the step loop implements
a table-like structure that requires additional information in
accessibility mode. In all other cases, the property is False
(also when the container is not a step loop container). When
the steploop contains only a single row, the property will also
by False.

LoopColCount (Read-only) If the container is a step loop container, then this property
contains the number of columns in the step loop.
Public Property LoopColCount As Long

SAP GUI Scripting API


212 PUBLIC SAP GUI Scripting API
Property

Syntax Description

LoopCurrentCol (Read-only) If the container is a step loop container, then this property
contains the current row number in the step loop.
Public Property LoopCurrentCol As Long

LoopCurrentColCount (Read-only) If the container is a step loop container, then this property
contains the number of columns in the current row of the
Public Property LoopCurrentColCount
As Long step loop.

Please note that depending on the type of steploop the num-


ber of columns per row may be different per row.

 Note
This property is available as of SAP GUI for Windows
7.50 patchlevel 9 and SAP GUI for Windows 7.60.

LoopCurrentRow (Read-only) If the container is a step loop container, then this property
contains the current column number in the step loop.
Public Property LoopCurrentRow As Long

LoopRowCount (Read-only) If the container is a step loop container, then this property
contains the number of rows in the step loop.
Public Property LoopRowCount As Long

1.2.53 GuiSplit Object

Description

GuiSplit extends the GuiShell Object [page 207].

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 213
Methods

Method Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

GetColSize This method returns the size of the splitter column specified
by the parameter Id (starting with index 1) in percent.
Public Function GetColSize( _
ByVal Id As Long _
) As Long

GetRowSize This method returns the size of the splitter row specified by
the parameter Id (starting with index 1) in percent.
Public Function GetRowSize( _
ByVal Id As Long _
) As Long

SAP GUI Scripting API


214 PUBLIC SAP GUI Scripting API
Method Description

SetColSize This method sets the size of the splitter column specified by
the parameter Id (starting with index 1) to the percentage
Public Sub SetColSize( _ specified by parameter Size.
ByVal Id As Long, _
ByVal Size  Note
As Long _
) The splitter columns need to be set in sequence if multi-
ple columns are used. This means you first set the size
of the first column, then of the second column and so
forth until all columns have the desired size. Incorrectly
assigning sizes may lead to overall sizes of more than
100%. Therefore, the user of this method needs to make
sure not to exceed 100% percent adding the size of all
columns.

SetRowSize This method sets the size of the splitter row specified by
the parameter Id (starting with index 1) to the percentage
Public Sub SetRowSize( _ specified by parameter Size.
ByVal Id As Long, _
ByVal Size  Note
As Long _
) The splitter rows need to be set in sequence if multiple
columns are used. This means you first set the size of
the first row, then of the second row and so forth until
all rows have the desired size. Incorrectly assigning sizes
may lead to overall sizes of more than 100%. Therefore,
the user of this method needs to make sure not to ex-
ceed 100% percent adding the size of all rows.

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 215
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

FocusedHorizontalSash (Read-only) This property contains the index (starting with 1) of the fo-
cused horizontal sash belonging to the splitter. If the splitter
Public Property FocusedHorizontalSash container has just one row or no horizontal sash has focus,
As Long this property contains “-1”.

FocusedVerticalSash (Read-only) This property contains the index (starting with 1) of the fo-
cused vertical sash belonging to the splitter. If the splitter
Public Property FocusedVerticalSash container has just one column or no vertical sash has focus,
As Long this property contains “-1”.

SAP GUI Scripting API


216 PUBLIC SAP GUI Scripting API
Property

Syntax Description

IsVertical (Read-only) This property contains:

Public Property IsVertical As Long


• 0 if the splitter cells of the GuiSplit are horizontally
aligned
• 1 if the splitter cells of the GuiSplit are vertically aligned
• 2 if the splitter cells of the GuiSplit are both horizontally
and vertically aligned

1.2.54 GuiSplitterContainer Object

Description

The GuiSplitterContainer represents the dynpro splitter element, which was introduced in the Web Application
Server ABAP in NetWeaver 7.1. The dynpro splitter element is similar to the activeX based splitter control, but it
is a plain dynpro element.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 217
Method

Syntax Description

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


218 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

IsVertical (Read-only) This property contains True if the splitter cells of the GuiS-
plitterContainer are vertically aligned and False if they are
Public Property IsVertical As Byte horizontally aligned.

SashPosition (Read-write) Contains the position of the splitter sash in characters.

Public Property SashPosition As Long

1.2.55 GuiStage Object

Description

For the stage control only basic members from GuiShell are available. Recording and playback is not possible.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 219
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

ContextMenu Calling this function opens a context menu.

Public Sub ContextMenu( _


ByVal strId As String _
)

DoubleClick This function emulates a mouse double click.

Public Sub DoubleClick( _


ByVal strId As String _
)

SelectItems Select the items specified by the parameter strItems.

Public Sub SelectItems( _


ByVal strItems As String _
)

SAP GUI Scripting API


220 PUBLIC SAP GUI Scripting API
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 221
Property

Syntax Description

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

1.2.56 GuiStatusbar Object

Description

GuiStatusbar represents the message displaying part of the status bar on the bottom of the SAP GUI window. It
does not include the system and login information displayed in the rightmost area of the status bar as these are
available from the GuiSessionInfo object. GuiStatusbar extends the GuiVComponent Object [page 281]. The
type prefix is sbar.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

SAP GUI Scripting API


222 PUBLIC SAP GUI Scripting API
Method

Syntax Description

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

CreateSupportMessageClick This method sends the OKCode ?SMSG to the server. This
OKCode in many cases triggers a dialog for creating a sup-
Public Sub CreateSupportMessageClick port incident (the concrete functionality depends on the im-
() plementation on the server side). This is the same as dou-
ble-clicking the SAP Logo in the SAP GUI main window.

DoubleClick When a message is displayed in the GuiStatusbar, this mes-


sage can be double clicked. This will usually open the SAP
Public Sub DoubleClick()
performance assistant.

ServiceRequestClick A message displayed in the SAP GUI main window can


have a so-called “Service Request link”. This is a link
Public Sub ServiceRequestClick ()
that takes the user to some related functionality. Method
ServiceRequestClick triggers the activation of this function-
ality as if the user clicked the Service Request link.

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 223
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

Handle (Read-only) The window handle of the control that is connected to the
GuiShell.
Public Property Handle As Long

MessageAsPopup (Read-only) Some messages may be displayed not only on the status bar
but also as a pop-up window. In such cases, this property is
Public Property MessageAsPopup As Byte
set to True so that a script knows it has to close a pop-up to
continue.

SAP GUI Scripting API


224 PUBLIC SAP GUI Scripting API
Property

Syntax Description

MessageHasLongText (Read-only) This property can be used to determine whether the cur-
rently displayed message has a long text or not (in Belize
Public Property MessageHasLongText As
Long theme or newer themes this means that the View Details link
is displayed for this message).

Possible return values

• -1: Presently no message is displayed in the statusbar


• 0: The message which is displayed does not have a long
text
• 1: The message which is displayed has a long text

This property is available as of patchlevel 2 of SAP GUI for


Windows 7.60.

MessageId (Read-only) This is the name of the message class used in the ABAP
message call.
Public Property MessageId As String

MessageNumber (Read-only) This is the name of the message number used in the ABAP
message call. It will usually be a number, but this is not
Public Property MessageNumber As
String enforced by the system.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 225
Property

Syntax Description

MessageParameter (Read-only) These are the values of the parameters used to expand
the placeholders in the message text definition in the data
Public Property MessageParameter As
String dictionary. The text property of the GuiStatusbar already
contains the expanded text of the message. A maximum of
8 parameter values can be provided in the ABAP coding, so
index should be in the range from 0 to 7.

Example

The ABAP language line

 Sample Code

message e319(01) with 'test1'


'test2' 'test3' 'test4'.

will result in the following property values:

 Sample Code

Text = E: test1 test2 test3 test4


Type = E
Id = 01
Number = 319
Parameter 0 = test1
Parameter 1 = test2
Parameter 2 = test3
Parameter 3 = test4
Parameter 4 =
Parameter 5 =
Parameter 6 =
Parameter 7 =
as Popup = False

The message 319 in message class 01 is defined as ‘ & & &


&’, with ‘&’ being a placeholder.

MessageType (Read-only) This property may have any of the following values:

Public Property MessageType As String


Value Description

S Success

W Warning

E Error

A Abort

I Information

SAP GUI Scripting API


226 PUBLIC SAP GUI Scripting API
1.2.57 GuiStatusBarLink

GuiStatusbarLink represents a so-called service request link that can optionally be displayed in the
GuiStatusBar by an application. Clicking such a link executes an application specific action, like launching
a transaction for reporting a functional issue.

If present, the parent of the GuiStatusbarLink object is the first pane (pane[0]) of the status bar (see also
GuiStatusbar Object [page 222] and GuiStatusPane Object [page 228]).

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

Press This emulates manually clicking the Service Request Link


which triggers the application specific action and causes
server communication to occur.

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 227
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

1.2.58 GuiStatusPane Object

The parent of the GuiStatusPane objects is the status bar (see also GuiStatusbar Object [page 222]). The
GuiStatusPane objects reflect the individual areas of the status bar, for example "pane[0]" refers to the section
of the status bar where the messages are displayed. See also GuiStatusbar Object [page 222]. The first pane
of the GuiStatusBar (pane[0]) can have a child of type GuiStatusBarLink [page 227], if a service request link is
displayed.

SAP GUI Scripting API


228 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 229
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

Children This collection may contain a single object of type GuiSta-


tusbarLink if a service request link is presently displayed in
Public Property Children As the status bar.
GuiComponentCollection

1.2.59 GuiTab Object

Description

The GuiTab objects are the children of a GuiTabStrip object. GuiTab extends the GuiVContainer Object [page
286]. The type prefix is tabp, the name is the id of the tab’s button taken from SAP data dictionary.

SAP GUI Scripting API


230 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

ScrollToLeft ScrollToLeft shifts the tabs so that a certain tab becomes the
leftTab of the tab strip.
Public Sub ScrollToLeft()

Select This function sets the tab to be the tab strip’s selected tab.
Changing the selected tab of a tab strip may cause server
Public Sub Select()
communication.

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 231
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

1.2.60 GuiTableColumn Collection

Description

GuiTableColumn extends the GuiComponentCollection Collection [page 83].

SAP GUI Scripting API


232 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

ElementAt This function returns the member in the collection at posi-


tion index, where index may range from 0 to count-1. If no
Public Function ElementAt( _ member can be found for the given index, an exception is
ByVal Index As Long _ raised.
) As GuiComponent

Item This function returns the member in the collection at posi-


tion index, where index may range from 0 to count-1. It has
Public Function Item( _ been added for compatibility with Microsoft Visual Basic col-
ByVal Index As Variant _ lections. If no member can be found for the given index, an
) As GuiComponent exception is raised.

Properties

Property

Syntax Description

Count (Read-only) Number of cells in the column.

Public Property Count As Long

DefaultTooltip (Read-only) Tooltip text generated from the short text defined in the data
dictionary for the given screen element type.
Public Property DefaultTooltip As
String

Fixed (Read-only) Some columns may be fixed, which means that they will not
be scrolled with the rest of the columns.
Public Property Fixed As Byte

IconName (Read-only) If the object has been assigned an icon, then this property is
the name of the icon, otherwise it is an empty string.
Public Property IconName As String

Length (Read-only) Number of cells in the column.

Public Property Length As Long

NewEnum (Read-only) Property for VB collection handling.

Public Property NewEnum As Unknown

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 233
Property

Syntax Description

Selected (Read-write) This property is true if the column is selected.

Public Property Selected As Byte

Title (Read-only) This is the caption of the column.

Public Property Title As String

Tooltip (Read-only) The tooltip contains a text, which is designed to help a user
understand the meaning of a given text field or button.
Public Property Tooltip As String

Type (Read-only) The type information of GuiComponent can be used to de-


termine which properties and methods an object supports.
Public Property Type As String
The value of the type string is the name of the type taken
from this documentation.

TypeAsNumber (Read-only) While the type property is a string value, the typeAsNumber
property is a long value that can alternatively be used to
Public Property TypeAsNumber As Long
identify an object's type . It was added for better perform-
ance in methods such as FindByIdEx. Possible values for this
property are taken from the GuiComponentType enumera-
tion.

1.2.61 GuiTableControl Object

Description

The table control is a standard dynpro element, in contrast to the GuiCtrlGridView, which looks similar.
GuiTableControl extends the GuiVContainer Object [page 286]. The type prefix is tbl, the name is the fieldname
taken from the SAP data dictionary.

SAP GUI Scripting API


234 PUBLIC SAP GUI Scripting API
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All additional methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

ConfigureLayout In the configuration dialog the layout of the table can be


changed. This dialog is a GuiModalWindow.
Public Sub ConfigureLayout()

DeselectAllColumns This function can be used for table controls with a button
that allows, to deselect all columns in one step.
Public Sub DeselectAllColumns()

GetAbsoluteRow Unlike the rows collection, the indexing supported by this


function does not reset the index after scrolling, but counts
Public Function GetAbsoluteRow( _
ByVal Index As Long _ the rows starting with the first row with respect to the first
) As GuiTableRow scroll position. If the selected row is not currently visible
then an exception is raised.

GetCell This method returns a given table cell. It is more efficient


than accessing a single cell using the rows or columns col-
Public Function GetCell( _
ByVal Row As Long, _ lections. Syntax
ByVal Column As Long _
Row: Zero-based index of the row.
) As GuiVComponent
Column: Zero-based index of the column.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 235
Method

Syntax Description

ReorderTable The parameter permutation describes a new ordering of the


columns. For example “0 2 1” will move the third column to
Public Sub ReorderTable( _
ByVal Permutation As String _ second position.
)
 Note
• Columns start at index 0
• Fixed columns cannot be reordered

SelectAllColumns This function can be used for table controls with a button
that allows, to select all columns in one step.
Public Sub SelectAllColumns()

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


236 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

CharHeight (Read-only) Height of the GuiTableControl in character metric.

Public Property CharHeight As Long

CharLeft (Read-only) Left coordinate of the GuiTableControl in character metric.

Public Property CharLeft As Long

CharTop (Read-only) Top coordinate of the GuiTableControl in character metric.

Public Property CharTop As Long

CharWidth (Read-only) Width of the GuiTableControl in character metric.

Public Property CharWidth As Long

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 237
Property

Syntax Description

ColSelectMode (Read-only) There are three different modes for selecting columns or
rows, which are defined in the enumeration type GuiTableSe-
Public Property ColSelectMode As
GuiTableSelectionType lectionType.

Columns (Read-only) The members of this collection are of GuiTableColumn type.


Therefore they do not support properties like id or name.
Public Property Columns As
GuiCollection

CurrentCol (Read-only) Zero-based index of the current column.

Public Property CurrentCol As Long

CurrentRow (Read-only) Zero-based index of the current row.

Public Property CurrentRow As Long

HorizontalScrollbar (Read-only) The horizontal scrollbar of the table control.

Public Property HorizontalScrollbar


As GuiScrollbar

RowCount (Read-only) Number of rows in the table. This includes invisible rows. For
the number of visible rows the property VisibleRowCount is
Public Property RowCount As Long
available.

Rows (Read-only) The members of this collection are of GuiTableRow type.


Indexing starts with 0 for the first visible row, independent of
Public Property Rows As GuiCollection
the current position of the horizontal scrollbar. After scroll-
ing, a different row will have the index 0.

RowSelectMode (Read-only) There are three different modes for selecting columns or
rows, which are defined in the enumeration type GuiTableSe-
Public Property RowSelectMode As
GuiTableSelectionType lectionType.

TableFieldName (Read-only) The name property of the table control contains the ABAP
program name in addition to the plain field name. This prop-
Public Property TableFieldName As
String erty contains just the field name.

VerticalScrollbar (Read-only) The vertical scrollbar of the table control.

Public Property VerticalScrollbar As


GuiScrollbar

SAP GUI Scripting API


238 PUBLIC SAP GUI Scripting API
Property

Syntax Description

VisibleRowCount (Read-only) Number of visible rows in the table. For the number of all
rows the property RowCount is available.
Public Property VisibleRowCount As
Long

1.2.62 GuiTableRow Collection

Description

GuiTableRow extends the GuiComponentCollection Collection [page 83].

Methods

Method

Syntax Description

ElementAt This function returns the member in the collection at posi-


tion index, where index may range from 0 to count-1. If no
Public Function ElementAt( _ member can be found for the given index, an exception is
ByVal Index As Long _ raised.
) As GuiComponent

Item This function returns the member in the collection at posi-


tion index, where index may range from 0 to count-1. It has
Public Function Item( _ been added for compatibility with Microsoft Visual Basic col-
ByVal Index As Variant _ lections. If no member can be found for the given index, an
) As GuiComponent exception is raised.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 239
Properties

Property

Syntax Description

Count (Read-only) Number of cells in the row.

Public Property Count As Long

Length (Read-only) Number of cells in the row.

Public Property Length As Long

NewEnum (Read-only) Property for VB collection handling.

Public Property NewEnum As Unknown

Selectable (Read-only) This property is True if the row can be selected.

Public Property Selectable As Byte

Selected (Read-write) This property is true if the row is selected.

Public Property Selected As Byte

Type (Read-only) The type information of GuiComponent can be used to de-


termine which properties and methods an object supports.
Public Property Type As String
The value of the type string is the name of the type taken
from this documentation.

TypeAsNumber (Read-only) While the type property is a string value, the typeAsNumber
property is a long value that can alternatively be used for this
Public Property TypeAsNumber As Long
property are taken from the GuiComponentType enumera-
tion.

1.2.63 GuiTabStrip Object

Description

A tab strip is a container whose children are of type GuiTab. GuiTabStrip extends the GuiVContainer Object
[page 286]. The type prefix is tabs, the name is the fieldname taken from the SAP data dictionary.

SAP GUI Scripting API


240 PUBLIC SAP GUI Scripting API
Example

The children of the tab strip are the tabs. While all tabs are available at any given time, only the children of the
selected tab exist in the object hierarchy for server driven tab strips. So in this example, the text field labeled
‘Results analysis keys:’ can only be found if the tab labeled ‘Period Closing’ has been selected.

In some transactions there are local tabs strips where all tabs are available without further server access being
required.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 241
Method

Syntax Description

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


242 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccText
• AccTextOnRequest
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

CharHeight (Read-only) Height of the GuiTabStrip in character metric.

Public Property CharHeight As Long

CharLeft (Read-only) Left coordinate of the GuiTabStrip in character metric.

Public Property CharLeft As Long

CharTop (Read-only) Top coordinate of the GuiTabStrip in character metric.

Public Property CharTop As Long

CharWidth (Read-only) Width of the GuiTabStrip in character metric.

Public Property CharWidth As Long

LeftTab (Read-only) This is the left most tab whose caption is visible. In the
example above it is the one with text ‘Period closing’. The
Public Property LeftTab As GuiTab
leftTab property can be changed by calling the ScrollToLeft
method of a different GuiTab, as described in section GuiTab
Object [page 230].

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 243
Property

Syntax Description

SelectedTab (Read-only) The selected tab is the one whose descendants are currently
visualized, in the example above it is the ‘General data’ tab.
Public Property SelectedTab As GuiTab
The selected tab has exactly one child, which is a GuiScroll-
Container. To select a tab, you call method Select of the
respective tab page. See also section GuiTab Object [page
230].

1.2.64 GuiTextedit Object

Description

The TextEdit control is a multiline edit control offering a number of possible benefits. With regard to scripting,
the possibility of protecting text parts against editing by the user is especially useful. GuiTextedit extends the
GuiShell Object [page 207].

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

SAP GUI Scripting API


244 PUBLIC SAP GUI Scripting API
Method

Syntax Description

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

ContextMenu Calling ContextMenu emulates the context menu request.

Public Sub ContextMenu()

DoubleClick This function emulates a mouse double-click. For setting the


selection, the function setSelectionIndexes can be called in
Public Sub DoubleClick()
advance.

GetLineText Returns the text of the specified line.

Public Function GetLineText( _


ByVal nLine As Long _
) As String

GetUnprotectedTextPart This function retrieves the content of an unprotected text


part using the zero based index part.
Public Function
GetUnprotectedTextPart( _
ByVal Part As Long _
) As String

IsBreakpointLine Returns TRUE if the specified line contains a breakpoint.

Public Function IsBreakpointLine( _


ByVal nLine As Long _
) As Byte

IsCommentLine Returns TRUE if the specified line is a comment line.

Public Function IsCommentLine( _


ByVal nLine As Long _
) As Byte

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 245
Method

Syntax Description

IsHighlightedLine Returns TRUE if the specified line is highlighted.

Public Function IsHighlightedLine( _


ByVal nLine As Long _
) As Byte

IsProtectedLine Returns TRUE if the specified line is protected.

Public Function IsProtectedLine( _


ByVal nLine As Long _
) As Byte

IsSelectedLine Returns TRUE if the specified line is selected.

Public Function IsSelectedLine( _


ByVal nLine As Long _
) As Byte

ModifiedStatusChanged This function emulates the change of the modified status.

Public Sub ModifiedStatusChanged( _


ByVal Status As Boolean _
)

MultipleFilesDropped Emulate a Drag&Drop operation, in which several files are


dropped on the textedit control. The collection contains for
Public Sub MultipleFilesDropped()
each file the fully qualified file name as a string.

PressF1 This function emulates pressing the F1 key on the keyboard.

Public Sub PressF1()

PressF4 This function emulates pressing the F4 key on the keyboard.

Public Sub PressF4()

SetSelectionIndexes This function sets the visually selected text range. start and
end are absolute, zero based character indexes. start corre-
Public Sub SetSelectionIndexes( _
ByVal Start As Long, _ sponds to the position where the selection begins and end
ByVal End As is the position of the first character following the selection.
Long _ Note that setting start equal to end results in setting the
)
cursor on this position.

SetUnprotectedTextPart This function assigns the content of text to the unprotected


text part with zero based index part. The function returns
Public Function
SetUnprotectedTextPart( _ True if it was possible to perform the assignment. Otherwise,
ByVal Part As Long, _ False is returned.
ByVal Text As String _
) As Byte

SAP GUI Scripting API


246 PUBLIC SAP GUI Scripting API
Method

Syntax Description

SingleFileDropped This function emulates the drop of a single file with the di-
rectory path fileName.
Public Sub SingleFileDropped( _
ByVal Filename As String _
)

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 247
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

CurrentColumn (Read-only) The number of the column in which the text caret is cur-
rently positioned.
Public Property CurrentColumn As Long

CurrentLine (Read-only) The number of the line in which the text caret is currently
positioned.
Public Property CurrentLine As Long

SAP GUI Scripting API


248 PUBLIC SAP GUI Scripting API
Property

Syntax Description

FirstVisibleLine (Read-write) The first visible line is visualized at the top border of the
control.
Public Property FirstVisibleLine As
Long

LastVisibleLine (Read-only) The number of the last line that is currently visible.

Public Property LastVisibleLine As


Long

LineCount (Read-only) The number of all lines in the current document.

Public Property LineCount As Long

NumberOfUnprotectedTextParts (Read-only) The number of unprotected text parts, which are contained.

Public Property
NumberOfUnprotectedTextParts As Long

SelectedText (Read-only) The currently selected text.

Public Property SelectedText As String

SelectionEndColumn (Read-only) The number of the column in which the current selection
ends.
Public Property SelectionEndColumn As
Long

SelectionEndLine (Read-only) The number of the line in which the current selection ends.

Public Property SelectionEndLine As


Long

SelectionIndexEnd (Read-only) Retrieves the absolute, zero based character index of the
ending point from the visually selected text range, i.e. the
Public Property SelectionIndexEnd As
Long position where the selection ends. Note that a selection can
be degenerated, i.e. selectionIndexStart is equal to selectio-
nIndexEnd.

SelectionIndexStart (Read-only) Retrieves the absolute, zero based character index of the
starting point from the visually selected text range, i.e. the
Public Property SelectionIndexStart
As Long position, where the selection begins. Note that a selection
can be degenerated, i.e. selectionIndexStart is equal to se-
lectionIndexEnd.

SelectionStartColumn (Read-only) The number of the column in which the current selection
starts.
Public Property SelectionStartColumn
As Long

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 249
Property

Syntax Description

SelectionStartLine (Read-only) The number of the line in which the current selection starts.

Public Property SelectionStartLine As


Long

1.2.65 GuiTextField

Description

GuiTextField extends the GuiVComponent Object [page 281]. The type prefix is txt, the name is the fieldname
taken from the SAP data dictionary.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

GetListProperty For more information refer to the documentation about


method GetListProperty within GuiLabel Object [page
Public Function GetListProperty( _ 140].
ByVal Property As String _
) As String

SAP GUI Scripting API


250 PUBLIC SAP GUI Scripting API
Method

Syntax Description

GetListPropertyNonRec This method returns information that is compiled on the


server to enhance the ABAP lists with accessibility informa-
Public Function
GetListPropertyNonRec( _ tion. See GuiLabel Object [page 140] → GetListProperty
ByVal Property As String _ for a description of available attributes. In contrast to the
) As String method GetListProperty, GetListPropertyNonRec will only
return information that is set for the specific element and
ignore list properties set for parent elements. For more infor-
mation, refer to the documentation about method GetList-
PropertyNonRec within GuiLabel Object [page 140].

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 251
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

CaretPosition (Read-write) The position of the caret within a text field may be checked
by the ABAP application to determine which word the caret
Public Property CaretPosition As Long
is in. Among other things this is useful for context sensitive
help.

DisplayedText (Read-only) This property contains the text as it is displayed on the


screen, including preceding or trailing blanks. These blanks
Public Property DisplayedText As
String are stripped from the text property.

Highlighted (Read-only) This property is True if the Highlighted flag is set in the
screen painter for the dynpro element. See GuiLabel for an
Public Property Highlighted As Byte
example.

HistoryCurEntry (Read-only) Text of the currently focused entry in the history list box.

Public Property HistoryCurEntry As


String

HistoryCurIndex (Read-only) Currently focused index in the history dropdown list box.

Public Property HistoryCurIndex As


Long

SAP GUI Scripting API


252 PUBLIC SAP GUI Scripting API
Property

Syntax Description

HistoryIsActive (Read-only) This property is True if the local input field history drop down
is currently open.
Public Property HistoryIsActive As
Byte

HistoryList (Read-only) List of entries in the local history list box.

Public Property HistoryList As


GuiCollection

IsHotspot (Read-only) Dynpro elements such as labels may be configured to cause


a round trip when they are clicked. In that case the mouse
Public Property IsHotspot As Byte
cursor changes to the hand shape. This is called a hot spot.

IsLeftLabel (Read-only) This property is True if the component has the 'assign left'
flag.
Public Property IsLeftLabel As Byte

IsListElement (Read-only) This property is True if the element is on an ABAP list, not a
dynpro screen.
Public Property IsListElement As Byte

IsOField (Read-only) OField is a special ABAP dynpro element, the Output Field.
These fields can be set programmatically to a value at run-
Public Property IsOField As Byte
time. In this respect they differ from labels. However they
cannot be used to enter data, so they are not input fields.

IsRightLabel (Read-only) This property is True if the component has the 'assign right'
flag.
Public Property IsRightLabel As Byte

LeftLabel (Read-only) This label has been defined in ABAP Screen Painter to be the
left label of the control.
Public Property LeftLabel As
GuiVComponent

MaxLength (Read-only) The maximum length of text that can be written in a text field
is counted in code units. On non-Unicode clients these are
Public Property MaxLength As Long
equivalent to bytes.

Numerical (Read-only) If this flag is set only numbers and special characters may be
written into the text field.
Public Property Numerical As Byte

Required (Read-only) This property is True if the component is a required value for
the screen.
Public Property Required As Byte

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 253
Property

Syntax Description

RightLabel (Read-only) This label has been defined in ABAP Screen Painter to be the
right label of the control.
Public Property RightLabel As
GuiVComponent

1.2.66 GuiTitlebar Object

Description

The titlebar is only displayed and exposed as a separate object in New Visual Design mode. GuiTitlebar extends
the GuiVContainer Object [page 286]. The type prefix and name of GuiTitlebar are titl.

Remarks

In some transactions the titlebar may contain objects of GuiGosShell type.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

SAP GUI Scripting API


254 PUBLIC SAP GUI Scripting API
Method

Syntax Description

All additional methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

The following properties of the GuiVComponent Object [page 281] (some properties are not supported, because most of
the properties of GuiTitlebar cannot be influenced by ABAP applications):

• DefaultTooltip
• Height
• Left
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 255
1.2.67 GuiToolbar Object

Description

Every GuiFrameWindow has a GuiToolbar. The GuiMainWindow has two toolbars unless the second has been
turned off by the ABAP application. In classical SAP GUI themes, the upper toolbar is called “system toolbar”
or “GUI toolbar” , while the second toolbar is called “application toolbar”. In SAP GUI themes as of Belize and
in integration scenarios (like embedded into SAP Business Client), only a single toolbar (“merged toolbar")
is displayed. Additionally, a footer also containing buttons originally coming from the system or application
toolbar may be displayed.

The merged toolbar contains elements from both the system and the application toolbar. However, the
scripting IDs of all objects in the merged toolbar remain the same in order to ensure downwards compatibility
of scripts. This means that in Belize theme there are children of both tbar[0] (system toolbar) and tbar[1] even
though only a single toolbar is displayed. The buttons in the footer area of Belize and newer themes are also
still children of the application toolbar and retain their scripting ids containing tbar[1].

The children of a GuiToolbar are buttons (GuiButton Object [page 54]) and the OKCode field (GuiOkCodeField
Object [page 172]) unless it is hidden. When SAP Fiori features are turned on in Belize and newer themes,
the application toolbar may also contain a ViewSwitch (GuiVHViewSwitch Object [page 288]). The indexes for
toolbar buttons defined by the application are determined by the virtual key values defined for the button.

The indexes / names of specific buttons and elements are fixed:

Button/Element Index/Name

OKCode field okcd

Generates shortcut button 418

New GUI Window button 419

Button for collapsing the OKCode field 423

SAP GUI Options button 446

“More” button btnvhmore

(only available in Belize and newer SAP GUI themes)

View Switch vhviewswitch

(only available in Belize and newer SAP GUI themes when


Fiori features are activated and the ABAP application has
implemented a View Switch)

GuiToolbar extends the GuiVContainer Object [page 286].

The type prefix and name are tbar. tbar[0] is the system toolbar, while tbar[1] is the application toolbar.

The GuiToolbars can also be influenced by properties ButtonbarVisible and ToolbarVisible of the GuiApplication
object.

SAP GUI Scripting API


256 PUBLIC SAP GUI Scripting API
Buttons hidden in an overflow menu

When the SAP GUI window is not wide enough to display all buttons in a GuiToolbar or the application has
decided that a button shall not be displayed by default, some buttons are moved into an overflow menu
(depending on the theme this can also be a More button). For themes older than Belize, the SAP GUI Scripting
object hierarchy always contained visible buttons and buttons in overflow menus. For themes as of Belize, the
hidden buttons where originally not part of the object hierarchy. This changed as of SAP GUI for Windows 8.00
patchlevel 2. Now these objects are part of the object hierarchy for all themes.

Since there is no “visible” property in the SAP GUI Scripting API, you can use the dimensions and positions to
check whether a button is part of an overflow or not. If the button is not displayed on the screen, but is part of
an overflow, the properties ScreenLeft, ScreenTop, Left, Top, Width and Height all have value 0.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All additional methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 257
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• Left
• Modified
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

1.2.68 GuiToolbarControl

GuiToolbarControl extends the GuiShell Object [page 207].

SAP GUI Scripting API


258 PUBLIC SAP GUI Scripting API
Description

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

GetButtonChecked Returns if the button is currently checked (pressed).

Public Function GetButtonChecked( _


ByVal ButtonPos As Long _
) As Byte

GetButtonEnabled Indicates if the button can be pressed.

Public Function GetButtonEnabled( _


ByVal ButtonPos As Long _
) As Byte

GetButtonIcon Returns the name of the icon of the specified toolbar button.

Public Function GetButtonIcon( _


ByVal ButtonPos As Long _
) As String

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 259
Method

Syntax Description

GetButtonId Returns the ID of the specified toolbar button.

Public Function GetButtonId( _


ByVal ButtonPos As Long _
) As String

GetButtonText Returns the text of the specified toolbar button.

Public Function GetButtonText( _


ByVal ButtonPos As Long _
) As String

GetButtonTooltip Returns the tooltip of the specified toolbar button.

Public Function GetButtonTooltip( _


ByVal ButtonPos As Long _
) As String

GetButtonType Returns the type of the specified toolbar button. Possi-


ble values are:"Button", "ButtonAndMenu", "Menu", "Sepa-
Public Function GetButtonType( _
ByVal ButtonPos As Long _ rator", "Group", "CheckBox"
) As String

GetMenuItemIdFromPosition This function returns the identifier of the menu item with
index Position.
Public Function
GetMenuItemIdFromPosition( _
ByVal Pos As Long _
) As String

PressButton This function emulates pressing the button with the given id.

Public Sub PressButton( _


ByVal Id As String _
)

PressContextButton This function emulates pressing the context button with the
given id.
Public Sub PressContextButton( _
ByVal Id As String _
)

SelectMenuItem This function emulates selecting the menu item with the
given id.
Public Sub SelectMenuItem( _
ByVal Id As String _
)

SAP GUI Scripting API


260 PUBLIC SAP GUI Scripting API
Method

Syntax Description

SelectMenuItemByText This function emulates selecting the menu item by menu


item text.
Public Sub SelectMenuItemByText( _
ByVal strText As String _
)

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 261
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

ButtonCount The number of toolbar buttons including separators.

Public Property ButtonCount As Long

FocusedButton Zero-based index of the button that currently has the focus.

Public Property FocusedButton As Long

SAP GUI Scripting API


262 PUBLIC SAP GUI Scripting API
1.2.69 GuiTree Object

Example

The Tree Control supports three tree types:

• Simple Tree

• List Tree
• without header

• with header

• Column Tree

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 263
Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

All methods of the GuiShell Object [page 207]:

• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText

ChangeCheckbox This method emulates changing a checkbox state.

Public Sub ChangeCheckbox( _


ByVal NodeKey As String, _
ByVal ItemName As String, _
ByVal Checked As Boolean _
)

SAP GUI Scripting API


264 PUBLIC SAP GUI Scripting API
Method

Syntax Description

ClickLink This function emulates triggering a link.

Public Sub ClickLink( _


ByVal NodeKey As String, _
ByVal ItemName As String _
)

CollapseNode This function closes the node with the key nodeKey.

Public Sub CollapseNode( _


ByVal NodeKey As String _
)

DefaultContextMenu This method requests a context menu for the whole Tree
Control.
Public Sub DefaultContextMenu()

DoubleClickItem This function emulates double-clicking on a text item.

Public Sub DoubleClickItem( _


ByVal NodeKey As String, _
ByVal ItemName As String _
)

DoubleClickNode This function emulates double-clicking a node.

Public Sub DoubleClickNode( _


ByVal NodeKey As String _ )

EnsureVisibleHorizontalItem This function scrolls the Tree horizontally until the Item is
visible.
Public Sub
EnsureVisibleHorizontalItem( _
ByVal NodeKey As String, _
ByVal ItemName As String _
)

ExpandNode This function expands the node with the key nodeKey.

Public Sub ExpandNode( _


ByVal NodeKey As String _
)

FindNodeKeyByPath

Public Function FindNodeKeyByPath( _


ByVal Path As String _
) As String

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 265
Method

Syntax Description

GetAbapImage Retrieves the icon code of an image displayed in the speci-


fied item (for example “01”).
Public Function GetAbapImage( _
ByVal Key As String, _
ByVal Name As String _
) As String

GetAllNodeKeys Returns a GuiCollection that contains all node keys present


in the Tree Control.
Public Function GetAllNodeKeys() As
Object

GetCheckBoxState Retrieves the CheckBox state (1 = Checked, 0 = Unchecked).

Public Function GetCheckBoxState( _


ByVal NodeKey As String, _
ByVal ItemName As String _
) As Byte

GetColumnCol The keys of all the items in the given column.

Public Function GetColumnCol( _


ByVal colName As String _
) As Object

GetColumnHeaders Collection of the titles of the columns.

Public Function GetColumnHeaders() As


Object

GetColumnIndexFromName Returns the column index (starting with 1) of the column


specified by the parameter.
Public Function
GetColumnIndexFromName( _
ByVal Key As String _
) As Long

GetColumnNames Returns a collection of the column names.

Public Function GetColumnNames() As


Object

GetColumnTitleFromName Returns the column title of the column specified by the pa-
rameter.
Public Function
GetColumnTitleFromName( _
ByVal Key As String _
) As String

SAP GUI Scripting API


266 PUBLIC SAP GUI Scripting API
Method

Syntax Description

GetColumnTitles Returns a GuiCollection that contains the column titles of all


columns present in the Tree Control in their respective order.
Public Function GetColumnTitles() As
Object Prerequisite: The Tree Control is a Column Tree Control.

GetFocusedNodeKey Returns the key of the node that has focus.

Public Function GetFocusedNodeKey()


As String

GetHierarchyLevel Returns the hierarchy level of the specified key starting on


level 0.
Public Function GetHierarchyLevel( _
ByVal Key As String _
) As Long

GetHierarchyTitle

Public Function GetHierarchyTitle()


As String

GetIsDisabled

Public Function GetIsDisabled( _


ByVal NodeKey As String, _
ByVal ItemName As String _
) As Byte

GetIsEditable Retrieves the status of the element in the cell (for example a
checkbox) as a boolean value.
Public Function GetIsEditable( _
ByVal NodeKey As String, _
ByVal ItemName As String _
) As Byte

GetIsHighLighted If the respective item in a List Tree is displayed highlighted


(intensified), this method returns true, else false.
Public Function GetIsHighLighted( _
ByVal NodeKey As String, _
ByVal ItemName As String _
) As Byte

GetItemHeight Retrieves the height of the specified item in pixels.

Public Function GetItemHeight( _


ByVal NodeKey As String, _
ByVal ItemName As String _
) As Long

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 267
Method

Syntax Description

GetItemLeft Retrieves the left position of the specified item in pixels.

Public Function GetItemLeft( _


ByVal NodeKey As String, _
ByVal ItemName As String _
) As Long

GetItemStyle Retrieves the index of the style assigned to the specified


item.
Public Function GetItemStyle( _
ByVal NodeKey As String, _
ByVal ItemName As String _
) As Long

GetItemText This function returns the text of the item specified by the key
and name parameters.
Public Function GetItemText( _
ByVal Key As String, _
ByVal Name As String _
) As String

GetItemTextColor Retrieves the font color of the specified item.

Public Function GetItemTextColor( _


ByVal Key As String, _
ByVal Name As String _
) As ULong

GetItemToolTip Retrieves the tooltip of the specified item.

Public Function GetItemToolTip( _


ByVal Key As String, _
ByVal Name As String _
) As String

GetItemTop Retrieves the top position of the specified item in pixels.

Public Function GetItemTop( _


ByVal NodeKey As String, _
ByVal ItemName As String _
) As Long

GetItemType Retrieves the column tree item type:

Public Function GetItemType( _ • trvTreeStructureHierarchy = 0


ByVal Key As String, _
ByVal Name As String _ • trvTreeStructureImage = 1
) As Long • trvTreeStructureText = 2
• trvTreeStructureBool = 3
• trvTreeStructureButton = 4
• trvTreeStructureLink = 5

SAP GUI Scripting API


268 PUBLIC SAP GUI Scripting API
Method

Syntax Description

GetItemWidth Retrieves the width of the specified item in pixels.

Public Function GetItemWidth( _


ByVal NodeKey As String, _
ByVal ItemName As String _
) As Long

GetListTreeNodeItemCount Returns the number of visible items of the specified node for
a list tree.
Public Function
GetListTreeNodeItemCount( _
ByVal NodeKey As String _
) As Long

GetNextNodeKey Returns the key of the next node belonging to the same node
one level above.
Public Function GetNextNodeKey( _
ByVal NodeKey As String _
) As String

GetNodeAbapImage Retrieves the icon code of an image displayed in the speci-


fied node (for example “01”).
Public Function GetNodeAbapImage( _
ByVal Key As String _  Note
) As String
The default folder icon is returned as the blank value.

GetNodeChildrenCount Returns the number of visible direct children of the specified


node.
Public Function
GetNodeChildrenCount( _
ByVal Key As String _
) As Long

GetNodeChildrenCountByPath This function returns the number of visible children of the


node given by the path parameter.
Public Function
GetNodeChildrenCountByPath( _
ByVal Path As String _
) As Long

GetNodeHeight Returns the height of the specified node in pixels.

Public Function GetNodeHeight( _


ByVal Key As String _
) As Long

GetNodeIndex Returns the index of the specified key within its node.

Public Function GetNodeIndex( _


ByVal Key As String _
) As Long

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 269
Method

Syntax Description

GetNodeItemHeaders This method can only be used on trees of type 2 (Column


Tree).
Public Function GetNodeItemHeaders( _
ByVal NodeKey As String _ It returns a collection of the texts belonging to the subnodes
) As Object
of the specified node in the hierarchy header column.

GetNodeKeyByPath Key of the node specified by the given path description.

Public Function GetNodeKeyByPath( _


ByVal Path As String _
) As String

GetNodeLeft Returns the left position of the specified node in pixels.

Public Function GetNodeLeft( _


ByVal Key As String _
) As Long

GetNodePathByKey Given a node key, the path is retrieved (e.g. 2\1\2).

Public Function GetNodePathByKey( _


ByVal Key As String _
) As String

GetNodesCol The collection contains the node keys of all the nodes in the
tree.
Public Function GetNodesCol() As
Object

GetNodeStyle Retrieves the index of the style assigned to the specified


node.
Public Function GetNodeStyle( _
ByVal NodeKey As String _
) As Long

GetNodeTextByKey This function returns the text of the node specified by the
given key.
Public Function GetNodeTextByKey( _
ByVal Path As String _
) As String

GetNodeTextByPath The text of a node defined by the given path is returned.

Public Function GetNodeTextByPath( _


ByVal Path As String _
) As String

GetNodeTextColor Returns the font color of the specified node.

Public Function GetNodeTextColor( _


ByVal Key As String _
) As ULong

SAP GUI Scripting API


270 PUBLIC SAP GUI Scripting API
Method

Syntax Description

GetNodeToolTip Returns the tooltip of the specified node.

Public Function GetNodeToolTip( _


ByVal NodeKey As String _
) As String

GetNodeTop Returns the top position of the specified node in pixels.

Public Function GetNodeTop( _


ByVal Key As String _
) As Long

GetNodeWidth Returns the width of the specified node in pixels.

Public Function GetNodeWidth( _


ByVal Key As String _
) As Long

GetParent Key of the parent node of the node specified by the given
key.
Public Function GetParent( _
ByVal CKey As String _
) As String

GetPreviousNodeKey Returns the key of the previous node belonging to the same
node one level above.
Public Function GetPreviousNodeKey( _
ByVal NodeKey As String _
) As String

GetSelectedNodes Returns a GuiCollection that contains the node keys of all


selected nodes.
Public Function GetSelectedNodes() As
Object

GetSelectionMode The selection behaviour of a Tree Control instance is set


once at the time of creation.
Public Function GetSelectionMode() As
Integer Return Type

• 0: Single Node
• 1: Multiple Node
• 2: Single Item
• 3: Multiple Item

GetStyleDescription Retrieves the description of the style specified by parameter


as a string.
Public Function GetStyleDescription( _
ByVal nStyle As Long _
) As String

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 271
Method

Syntax Description

GetSubNodesCol Collection of the keys of all subnodes of the node specified


by the given key.
Public Function GetSubNodesCol( _
ByVal NodeKey As String _
) As Object

GetTreeType The returned number has the following meaning:

Public Function GetTreeType() As Long • 0 : Simple tree


• 1 : List tree
• 2 : Column tree

HeaderContextMenu This method requests a context menu for a header.

Public Sub HeaderContextMenu( _


ByVal HeaderName As String _ )

IsFolder Returns True if the specified object is a node and not a leaf.

Public Function IsFolder( _


ByVal NodeKey As String _
) As Byte

IsFolderExpandable Returns True if

Public Function IsFolderExpandable( _


• the node has children OR
ByVal NodeKey As String _ • the tree control is using load on de-
) As Byte mand AND the ABAP application has de-
fined the NODE_SET_EXPANDER flag (method
CL_TREE_CONTROL_BASE=>NODE_SET_EXPANDER)

See also SAP Note 3321283 .

IsFolderExpanded Returns True if the folder belonging to the specified node is


expanded.
Public Function IsFolderExpanded( _
ByVal NodeKey As String _
) As Byte

ItemContextMenu This method requests a context menu for an item.

Public Sub ItemContextMenu( _


ByVal NodeKey As String, _
ByVal ItemName As String _
)

NodeContextMenu This method requests a context menu for a node.

Public Sub NodeContextMenu( _


ByVal NodeKey As String _
)

SAP GUI Scripting API


272 PUBLIC SAP GUI Scripting API
Method

Syntax Description

PressButton This method emulates pressing a button.

Public Sub PressButton( _


ByVal NodeKey As String, _
ByVal ItemName As String _
)

PressHeader This method emulates clicking a header.

Public Sub PressHeader( _


ByVal HeaderName As String _
)

PressKey This method emulates pressing a key.

Public Sub PressKey( _


ByVal Key As String _
)

SelectColumn This function adds a column to the column selection. A node


or item selection is removed.
Public Sub SelectColumn( _
ByVal ColumnName As String _
)

SelectedItemColumn The name of the column of the selected item.

Public Function SelectedItemColumn()


As String

SelectedItemNode The node key of the selected item.

Public Function SelectedItemNode() As


String

SelectItem This function emulates the selection of an item. This selec-


tion removes all other selections.
Public Sub SelectItem( _
ByVal NodeKey As String, _
ByVal ItemName As String _
)

SelectNode The node with the key nodeKey is added to the Node Selec-
tion.
Public Sub SelectNode( _
ByVal NodeKey As String _
)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 273
Method

Syntax Description

SetCheckBoxState This method checks or unchecks the checkbox in the speci-


fied cell of the tree control (if parameter "state" equals 0
Public Sub SetCheckBoxState( _ the checkbox is unchecked, if the parameter equals 1 the
ByVal NodeKey As String, _ checkbox is checked.
ByVal ItemName As String, _
ByVal state As Long _
)

SetColumnWidth This function sets the width of a column in pixels.

Public Sub SetColumnWidth( _


ByVal ColumnName As String, _
ByVal Width As Long _
)

UnselectAll All selections are removed.

Public Sub UnselectAll()

UnselectColumn This function removes a column from the column selection.

Public Sub UnselectColumn( _


ByVal ColumnName As String _
)

UnselectNode The node with the key nodeKey is removed from the Node
Selection.
Public Sub UnselectNode( _
ByVal NodeKey As String _
)

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


274 PUBLIC SAP GUI Scripting API
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

All additional properties of the GuiShell Object [page 207]:

• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 275
Property

Syntax Description

ColumnOrder (Read-write) The property is used for working with a sequence of col-
umns. The name of each column in the Column Tree must
Public Property ColumnOrder As Object
occur exactly once.

Remarks

Preconditions: Tree is a Column Tree and the Column Order


can be changed.

 Note
If you assign a new GuiCollection containing the column
names, you must not include fixed columns in this col-
lection.

HierarchyHeaderWidth (Read-write) The width of the Hierarchy Header in pixels.

Public Property HierarchyHeaderWidth Remarks


As Long
Precondition: Tree is a Column Tree or a List Tree with
Header

SelectedNode (Read-write) This is the key of the currently selected node. Selecting a
node removes other selections (that is Column Selection
Public Property SelectedNode As String
and Item Selection).

Remarks

Precondition: Node Selection Mode is SingleNodeSelection

TopNode (Read-write) This property influences the vertical scrolling of the Tree
Control. TopNode contains the key of the node that is lo-
Public Property TopNode As String
cated on the upper edge of the Tree Control. Setting a node x
as top node is only possible if there are enough visible nodes
below x to fill the display area of the Tree Control.

1.2.70 GuiUserArea Object

Description

The GuiUserArea comprises the area between the toolbar and status bar for windows of GuiMainWindow type
and the area between the titlebar and toolbar for modal windows, and may also be limited by docker controls.
The standard dynpro elements can be found only in this area, with the exception of buttons, which are also
found in the toolbars.

SAP GUI Scripting API


276 PUBLIC SAP GUI Scripting API
GuiUserArea extends the GuiVContainer Object [page 286]. The type prefix and name are usr.

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

All methods of the GuiVContainer Object [page 286]:

• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx

FindByLabel A very simple method for finding an object is to search by


specifying the text of the respective label and the type of the
Public Function FindByLabel( _
ByVal Text As String, _ component by type name.
ByVal Type As String _
) As GuiComponent

ListNavigate This method sends a navigation command within ABAP Lists


to the SAP system, if the respective ABAP List and the cur-
Public Sub ListNavigate( _
ByVal NavType As String _ rently focused element in the ABAP list support the specified
) type of navigation. If the navigation is not supported, no
command is send to the server.

Possible values for the parameter NavType which specifies


the type of navigation are (all case-sensitive):

TAB, TAB_BACK, JUMP_OVER, JUMP_OVER_BACK,


JUMP_OUT, JUMP_OUT_BACK, JUMP_SECTION,
JUMP_SECTION_BACK

You find information on the navigation within ABAP Lists


here.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 277
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

The following properties of the GuiVComponent Object [page 281] (some properties like the Accessibility properties are not
supported, because they are not needed):

• Changeable
• DefaultTooltip
• Height
• IconName
• Left
• Modified
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

HorizontalScrollbar (Read-only) The user area is defined to be scrollable even if the scrollbars
are not always visible.
Public Property HorizontalScrollbar
As GuiScrollbar

IsOTFPreview (Read-only) This property is TRUE, if a SAPScript Preview Control is dis-


played on the user area.
Public Property IsOTFPreview As Byte

VerticalScrollbar (Read-only) The user area is defined to be scrollable even if the scrollbars
are not always visible.
Public Property VerticalScrollbar As
GuiScrollbar

SAP GUI Scripting API


278 PUBLIC SAP GUI Scripting API
1.2.71 GuiUtils Object

Methods

Method

Syntax Description

CloseFile This function closes a file that was opened using OpenFile.

Public Sub CloseFile( _


ByVal File As Long _
)

OpenFile The file will be created in the SAP GUI Documents Folder.

Public Function OpenFile( _ Return Type


ByVal Name As String _
) As Long The return value is a handle to the file.

Name: Name of the text file to be created. For security rea-


sons this name must not contain any path information.

ShowMessageBox Shows a message box.

Public Function ShowMessageBox( _ Return Type


ByVal Title As String, _
ByVal Text As String, _ The return value will be one of the GuiMessageBoxResult
ByVal MsgIcon As Long, _ constants.
ByVal MsgType As Long _
) As Long Title: Title of the message box

Text: Text of the message box.


MsgIcon: MsgIcon sets the icon to be used for the mes-
sage box and should be set to one of the GuiMessageBox-
Type constants.

MsgType: MsgType sets the buttons available on the mes-


sage box and should be set to one of the GuiMessageBoxOp-
tion constants.

Write Write text to an open file without a new line at the end.

Public Sub Write( _


ByVal File As Long, _
ByVal Text
As String _
)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 279
Method

Syntax Description

WriteLine Write text to an open file with a new line at the end.

Public Sub WriteLine( _


ByVal File As Long, _
ByVal Text
As String _
)

Properties

Property

Syntax Description

MESSAGE_OPTION_OK (Read-only) Belongs to GuiMessageBoxOption: The message box will


show an "OK" button.
Public Property MESSAGE_OPTION_OK As
Long

MESSAGE_OPTION_OKCANCEL (Read-only) Belongs to GuiMessageBoxOption: The message box will


show an "OK" and a "Cancel" button.
Public Property
MESSAGE_OPTION_OKCANCEL As Long

MESSAGE_OPTION_YESNO (Read-only) Belongs to GuiMessageBoxOption: The message box will


show a "Yes" and a "No" button.
Public Property MESSAGE_OPTION_YESNO
As Long

MESSAGE_RESULT_CANCEL (Read-only) Belongs to GuiMessageBoxResult: The message box was


closed via the "Cancel" button.
Public Property MESSAGE_RESULT_CANCEL
As Long

MESSAGE_RESULT_NO (Read-only) Belongs to GuiMessageBoxResult: The message box was


closed via the "No" button.
Public Property MESSAGE_RESULT_NO As
Long

MESSAGE_RESULT_OK (Read-only) Belongs to GuiMessageBoxResult: The message box was


closed via the "OK" button.
Public Property MESSAGE_RESULT_OK As
Long

SAP GUI Scripting API


280 PUBLIC SAP GUI Scripting API
Property

Syntax Description

MESSAGE_RESULT_YES (Read-only) Belongs to GuiMessageBoxResult: The message box was


closed via the "Yes" button.
Public Property MESSAGE_RESULT_YES As
Long

MESSAGE_TYPE_ERROR (Read-only) Belongs to GuiMessageBoxType; The message box shows


the respective icon for an error message.
Public Property MESSAGE_TYPE_ERROR As
Long

MESSAGE_TYPE_INFORMATION (Read-only) Belongs to GuiMessageBoxType; The message box shows


the respective icon for an information message.
Public Property
MESSAGE_TYPE_INFORMATION As Long

MESSAGE_TYPE_PLAIN (Read-only) Belongs to GuiMessageBoxType; The message box shows no


icon.
Public Property MESSAGE_TYPE_PLAIN As
Long

MESSAGE_TYPE_QUESTION (Read-only) Belongs to GuiMessageBoxType; The message box shows


the respective icon for a question.
Public Property MESSAGE_TYPE_QUESTION
As Long

MESSAGE_TYPE_WARNING (Read-only) Belongs to GuiMessageBoxType; The message box shows


the respective icon for a warning message.
Public Property MESSAGE_TYPE_WARNING
As Long

1.2.72 GuiVComponent Object

The GuiVComponent interface is exposed by all visual objects, such as windows, buttons or text fields. Like
GuiComponent, it is an abstract interface. Any object supporting the GuiVComponent interface also exposes
the GuiComponent interface. GuiVComponent extends the GuiComponent Object [page 82].

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 281
Methods

Method

Syntax Description

DumpState This function dumps the state of the object. The parameter
innerObject may be used to specify for which internal object
Public Function DumpState( _
ByVal InnerObject As String _ the data should be dumped. Only the most complex compo-
) As GuiCollection nents, such as the GuiCtrlGridView, support this parameter.
All other components always dump their full state. All com-
ponents that support this parameter have in common that
they return general information about the control’s state if
the parameter “innerObject” contains an empty string. The
available values for the innerObject parameter are specified
as part of the class description for those components that
support it.

 Note
The DumpState method returns a hierarchy of collec-
tions of type GuiCollection, which is three levels deep.

• The top (first) level collection contains a second


level collection for every property that is to be
dumped.
• The second level collection contains the complete
information for one property. There is a third level
collection for every sub-expression that might be
required to access inner objects.
• Finally, the third level collection contains the Op-
Code, the property or method name, the parameter
values and depending on the OpCode the return
value to be checked.

The following OpCodes are used:

• GPR: Get property and compare return value.


• MR: Execute method and compare return value.
• GP: Get property and execute the next entry in the
second level collection on the result.
• M: Execute the method and then execute the next
entry in the second level collection on the result.

For example the calls

control.ItemCount = 42
control.GetItemValue(3, 2) =
'MyText'
control.GetItem('2','3').Property1.
MethodY('XYZ').Text = 'ABC'

result in three entries of the top level collection:

SAP GUI Scripting API


282 PUBLIC SAP GUI Scripting API
Method

Syntax Description

• First entry:
• OpCode Name Parameter1/
• Property-Value
• Parameter2 Parameter3
• GPR ItemCount 42
• Second entry:
• OpCode Name Parameter1 Parameter2 Pa-
rameter3/
• Property-Value
• MR GetItemValue 3 2 MyText
• Third entry:
• OpCode Name Parameter1 Parameter2 Pa-
rameter3
• M GetItem 2 3
• GP Property1
• M MethodY XYZ
• GPR Text ABC

As you can see in this example, for calls that contain


return values (MR, GPR) the last value in the third level
collection is the return value.

SetFocus This function can be used to set the focus onto an object.
If a user interacts with SAP GUI, it moves the focus when-
Public Sub SetFocus()
ever the interaction is with a new object. Interacting with
an object through the scripting component does not change
the focus. There are some cases in which the SAP applica-
tion explicitly checks for the focus and behaves differently
depending on the focused object.

Visualize Calling this method of a component will display a red frame


around the specified component if the parameter on is
Public Function Visualize( _
ByVal On As Boolean, _ true. The frame will be removed if on is false. Some compo-
Optional ByVal InnerObject As nents such as GuiCtrlGridView support displaying the frame
Variant _ around inner objects, such as cells. The format of the inner-
) As Byte
Object string is the same as for the dumpState method.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 283
Properties

Property

Syntax Description

All Properties of GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

AccLabelCollection The collection contains objects of type GuiLabel that were


assigned to this control in the ABAP Screen Painter.
Public Property AccLabelCollection As
GuiComponentCollection

AccText (Read-only) An additional text for accessibility support.

Public Property AccText As String

AccTextOnRequest (Read-only) An additional text for accessibility support.

Public Property AccTextOnRequest As


String

AccTooltip (Read-only) An additional tooltip text for accessibility support.

Public Property AccTooltip As String

Changeable (Read-only) An object is changeable if it is neither disabled nor read-only.

Public Property Changeable As Byte

DefaultTooltip (Read-only) Tooltip text generated from the short text defined in the data
dictionary for the given screen element type.
Public Property DefaultTooltip As
String

Height (Read-only) Height of the component in pixels.

Public Property Height As Long

IconName (Read-only) If the object has been assigned an icon, then this property is
the name of the icon, otherwise it is an empty string.
Public Property IconName As String

SAP GUI Scripting API


284 PUBLIC SAP GUI Scripting API
Property

Syntax Description

IsSymbolFont (Read-only) The property is TRUE if the component's text is visualized in


the SAP symbol font.
Public Property IsSymbolFont As Byte

Left (Read-only) Left position of the element in screen coordinates

Public Property Left As Long

Modified An object is modified if its state has been changed by the


user and this change has not yet been sent to the SAP sys-
Public Property Modified As Byte
tem.

ParentFrame (Read-only) If the control is hosted by the Frame object, the value of the
property is this frame. Overwise NULL.
Public Property ParentFrame As
GuiComponent

ScreenLeft (Read-only) The y position of the component in screen coordinates.

Public Property ScreenLeft As Long

ScreenTop (Read-only) The x position of the component in screen coordinates.

Public Property ScreenTop As Long

Text (Read-write) The value of this property very much depends on the type of
the object on which it is called. This is obvious for text fields
Public Property Text As String
or menu items. On the other hand this property is empty for
toolbar buttons and is the class id for shells. You can read
the text property of a label, but you can’t change it, whereas
you can only set the text property of a password field, but
not read it.

Tooltip (Read-only) The tooltip contains a text which is designed to help a user
understand the meaning of a given text field or button.
Public Property Tooltip As String

Top Top coordinate of the element in screen coordinates.

Public Property Top As Long

Width (Read-only) Width of the component in pixels.

Public Property Width As Long

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 285
1.2.73 GuiVContainer Object

Description

An object exposes the GuiVContainer interface if it is both visible and can have children. It will then also
expose GuiComponent and GuiVComponent. Examples of this interface are windows and subscreens, toolbars
or controls having children, such as the splitter control. GuiVContainer extends the GuiContainer Object [page
87] and the GuiVComponent Object [page 281].

Methods

Method

Syntax Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

All methods of the GuiContainer Object [page 87]:

• FindById

FindAllByName The methods FindByName and FindByNameEx return


only the first object with matching name and type. There
Public Function FindAllByName( _
ByVal Name As String, _ may however be several matching objects, which will be re-
ByVal Type As String _ turned as members of a collection when FindAllByName
) As GuiComponentCollection
or FindAllByNameEx are used.

FindAllByNameEx The methods FindByName and FindByNameEx return


only the first object with matching name and type. There
Public Function FindAllByNameEx( _
ByVal Name As String, _ may however be several matching objects, which will be re-
ByVal Type As Long _ turned as members of a collection when FindAllByName
) As GuiComponentCollection
or FindAllByNameEx are used.

This method works exactly like FindAllByName, but


takes the type parameter with data type long coming from
the GuiComponentType enumeration. See also GuiCompo-
nentType [page 297].

SAP GUI Scripting API


286 PUBLIC SAP GUI Scripting API
Method

Syntax Description

FindByName Unlike FindById, this function does not guarantee a


unique result. It will simply return the first descendant
Public Function FindByName( _
ByVal Name As String, _ matching both the name and type parameters. This is a
ByVal Type As String _ more natural description of the object than the complex id,
) As GuiComponent
but it only makes sense on dynpro objects as most other
objects do not have a meaningful name. If no descendant
with matching name and type can be found, the function
raises an exception.

FindByNameEx This method works exactly like FindByName, but takes


the type parameter with data type long coming from the Gui-
Public Function FindByNameEx( _
ByVal Name As String, _ ComponentType enumeration. See also GuiComponentType
ByVal Type As Long _ [page 297].
) As GuiComponent

Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 287
Property

Syntax Description

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

All properties of the GuiContainer Object [page 87]:

• Children

1.2.74 GuiVHViewSwitch Object

Description

GuiVHViewSwitch represents the “View Switch” object that was introduced with the Belize theme in SAP GUI.
The View Switch is placed in the header area of the SAP GUI main window and can be used to select different

SAP GUI Scripting API


288 PUBLIC SAP GUI Scripting API
views within an application. Many screens can be displayed in different ways (for example, as a tree or list). To
switch from one view to another in a comfortable way, these screens may make use of the View Switch:

GuiVHViewSwitch is very similar to GuiOkCodeField Object [page 172] and extends the GuiVComponent Object
[page 281]. The name of the GuiVHViewSwitch object is always vhviewswitch and only one object of this type
can exist at the same time.

 Note

• GuiVHViewSwitch exists as of SAP GUI for Windows 7.60 (the UI object itself was introduced in SAP
GUI for Windows 7.50, but the extension of the Scripting API is done for SAP GUI for Windows 7.60 and
newer SAP GUI versions, only)
• Objects of type GuiVHViewSwitch can only exist when SAP GUI is running with a Fiori theme like Belize
• GuiVHViewSwitch does not offer an entry collection. For compatibility reasons the entries of a
GuiVHViewSwitch are still GuiButtons which belong to the application toolbar (tbar1).

Methods

Method Description

All methods of the GuiVComponent Object [page 281]:

• DumpState
• SetFocus
• Visualize

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 289
Properties

Property

Syntax Description

All properties of the GuiComponent Object [page 82]:

• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber

All properties of the GuiVComponent Object [page 281]:

• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width

SAP GUI Scripting API


290 PUBLIC SAP GUI Scripting API
1.3 Events

Event

Syntax Description

AbapScriptingEvent

Public Event AbapScriptingEvent( _


ByVal param As String _
)

Activated

Public Event Activated( _


ByVal Session As GuiSession _
)

AutomationFCode The event is only fired when using the SAP Workplace. It
notifies the listener that SAP GUI executes a function code
Public Event AutomationFCode( _
ByVal Session As GuiSession, _ that was set by the Workplace framework.
ByVal FunctionCode As String _
)

Change In record mode, the session collects changes to elements


of the user interface and sends these changes to a listening
Public Event Change( _
ByVal Session As GuiSession, _ application whenever server communication is about to start
ByVal Component As GuiComponent, _ or if the record mode is turned off. The Change events
ByVal CommandArray As Variant _
) are raised immediately before the StartRequest event.
There is at least one event for every modified element in the
recorded session.

see also: Change Event - Additional Remarks [page 294]

ContextMenu The ContextMenu event is fired when SAP GUI is about


to display a context menu. There are currently the following
Public Event ContextMenu( _
ByVal Session As GuiSession, _ limitations:
ByVal Component As GuiVComponent _
) • Only context menus of controls of type GuiShell are
supported.
• The event is not fired for “cached” context menus,
which are not retrieved from the server when being
opened.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 291
Event

Syntax Description

CreateSession This event is raised whenever a new session is created, irre-


spective of whether of the session being created manually,
Public Event CreateSession( _
ByVal Session As GuiSession _ from ABAP or by a script. The event is only raised for a
) session if the scripting support has been enabled for the
corresponding backend.

Example

 Sample Code

Dim objSapGui
Set objSapGui = GetObject("SAPGUI")
Dim objScriptingEngine
Set objScriptingEngine =
objSapGui.GetScriptingEngine
WScript.ConnectObject
objScriptingEngine, "Engine_"
Dim Waiting
Waiting = 1
Do While (Waiting = 1)
WScript.Sleep(100)
Loop
Set objScriptingEngine = Nothing
Set objSapGui = Nothing
Sub Engine_CreateSession(ByVal
Session)
Dim result
result = MsgBox("Session
created", vbOKCancel)
If result = vbCancel then
Waiting = 0
End If
End Sub

Destroy This event is raised before a session is destroyed.

Public Event Destroy( _


ByVal Session As GuiSession _
)

DestroySession This event is raised before a session is destroyed . This can


be done either by closing the main window manually, or by
Public Event DestroySession( _
ByVal Session As GuiSession _ calling the closeSession method of GuiConnection.
)

EndRequest endRequest is called immediately after the session is un-


locked after server communication.
Public Event EndRequest( _
ByVal SessionSession As GuiSession _
)

SAP GUI Scripting API


292 PUBLIC SAP GUI Scripting API
Event

Syntax Description

Error (GuiSession Object [page 189]) An Error event is currently only raised, if the wrapper li-
brary required to access a SAP GUI ActiveX control from a
Public Event Error( _
ByVal Session As GuiSession, _ script is not available. error events from all sessions are also
ByVal ErrorId As Long, _ available at the GuiApplication.
ByVal Desc1 As String, _
ByVal Desc2 As String, _
ByVal Desc3 As String, _
ByVal Desc4 As String _
)

Error (GuiApplication Object [page 38]) An Error event is currently only raised, if the wrapper
library required to access a SAP GUI ActiveX control from
Public Event Error( _
ByVal ErrorId As Long, _ a script is not available. This event is also available on the
ByVal Desc1 As String, _ GuiSession in which the error occurred.
ByVal Desc2 As String, _
ByVal Desc3 As String, _
ByVal Desc4 As String _
)

FocusChanged

Public Event FocusChanged( _


ByVal Session As GuiSession, _
ByVal NewFocusedControl As
GuiVComponent _
)

HistoryOpened

Public Event HistoryOpened( _


ByVal Session As GuiSession, _
ByVal NewFocusedControl As
GuiVComponent _
)

Hit The Hit event is only raised when elementVisualization-


Mode is set to True, which turns on the hit test mode of SAP
Public Event Hit( _
ByVal SessionSession As GuiSession, GUI. If in this mode a SAP GUI component is identified, the
_ Hit event is raised. The parameters of this event are
ByVal Component As GuiComponent, _
ByVal InnerObject As String _ • The session on which the component was hit
)
• The component that was hit
• A description of an inner object of the component if an
inner object was hit

IgnoreSession The event is fired when a session is set to ‘Ignored’ using


IgnoreSession function. This event is only fired when using
Public Event IgnoreSession( _
ByVal SessionMainWindowHandle As SAP GUI Scripting while running eCATT in parallel.
Integer _
)

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 293
Event

Syntax Description

ProgressIndicator

Public Event ProgressIndicator( _


ByVal percentage As Long, _
ByVal Text As String _
)

StartRequest The startRequest event is raised before the session is


locked during server communication. At this point user input
Public Event StartRequest( _
ByVal Session As GuiSession _ can be checked before it is sent to the server. It is not possi-
) ble to prevent server communication from this event.

1.3.1 Change Event - Additional Remarks

Only changes made at the SAP GUI level are recorded. Transactions may preset some of the entry fields with
values from parameters stored in the SAP system. If these data are not changed in SAP GUI, they will not
be recorded. This may cause problems during playback of scripts, if the entry fields are preset with different
values.

If any of the following techniques is used in a transaction, the user should manually modify all the entries he
wants to see recorded:

• Usage of SAP parameters


• Variants
• Hold Data, from the menu System -> User Profile

Playback of the changes will only work, if the order of the calls is the same as during recording.

Each event represents one line of script code. The Component parameter specifies the object on which to
invoke a method or property. Therefore the first thing to record is Component.id for later use with FindById.
The recorder may however also decide to record other properties of Component. If, for example, a line in a table
control or list is selected, it may be prudent not to record the position of the line, but rather the values in it. That
way, a script can be generated that is more robust with respect to changes in the number, and therefore in the
position, of lines.

SAP GUI Scripting API


294 PUBLIC SAP GUI Scripting API
If new function modules have been added, selecting a line from the list might return the wrong function
module.

Type Method/Property name Parameters

"SP" Text "Hello World"

This sets the parameter Text to value “Hello World”.

Type Method/Property name Parameters

"SP" RecordMode True

This sets the parameter RecordMode to the Boolean value True. It is up to the recorder to generate a script line
with a valid textual representation of Boolean values, such as “true”, “True” or “TRUE” for example.

Type Method/Property name Parameters

"SP" TestToolMode 0

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 295
This sets the parameter TestToolMode to value 0.

Type Method/Property name Parameters

"M" Resize 96

32

False

The method Resize is called with three parameters. In this case the third member of the CommandArray is an
array with 3 elements.

There are cases in which the CommandArray contains more than one line.

If a row is selected in this table control, two entries are added to the generated Change event’s CommandArray
parameter.

Type Method/Property name Parameters

"M" getAbsoluteRow 1

"SP" True
selected

The script code required to select this line should then look like this:

 Sample Code

Session.
findById("wnd[0]/usr/tblSAPMBIBSTC537").
getAbsoluteRow("1").

SAP GUI Scripting API


296 PUBLIC SAP GUI Scripting API
selected = "True"

1.4 Enumerations

1.4.1 GuiComponentType

Members

Member Value

GuiApplication 10

GuiBox 62

GuiButton 40

GuiCheckBox 42

GuiCollection 120

GuiComboBox 34

GuiComponent 0

GuiComponentCollection 128

GuiConnection 11

GuiContainer 70

GuiContainerShell 51

GuiCTextField 32

GuiCustomControl 50

GuiDialogShell 125

GuiDockShell 126

GuiFrameWindow 20

GuiGOSShell 123

GuiLabel 30

GuiListContainer 73

GuiMainWindow 21

GuiMenu 110

GuiMenubar 111

GuiMessageWindow 23

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 297
Member Value

GuiModalWindow 22

GuiOkCodeField 35

GuiPasswordField 33

GuiRadioButton 41

GuiScrollbar 100

GuiScrollContainer 72

GuiSession 12

GuiSessionInfo 121

GuiShell 122

GuiSimpleContainer 71

GuiSplitterContainer 75

GuiSplitterShell 124

GuiStatusbar 103

GuiStatusBarLink 130

GuiStatusPane 43

GuiTab 91

GuiTableColumn 81

GuiTableControl 80

GuiTableRow 82

GuiTabStrip 90

GuiTextField 31

GuiTitlebar 102

GuiToolbar 101

GuiUnknown -1

GuiUserArea 74

GuiVComponent 1

GuiVContainer 2

GuiVHViewSwitch 129

1.4.2 GuiErrorType

SAP GUI Scripting API


298 PUBLIC SAP GUI Scripting API
Members

Member Value Description

Gui_Err_AccessDenied 633 Access denied.

Gui_Err_Bad_Focus 634 Can not set focus to this object.

Gui_Err_Bad_Index_Type 618 Bad index type for collection access.

Gui_Err_Column_Name 639 Wrong column name.

Gui_Err_Control_Label 615 The control could not be found by label.

Gui_Err_Control_Name 608 The control could not be found by name.

Gui_Err_Control_Position 616 The control could not be found by position.

Gui_Err_Disconnected 621 The object invoked has disconnected from its clients.

Gui_Err_Enumerator_Index 614 The enumerator of the collection cannot find an element with the specified
index.

Gui_Err_Enumerator_Reset 612 The enumerator of the collection cannot be reset.

Gui_Err_FindById 619 The control could not be found by id.

Gui_Err_FindByName 620 The control could not be found by name.

Gui_Err_FindByPos 632 The control could not be found by position.

Gui_Err_Front_Module 602 The path of the 'sapfront.dll' could not be determined.

Gui_Err_Init 601 Sapgui engine cannot be initialized.

Gui_Err_Int_Get_Ses- 629 Can not get session from TLS


sion_Failed

Gui_Err_Int_GetCtrl_Failed 625 Could not get ctrl (Internal Error)

Gui_Err_Int_GetFocusMan- 627 Could not get focus manager from session (Internal Error)
FromSes_Failed

Gui_Err_Int_GetSes- 626 Could not get session from ctrl (Internal Error)
FromCtrl_Failed

Gui_Err_Int_Invalid_Test- 628 Invalid test tool mode


ToolMode

Gui_Err_Int_View_Not_Set 630 View not set (Internal Error)

Gui_Err_Invalid_Argument 613 The method got an invalid argument.

Gui_Err_Invalid_Context 603 Function called in invalid thread context

Gui_Err_Invalid_Window 611 The required window is invalid.

Gui_Err_Logon_Module 604 The 'Sapgui Logon Component' could not be instantiated.

Gui_Err_Menu_Disabled 623 The menu item is disabled.

Gui_Err_No_ListBox 638 No ListBox is active

Gui_Err_No_Memory 607 The system is out of memory.

Gui_Err_No_Wrapper 622 No wrapper available for this control.

Gui_Err_Not_Implemented 610 The method or property is currently not implemented.

Gui_Err_Permission_Denied 637 Permission denied.

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 299
Member Value Description

Gui_Err_Property_Readonly 609 The property is readonly.

Gui_Err_Resize_Failed 631 Resize failed.

Gui_Err_Row_Index 640 The row index is out of range.

Gui_Err_Sapgui_Module 605 The 'Sapgui Component' could not be instantiated.

Gui_Err_Save_Image 635 Error saving image.

Gui_Err_Scripting_Disa- 624 Scripting is disabled by the server.


bled_Srv

Gui_Err_Session_Index 606 The session index is out of range.

Gui_Err_Shortcut_Evalua- 636 Shortcut evaluation failed.


tion

Gui_Err_SL_No_Entry 1000 Not a valid SAPLogon entry

Gui_Err_VKey_Disabled 617 The virtual key is not enabled.

1.4.3 GuiEventType

Members

Member Value Description

SapApplicationCreateSessionEvent 2002 ApplicationCreateSession

SapApplicationDestroySessionEvent 2003 ApplicationDestroySession

SapApplicationErrorEvent 2004 ApplicationErrorEvent

SapApplicationIgnoreSessionEvent 2005 ApplicationIgnoreSession

SapContextMenuEvent 1282 ContextMenu

SapCustomDataChangedEvent 1280 CustomDataChanged

SapDefaultEvent 0 Default

SapHitSelectEvent 1281 Hit

SapSessionAbapScriptingEvent 1289 AbapScriptingEvent

SapSessionActivatedEvent 1285 SessionActivated

SapSessionAutoFCodeEvent 1284 SessionAutoFCode

SapSessionDestroyEvent 1283 SessionDestroy

SapSessionEndRequestEvent 515 SessionEndRequest

SapSessionErrorEvent 516 SessionError

SapSessionFocusChangedEvent 1286 SessionFocusChanged

SapSessionHistoryOpenedEvent 1287 SessionHistoryOpened

SAP GUI Scripting API


300 PUBLIC SAP GUI Scripting API
Member Value Description

SapSessionProgressIndicatorEvent 1288 ProgressIndicatorOpened

SapSessionStartRequestEvent 514 SessionStartRequest

1.4.4 GuiImageType

Members

Member Value

BMP 0

GIF 2

JPEG 1

PNG 2

1.4.5 GuiMagicDispIDs

Members

Member Value Base Object Name

GuiDispIDBTPress 32200 GuiButton Press

GuiDispIDButtonEm- 34402 GuiButton Emphasized


phasized

GuiDispIDCBChecked 32011 GuiCheckBox Checked

GuiDispIDCBCurList- 32305 GuiComboBox CurListBoxEntry


BoxEntry

GuiDispIDCBEntries 32302 GuiComboBox Entries

GuiDispIDCBEntryKey 33800 GuiComboBoxEntry Key

GuiDispIDCBEntryPos 33802 GuiComboBoxEntry Pos

GuiDispIDCBEntry- 33801 GuiComboBoxEntry Value


Value

GuiDispIDCBIsListBox- 32304 GuiComboBox IsListBoxActive


Active

GuiDispIDCBKey 32300 GuiComboBox Key

GuiDispIDCBKeySpace 32303 GuiComboBox SetKeySpace

GuiDispIDCBShowKey 32306 GuiComboBox ShowKey

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 301
Member Value Base Object Name

GuiDispIDCBValue 32301 GuiComboBox Value

GuiDispIDCollAdd 33103 GuiConnection Add

GuiDispIDCollCount 33100 GuiConnection Count

GuiDispIDCollElAt 33102 GuiConnection ElementAt

GuiDispIDCollLength 33101 GuiConnection Length

GuiDispIDConConn- 33003 GuiConnection ConnectionString


String

GuiDispIDConDescrip- 33002 GuiConnection Description


tion

GuiDispIDConDisabled 33001 GuiConnection DisabledByServer

GuiDispIDConnClose 32831 GuiConnection CloseConnection

GuiDispIDConSessions 33000 GuiConnection Sessions

GuiDispIDCTFindAllBy- 32035 GuiVContainer FindAllByName


Name

GuiDispIDCTFindAllBy- 32036 GuiContainer FindAllByNameEx


NameEx

GuiDispIDCTFindById 32029 GuiContainer FindById

GuiDispIDCTFindByLa- 32027 GuiUserArea FindByLabel


bel

GuiDispIDCTFindBy- 32026 GuiVContainer / GuiU- FindByName


Name serArea

GuiDispIDCTFindBy- 32034 GuiVContainer FindByNameEx


NameEx

GuiDispIDDockerIs- 34301 GuiDockShell DockerIsVertical


Vertical

GuiDispIDDockerPixel- 34300 GuiDockShell DockerPixelSize


Size

GuiDispIDEngAddHist 32913 GuiApplication AddHistoryEntry

GuiDispIDEngButtonB 32903 GuiApplication ButtonbarVisible

GuiDispIDEngCon 32900 GuiApplication Connections

GuiDispIDEngConnErr 32924 GuiApplication ConnectionErrorText

GuiDispIDEngCrColl 32911 GuiApplication CreateGuiCollection

GuiDispIDEngDropHist 32914 GuiApplication DropHistory

GuiDispIDEngGetEng 1 SapGuiAuto GetScriptingEngine

GuiDispIDEngHistEna- 32916 GuiApplication HistoryEnabled


bled

GuiDispIDEngIgnore 32908 GuiApplication Ignore

GuiDispIDEngInplace 32907 GuiApplication Inplace

SAP GUI Scripting API


302 PUBLIC SAP GUI Scripting API
Member Value Base Object Name

GuiDispIDEngMajor 32909 GuiApplication MajorVersion

GuiDispIDEngMinor 32910 GuiApplication MinorVersion

GuiDispIDEngNo- 32925 GuiApplication AllowSystemMessages


SysMsg

GuiDispIDEngOpen- 32905 GuiApplication OpentConnection


Con

GuiDispIDEngOpenCo- 32918 GuiApplication OpenConnectionBy-


nEx ConnectionString

GuiDispIDEngPatchle- 32919 GuiApplication PatchLevel


vel

GuiDispIDEngRegister 32921 GuiApplication RegisterROT

GuiDispIDEngRevision 32920 GuiApplication Revision

GuiDispIDEngRevoke 32923 GuiApplication RevokeROT

GuiDispIDEngStatusB 32902 GuiApplication StatusbarVisible

GuiDispIDEngTheme 32912 GuiApplication NewVisualDesign

GuiDispIDEngTitleB 32904 GuiApplication TitlebarVisible

GuiDispIDEngToolB 32901 GuiApplication ToolbarVisible

GuiDispIDEngUtils 32917 GuiApplication Utils

GuiDispIDGActiveSes- 32049 GuiApplication ActiveSession


sion

GuiDispIDGCAccDe- 33703 GuiShell AccDescription


scription

GuiDispIDGCAccLabel- 32043 GuiVComponent AccLabelCollection


Col

GuiDispIDGCAccText 32044 GuiVComponent AccText

GuiDispIDGCAccTex- 32045 GuiVComponent AccTextOnRequest


tOnReq

GuiDispIDGCAccTool- 32042 GuiVComponent AccTooltip


tip

GuiDispIDGCChangea- 32009 GuiVComponent Changeable


ble
 Note
Is mapped to
Selected.

GuiDispIDGCChar- 32073 GuiCheckBox and vari- CharHeight


Height ous others

GuiDispIDGCCharLeft 32070 GuiCheckBox and vari- CharLeft


ous others

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 303
Member Value Base Object Name

GuiDispIDGCCharTop 32071 GuiCheckBox and vari- CharTop


ous others

GuiDispIDGCChar- 32072 GuiCheckBox and vari- CharWidth


Width ous others

GuiDispIDGCChildren 32019 GuiContainer Children

GuiDispIDGCColorIn- 32058 GuiCheckBox ColorIndex


dex

GuiDispIDGCColorIn- 32059 GuiCheckBox ColorIntensified


tensified

GuiDispIDGCColorIn- 32060 GuiCheckBox ColorInverse


verse

GuiDispIDGCCtxMnu 33701 GuiDispIDGCCtxMnu CurrentContextMenu

GuiDispIDGCDefault- 32069 GuiVComponent DefaultTooltip


Tooltip

GuiDispIDGCDis- 32074 GuiTextField / GuiLa- DisplayedText


playedText bel

GuiDispIDGCDragDrop 33706 GuiShell DragDropSupported

GuiDispIDGCDump- 31194 GuiVComponent Dump State


State

GuiDispIDGCFlushing 33704 GuiCheckBox / Gui- Flushing


ComboBox / GuiRa-
dioButton

GuiDispIDGCHeight 32006 GuiVComponent Hight

GuiDispIDGCHwnd 33702 GuiShell Handle

GuiDispIDGCIcon 32037 GuiVComponent IconName

GuiDispIDGCId 32025 GuiComponent Id

GuiDispIDGCIsCon- 32033 GuiComponent ContainerType


tainer

GuiDispIDGCIsHotspot 32051 GuiTextField IsHotspot

GuiDispIDGCIsList 32052 GuiCheckBox IsListElement

GuiDispIDGCIsSte- 32062 GuiSimpleContainer IsStepLoop


pLoop

GuiDispIDGCIsSte- 32078 GuiSimpleContainer IsStepLoopInTableS-


pLoopInTableStructure tructure

GuiDispIDGCIsSym- 32061 GuiVComponen IsSymbolFont


bolFont

GuiDispIDGCLeft 32003 GuiVComponent Left

GuiDispIDGCLeftLabel 32040 GuiCheckBox LeftLable

GuiDispIDGCLoopCur- 32065 GuiSimpleContainer LoopCurrentCol


rentCol

SAP GUI Scripting API


304 PUBLIC SAP GUI Scripting API
Member Value Base Object Name

GuiDispIDGCLoopCur- 32077 GuiSimpleContainer LoopCurrentColCount


rentColCount

GuiDispIDGCLoopCur- 32066 GuiSimpleContaine LoopCurrentRow


rentRow

GuiDispIDGCLoo- 32064 GuiSimpleContainer LoopRowCount


pHeight

GuiDispIDGCLoop- 32063 GuiSimpleContainer LoopColCount


Width

GuiDispIDGCModified 32030 GuiVComponent Modified

GuiDispIDGCName 32001 GuiComponent Name

GuiDispIDGCOcxE- 33705 GuiShell OcxEvents


vents

GuiDispIDGCParent 32038 GuiComponent Parent

GuiDispIDGCParent- 32050 GuiVComponent ParentFrame


Frame

GuiDispIDGCRightLa- 32041 GuiCheckBox RightLabel


bel

GuiDispIDGCRowText 32053 GuiCheckBox RowText

GuiDispIDGCScreen- 32046 GuiVComponent ScreenLeft


Left

GuiDispIDGCScreen- 32047 GuiVComponent ScreenTop


Top

GuiDispIDGCSetFocus 32024 GuiVComponent SetFocus

GuiDispIDGCShow- 32068 GuiVComponent ShowContextMenu


ContextMenu

GuiDispIDGCSubType 33700 GuiShell SubType

GuiDispIDGCText 32000 GuiVComponent Text

GuiDispIDGCTitle 32048 GuiVComponent Title

GuiDispIDGCTooltip 32008 GuiVComponent Tooltip

GuiDispIDGCTop 32004 GuiVComponent Top

GuiDispIDGCType 32015 GuiComponent Type

GuiDispIDGCTypeAs- 32032 GuiComponent TypeAsNumber


Num

GuiDispIDGCVisualize 32039 GuiVComponent Visualize

GuiDispIDGCWidth 32005 GuiVComponent Width

GuiDispIDGetAbsolu- 33407 GuiTableControl GetAbsoluteRow


teRow

GuiDispIDGMSelect 33300 GuiMenu Select

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 305
Member Value Base Object Name

GuiDispIDGMWFocu- 32433 GuiMessageWindow FocusedButton


sedButton

GuiDispIDGMWHelp- 32440 OKButtonHelpText HelpButtonHelpText


ButtonHelpText

GuiDispIDGMWHelp- 32435 GuiMessageWindow HelpButtonText


ButtonText

GuiDispIDGMWMessa- 32437 GuiMessageWindow MessageText


geText

GuiDispIDGMWMessa- 32436 GuiMessageWindow MessageTyp


geType

GuiDispIDGMWOKBut- 32439 GuiMessageWindow OKButtonHelpText


tonHelpText

GuiDispIDGMWOKBut- 32434 GuiMessageWindow OkButtonText


tonText

GuiDispIDGMWVisible 32438 GuiMessageWindow Visible

GuiDispIDGUHorizon- 32600 GuiUserArea HorizontalScrollbar


talScrollbar

GuiDispIDGUListNav 32605 GuiUserArea ListNavigate

GuiDispIDGUOTFPre- 32606 GuiUserArea IsOTFPreview


view

GuiDispIDGUVertical- 32601 GuiUserArea VerticalScrollbar


Scrollbar

GuiDispIDGWButtonB 32425 GuiMainWindow ButtonVisible

GuiDispIDGWClose 32414 GuiFrameWindow Close

GuiDispIDGWComp- 32443 GuiFrameWindow CompBitmap


Bitmap

GuiDispIDGWGuiFocus 32422 GuiFrameWindow GuiFocus

GuiDispIDGWHandle 32420 GuiFrameWindow Handle

GuiDispIDGWHard- 32415 GuiFrameWindow HardCopy


Copy

GuiDispIDGWHardCo- 32441 GuiFrameWindow HardCopyToMemory


pyMem

GuiDispIDGWIconic 32400 GuiFrameWindow Iconic

GuiDispIDGWIconify 32408 GuiFrameWindow Iconify

GuiDispIDGWIsPopup- 32427 GuiModalWindow IsPopupDialog


Dialog

GuiDispIDGWJump- 32432 GuiFrameWindow JumpBackward


Backward

GuiDispIDGWJumpFor- 32431 GuiFrameWindow JumpForward


ward

SAP GUI Scripting API


306 PUBLIC SAP GUI Scripting API
Member Value Base Object Name

GuiDispIDGWMaximize 32410 GuiFrameWindow Maximize

GuiDispIDGWPopup- 32428 GuiModalWindow PopupDialogText


DialogText

GuiDispIDGWRestore 32409 GuiFrameWindow Restore

GuiDispIDGWSpyMode 32413 GuiFrameWindow ElementVisualization-


Mode

GuiDispIDGWStatusB 32424 GuiMainWindow StatusbarVisible

GuiDispIDGWSysFocus 32421 GuiFrameWindow SystemFocus

GuiDispIDGWTabBack- 32430 GuiFrameWindow TabBackward


ward

GuiDispIDGWTabFor- 32429 GuiFrameWindow TabForward


ward

GuiDispIDGWTitleB 32426 GuiMainWindow TitlebarVisible

GuiDispIDGWToolB 32423 GuiMainWindow ToolbarVisible

GuiDispIDGWVKAl- 32412 GuiFrameWindow IsKeyAllowed


lowed

GuiDispIDGWW- 32417 GuiFrameWindow WorkingPaneHeight


PHeight

GuiDispIDGWWPMsg- 32419 GuiFrameWindow ShowMessageBox


Box

GuiDispIDGWWPRe- 32418 GuiMainWindow ResizeWorkingPane


size

GuiDispIDGWWPResi- 32442 GuiMainWindow ResizeWorkingPaneEx


zeEx

GuiDispIDGWWPWidth 32416 GuiFrameWindow WorkingPaneWidth

GuiDispIDIsListBoxAc- 32840 GuiSession IsListBoxActive


tive

GuiDispIDLCursor 32022 GuiLabel CaretPosition

GuiDispIDLHighlighted 32100 GuiLabel Highlighted

GuiDispIDLIsLeftLabel 32101 GuiLabel IsLeftLabel

GuiDispIDLIsRightLa- 32102 GuiLabel IsRightLabel


bel

GuiDispIDListBoxCur- 32849 GuiSession ListBoxCurrEntry


rEntry

GuiDispIDListBoxCur- 32848 GuiSession ListBoxCurrEntry-


rEntryHeight Height

GuiDispIDListBoxCur- 32846 GuiSession ListBoxCurrEntryLeft


rEntryLeft

GuiDispIDListBoxCur- 32845 GuiSession ListBoxCurrEntryTop


rEntryTop

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 307
Member Value Base Object Name

GuiDispIDListBoxCur- 32847 GuiSession ListBoxCurrEntry-


rEntryWidth Width

GuiDispIDListBox- 32844 GuiSession ListBoxHeight


Height

GuiDispIDListBoxLeft 32842 GuiSession ListBoxLeft

GuiDispIDListBoxTop 32841 GuiSession ListBoxTop

GuiDispIDListBox- 32843 GuiSession ListBoxWidth


Width

GuiDispIDLListProp- 32103 GuiSimpleContainer GetListProperty


erty

GuiDispIDLMaxLength 32012 GuiTextField MaxLength

GuiDispIDLNumerical 32013 GuiTextFieldl Numerical

GuiDispIDLSimpleList- 32104 GuiSimpleContainer GetListPropertyNon-


Property Rec

GuiDispIDMsgAs- 34004 GuiStatusbar MessageAsPopup


Popup

GuiDispIDMsgHas- 34005 GuiStatusbar MessageHasLongText


LongText

GuiDispIDMsgId 34001 GuiStatusbar MessageId

GuiDispIDMsgNumber 34002 GuiStatusbar MessageNumber

GuiDispIDMsgPar 34003 GuiStatusbar MessageParameter

GuiDispIDMsgType 34000 GuiStatusbar MessageType

GuiDispIDOcxCall- 200889
backChange  Note
This raises the
SAP_CUS-
TOM_DATA_CHAN
GE event (can be
called from ocx for
recording pur-
poses)

GuiDispIDOcxControl 271062 Control

 Note
Sends control
dispinterface to
wrapper

SAP GUI Scripting API


308 PUBLIC SAP GUI Scripting API
Member Value Base Object Name

GuiDispIDOcxIsRea- 31191 Can be called to check


dOnlyCall if this OCX method/
property is readonly

GuiDispIDOKF1 32351 GuiOkCodeField PressF1

GuiDispIDOKOpened 32350 GuiOkCodeField Opened

GuiDispIDRBGroupColl 32504 GuiRadioButton GroupMembers

GuiDispIDRBGroup- 32502 GuiRadioButton GroupCount


Count

GuiDispIDRBGroupPos 32503 GuiRadioButton GrouPos

GuiDispIDRBSelect 32501 GuiRadioButton Select

GuiDispIDRBSelected 32500 GuiRadioButton Selected

GuiDispIDSBDblClick 32750 GuiStatusbar DoubleClick

GuiDispIDSBServi- 32751 GuiStatusbar ServiceRequestClick


ceReq

GuiDispIDSBSuppMes- 32752 GuiStatusbar CreateSupportMessa-


sage geClick

GuiDispIDScrollMax 33904 GuiScrollbar Maximum

GuiDispIDScrollMin 33905 GuiScrollbar Minimum

GuiDispIDScrollPage 33903 GuiScrollbar PageSize

GuiDispIDScrollPos 33902 GuiScrollbar Position

GuiDispIDScrollRange 33900 GuiScrollbar Range

GuiDispIDSesActivWin 32800 GuiSession ActiveWindow

GuiDispIDSesBusy 32803 GuiSession Busy

GuiDispIDSesClearEr- 32825 GuiSession ClearErrorList


rorList

GuiDispIDSesClose 32811 GuiConnection CloseSession

GuiDispIDSesCmd 32805 GuiSession SendCommand

GuiDispIDSesCmdA- 32806 GuiSession SendCommandAsync


sync

GuiDispIDSesCreate 32812 GuiSession CreateSession

GuiDispIDSesEna- 32830 GuiSession AccSymbolReplace-


bleAccSymbols ment

GuiDispIDSesEna- 32829 GuiSession AccEnhancedTabChain


bleAccTabChain

GuiDispIDSesEnable- 32828 GuiSession EnableJawsEvents


Jaws

GuiDispIDSesEndT 32810 GuiSession EndTransaction

GuiDispIDSesErrorList 32824 GuiSession ErrorList

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 309
Member Value Base Object Name

GuiDispIDSesFindBy- 32818 GuiSession FindByPosition


Pos

GuiDispIDSesGetOb- 32835 GuiSession GetObjectTree


jectTree

GuiDispIDSesIconDesc 33525 GuiSession GetIconResource-


Name

GuiDispIDSesInfo 32802 GuiSession Info

GuiDispIDSesIn- 33508 GuiSessionInfo ApplicationServer


foAppSr

GuiDispIDSesInfoCl 33509 GuiSessionInfo Client

GuiDispIDSesInfoCP 33512 GuiSessionInfo Codepage

GuiDispIDSesInfoDis- 33521 GuiSessionInfo ScriptingModeRecor-


Rec dingDisabled

GuiDispIDSesInfoDynp 33506 GuiSessionInfo ScreenNumber

GuiDispIDSesInfoFlush 33503 GuiSessionInfo Flushes

GuiDispIDSesInfoFor- 33522 GuiSessionInfo ScriptingModeForce-


ceNot Notification

GuiDispIDSesInfoGrpN 33515 GuiSessionInfo Group

GuiDispIDSesInfo- 33523 GuiSessionInfo GuiCodepage


GuiCP

GuiDispIDSesInfoI18N 33524 GuiSessionInfo I18NMode

GuiDispIDSesInfoI- 33501 GuiSessionInfo IntepretationTime


Time

GuiDispIDSesInfoLang 33511 GuiSessionInfo Language

GuiDispIDSesInfoMo- 33517 GuiSessionInfo SessionNumber


deNo

GuiDispIDSesIn- 33513 GuiSessionInfo MessageServer


foMsgSrv

GuiDispIDSesInfoProg 33505 GuiSessionInfo Program

GuiDispIDSesInfoRea- 33520 GuiSessionInfo ScriptingModeRea-


dOnly dOnly

GuiDispIDSesInfoR- 33504 GuiSessionInfo RoundTrips


ound

GuiDispIDSesInfoR- 33500 GuiSessionInfo ResponseTime


Time

GuiDispIDSesInfo- 33518 GuiSessionInfo SystemSessionId


SesCtx

GuiDispIDSesInfoSysN 33507 GuiSessionInfo SystemName

GuiDispIDSesInfo- 33516 GuiSessionInfo SystemNumber


SysNo

SAP GUI Scripting API


310 PUBLIC SAP GUI Scripting API
Member Value Base Object Name

GuiDispIDSesInfoTrans 33502 GuiSessionInfo Transaction

GuiDispIDSesInfoUI 33528 GuiSessionInfo UI_GUIDELINE

GuiDispIDSesInfoUser 33510 GuiSessionInfo User

GuiDispIDSesInfoWAN 33519 GuiSessionInfo IsLowSpeedConnec-


tion

GuiDispIDSesIsActive 32819 GuiSession IsActive

GuiDispIDSesLockSes- 32826 GuiSession LockSessionUI


sionUI

GuiDispIDSesPPPSyId 32821 GuiSession PassportPreSystemId

GuiDispIDSesPPSyId 32822 GuiSession PassportSystemId

GuiDispIDSesPPTaId 32820 GuiSession PassportTransactionId

GuiDispIDSesProg- 32832 GuiSession ProgressPercent


ressPercent

GuiDispIDSesProgres- 32833 GuiSession ProgressText


sText

GuiDispIDSesRecFile 32814 GuiSession RecordFile

GuiDispIDSesRecord 32804 GuiSession Record

GuiDispIDSesSaveA- 32823 GuiSession SaveAsUnicode


sUnicode

GuiDispIDSesShow- 33527 GuiSession ShowDropdownKeys


Keys

GuiDispIDSesStartT 32809 GuiSession StartTransaction

GuiDispIDSesStd- 33526 GuiSession AsStdNumberFormat


NumFmt

GuiDispIDSesSup- 32834 GuiSession SuppressBackendPop-


pressBackendPopups ups

GuiDispIDSesTestTool 32813 GuiSession TestToolMode

GuiDispIDSesUnlock- 32827 GuiSession UnlockSessionUI


SessionUI

GuiDispIDSesVKey 32808 GuiFrameWindow SendVKey

GuiDispIDSesVKey- 32817 GuiSession GetVKeyDescription


Desc

GuiDispIDSHSelCtxt- 34100 GuiShell SelectContextMenuI-


MenIt tem

GuiDispIDSHSelCtxt- 34102 GuiShell SelectContextMenuI-


MenItPos temByPosition

GuiDispIDSHSelCtxt- 34101 GuiShell SelectContextMenuI-


MenItTxt temByText

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 311
Member Value Base Object Name

GuiDispIDSplitterIs- 34400 GuiSplit / GuiSplitter- IsVertical


Vertical Container

GuiDispIDSplitterSash- 34401 GuiSplitterContainer SashPosition


Position

GuiDispIDTableCol- 33421 GuiTableControl Fixed


Fixed

GuiDispIDTableColSe- 33422 GuiTableControl Selected


lected

GuiDispIDTableColSe- 33401 GuiTableControl ColSelectMode


lectMode

GuiDispIDTableColTitle 33420 GuiTableControl Title

GuiDispIDTableCol- 33402 GuiTableControl Columns


umns

GuiDispIDTableConfi- 33406 GuiTableControl ConfigureLayout


gureLayout

GuiDispIDTableCur- 33410 GuiTableControl CurrentCol


rentCol

GuiDispIDTableCurren- 33411 GuiTableControl CurrentRow


tRow

GuiDispIDTableDese- 33414 GuiTableControl DeselectAllColumns


lAllCols

GuiDispIDTableField- 33409 GuiTableControl TableFieldName


Name

GuiDispIDTabLeftTab 33200 GuiTabStrip LeftTab

GuiDispIDTableGetCell 33415 GuiTableControl GetCell

GuiDispIDTableReor- 33405 GuiTableControl RecorderTable


derTable

GuiDispIDTableRow- 33412 GuiTableControl RowCount


Count

GuiDispIDTableRows 33404 GuiTableControl Rows

GuiDispIDTableRowSe- 33431 GuiTableRow Selectable


lectable

GuiDispIDTableRowSe- 33430 GuiTableRow Selected


lected

GuiDispIDTableRowSe- 33403 GuiTableControl RowSelectMode


lectMode

GuiDispIDTableSelAll- 33408 GuiTableControl SelectAllColumns


Cols

GuiDispIDTableVisRow- 33413 GuiTableControl VisibleRowCount


Count

GuiDispIDTabSelTab 33201 GuiTabStrip SelectedTab

SAP GUI Scripting API


312 PUBLIC SAP GUI Scripting API
Member Value Base Object Name

GuiDispIDTBSelect 32700 GuiTab Select

GuiDispIDTBToLeft 32701 GuiTab ScrollToLeft

GuiDispIDTHistoryCur- 32057 GuiTextField HistoryCurEntry


Entry

GuiDispIDTHistoryCur- 32056 GuiTextField HistoryCurIndex


Index

GuiDispIDTHistoryI- 32054 GuiTextField HistoryIsActive


sActive

GuiDispIDTHistoryList 32055 GuiTextField HistoryList

GuiDispIDTIsOField 32067 GuiTextField IsOField

GuiDispIDTRequired 32014 GuiTextField Required

GuiDispIDUtilCloseFile 34202 GuiUtils CloseFile

GuiDispIDUtilMsgBox 34200 GuiUtils ShowMessageBox

GuiDispIDUtilMsgOp- 34220 GuiUtils MESSAGE_OP-


tOK TION_OK

GuiDispIDUtilMsgOp- 34222 GuiUtils MESSAGE_TYPE_OK-


tOKCan CANCEL

GuiDispIDUtilMsgOp- 34221 GuiUtils MES-


tYesNo SAGE_TYPE_YESNO

GuiDispIDUtilMsgRes- 34230 GuiUtils MESSAGE_RE-


Cancel SULT_CANCEL

GuiDispIDUtilMs- 34233 GuiUtils MESSAGE_RE-


gResNo SULT_NO

GuiDispIDUtilMsgRe- 34231 GuiUtils MESSAGE_TYPE_OK


sOK

GuiDispIDUtilMsgRe- 34232 GuiUtils MESSAGE_TYPE_YES


sYes

GuiDispIDUtilMsgTy- 34208 GuiUtils MESSAGE_TYPE_ER-


peE ROR

GuiDispIDUtilMsgTypeI 34205 GuiUtils MESSAGE_TYPE_IN-


FORMATION

GuiDispIDUtilMsgTy- 34209 GuiUtils MES-


peP SAGE_TYPE_PLAIN

GuiDispIDUtilMsgTy- 34206 GuiUtils MES-


peQ SAGE_TYPE_QUES-
TION

GuiDispIDUtilMsgTy- 34207 GuiUtils MES-


peW SAGE_TYPE_WARN-
ING

GuiDispIDUtilOpenFile 34201 GuiUtils OpenFile

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 313
Member Value Base Object Name

GuiDispIDUtilWriteFile 34203 GuiUtils Write

GuiDispIDUtilWriteLn- 34204 GuiUtils WriteLine


File

1.4.6 GuiMessageBoxOption

Members

Member Value Description

MSG_OPTION_OK 0 Constant value to be used when call-


ing the showMessageBox method. Us-
ing this value will display an ‘OK’ button
only. (0)

MSG_OPTION_OKCANCEL 2 Constant value to be used when call-


ing the showMessageBox method. Us-
ing this value will display an ‘OK’ button
and a ‘Cancel’ button. (2)

MSG_OPTION_YESNO 1 Constant value to be used when call-


ing the showMessageBox method. Us-
ing this value will display a ‘Yes’ button
and a ‘No’ button. (1)

1.4.7 GuiMessageBoxResult

Members

Member Value Description

MSG_RESULT_CANCEL 0 Constant value to be used as a return


value by the showMessageBox method.
This value is returned when the ‘Cancel’
button has been pressed. (0)

MSG_RESULT_NO 3 Constant value to be used as a return


value by the showMessageBox method.
This value is returned when the ‘No’
button has been pressed. (3)

MSG_RESULT_OK 1 Constant value to be used as a return


value by the showMessageBox method.
This value is returned when the ‘OK’
button has been pressed. (1)

SAP GUI Scripting API


314 PUBLIC SAP GUI Scripting API
Member Value Description

MSG_RESULT_YES 2 Constant value to be used as a return


value by the showMessageBox method.
This value is returned when the ‘Yes’
button has been pressed. (2)

1.4.8 GuiMessageBoxType

Members

Member Value Description

MSG_TYPE_ERROR 3 Constant value to be used when call-


ing the showMessageBox method. Us-
ing this value will display a stop sign as
the message box icon. (3)

MSG_TYPE_INFORMATION 0 Constant value to be used when call-


ing the showMessageBox method. Us-
ing this value will display the letter ‘i’ as
the message box icon. (0)

MSG_TYPE_PLAIN 4 Constant value to be used when calling


the showMessageBox method. Using
this value will display no message box
icon. (4)

MSG_TYPE_QUESTION 1 Constant value to be used when calling


the showMessageBox method. Using
this value will display a question mark
as the message box icon. (1)

MSG_TYPE_WARNING 2 Constant value to be used when calling


the showMessageBox method. Using
this value will display an exclamation
mark as the message box icon. (2)

1.4.9 GuiScrollbarType

Members

Member Value

GuiScrollbarTypeHorizontal 2

GuiScrollbarTypeUnknown 0

GuiScrollbarTypeVertical 1

SAP GUI Scripting API


SAP GUI Scripting API PUBLIC 315
1.4.10 GuiTableSelectionType

Members

Member Value Description

MULTIPLE_INTERVAL_SELECTION 2 Several columns/rows can be selected.


(2)

NO_SELECTION 0 No selection possible. (0)

SINGLE_SELECTION 1 One column/row can be selected. (1)

SAP GUI Scripting API


316 PUBLIC SAP GUI Scripting API
2 SAP GUI Scripting ROT Entry Helper

Description

This is a helper library that contains just one object. It is used to allow COM clients to access a running SAP GUI
process.

Remarks

Some scripting languages do not allow accessing an entry in the Running Object Table. Even though they
may offer a 'GetObject' function, this function will then only support accessing files in the file system or
creating COM objects using the COM progid. In this case you need to start by creating another helper object,
CSapROTWrapper, which in turn allows you to access the ROT entry for SAP GUI.

2.1 SapGuiAuto Object

Description

This object is registered in the Windows Running Object Table whenever one of the SAP GUI processes
saplogon.exe, saplgpad.exe, sapguiserver.exe or sapgui.exe runs, assuming that SAP GUI Scripting
is installed on the client PC. Please, also note the limitation documented in SAP Note 587202 regarding the
usage of multiple instances of sapgui.exe and sapguiserver.exe.

 Note

For access, saplogon.exe, saplgpad.exe, and sapgui.exe will be registered as "SAPGUI" within the
Windows Running Object Table, whereas sapguiserver.exe is registered as SAPGUISERVER.

SAP GUI Scripting API


SAP GUI Scripting ROT Entry Helper PUBLIC 317
Methods

Syntax

Method Visual Basic

GetScriptingEngine
Public Function GetScriptingEngine()
This method returns the GuiApplication COM interface for As Object
the currently running SAP GUI process.
Return Type: GuiApplication
 Example
Visual Basic Script (Visual Basic)

Set SapGuiAuto =
GetObject( "SAPGUI")
Set application =
SapGuiAuto.GetScriptingEngine

WinBatch by Wilson WindowWare (Visual Basic)

SapGuiAuto = ObjectGet("SAPGUI");
Application =
SapGuiAuto.GetScriptingEngine;

SAP GUI Scripting API


318 PUBLIC SAP GUI Scripting ROT Entry Helper
3 SAP GUI Scripting ROT Access Helper

Description

This library contains just one object. It is required in cases where the scripting engine does not allow accessing
entries in the Running Object Table. This is for example the case for the following engines

• JAWS script, the scripting language of the JAWS Screenreader, by Freedom Scientific
• AutoIt, a freeware Windows automation language

For these languages you need to create a CSapROTWrapper object first, before you can access the ROT entry
and get the GuiApplication interface of the running SAP GUI process.

 Note

The SAP GUI Scripting ROT Access Helper library is implemented by the file saprotwr.dll.

When using a 32bit version of SAP GUI for Windows, the saprotwr.dll is naturally a 32bit file and when, using
a 64bit version of SAP GUI for Windows, it is a 64bit file.

Windows offers a mechanism called “DllSurrogate” which allows 64bit process to run 32bit COM objects.
This means that the saprotwr.dll from a 32bit version of SAP GUI for Windows can be used by 32bit
and 64bit processes. However, there is no such mechanism for 64bit COM objects to be loaded by
32bit processes. This means that the 64bit version of saprotwr.dll can only be used by 64bit processes.
Therefore, if you are using saprotwr.dll in a component / product, you need to make sure that the process
from which this is called can be a 64bit process if the 64bit version of SAP GUI for Windows is used. Else
the attempt to invoke saprotwr.dll will fail.

3.1 CSapROTWrapper Object

SAP GUI Scripting API


SAP GUI Scripting ROT Access Helper PUBLIC 319
Methods

Syntax

Method Visual Basic Parameter

GetROTEntry strDisplayName
Public Function
This method returns the ROT entry of SAP GUI. GetROTEntry( _
ByVal
strDisplayName As
 Example String _
) As Object
Accessing the GuiApplication interface for the run-
ning SAP GUI process from AutoIt

AutoIt (Visual Basic)

Dim $Wrapper = ObjCreate


( "SapROTWr.SapROTWrapper")
Dim $RotSAPGUI =
$Wrapper.GetROTEntry ( "SAPGUI")
Dim $Application =
$RotSAPGUI.GetScriptingEngine()

Accessing the GuiApplication interface for the run-


ning SAP GUI process from JAWS

JAWS Script (Visual Basic)

Object Wrapper,
Object RotSAPGUI,
Object SAPGUI
Let Wrapper = CreateObject
( "SapROTWr.SapROTWrapper")
Let RotSAPGUI =
Wrapper.GetROTEntry ( "SAPGUI")
Let SAPGUI =
RotSAPGUI.GetScriptingEngine

Accessing the GuiSession interface for the running


SAP GUI process from a Yahoo widget

Yahoo Widget (Visual Basic)

var Wrapper =
COM.createObject("SapROTWr.SapRO
TWrapper");
var SapGuiAuto =
Wrapper.GetROTEntry( "SAPGUI");

var GuiApplication =
SapGuiAuto.GetScriptingEngine();
var GuiConnection =
GuiApplication.OpenConnection(
"My System" );
var AllSessions =
GuiConnection.Children;
var GuiSession =
AllSessions.ElementAt(0);

SAP GUI Scripting API


320 PUBLIC SAP GUI Scripting ROT Access Helper
Syntax

Method Visual Basic Parameter

alert( "Session: " +


GuiSession.Id);

SAP GUI Scripting API


SAP GUI Scripting ROT Access Helper PUBLIC 321
Important Disclaimers and Legal Information

Hyperlinks
Some links are classified by an icon and/or a mouseover text. These links provide additional information.
About the icons:

• Links with the icon : You are entering a Web site that is not hosted by SAP. By using such links, you agree (unless expressly stated otherwise in your
agreements with SAP) to this:

• The content of the linked-to site is not SAP documentation. You may not infer any product claims against SAP based on this information.

• SAP does not agree or disagree with the content on the linked-to site, nor does SAP warrant the availability and correctness. SAP shall not be liable for any
damages caused by the use of such content unless damages have been caused by SAP's gross negligence or willful misconduct.

• Links with the icon : You are leaving the documentation for that particular SAP product or service and are entering an SAP-hosted Web site. By using
such links, you agree that (unless expressly stated otherwise in your agreements with SAP) you may not infer any product claims against SAP based on this
information.

Videos Hosted on External Platforms


Some videos may point to third-party video hosting platforms. SAP cannot guarantee the future availability of videos stored on these platforms. Furthermore, any
advertisements or other content hosted on these platforms (for example, suggested videos or by navigating to other videos hosted on the same site), are not within
the control or responsibility of SAP.

Beta and Other Experimental Features


Experimental features are not part of the officially delivered scope that SAP guarantees for future releases. This means that experimental features may be changed by
SAP at any time for any reason without notice. Experimental features are not for productive use. You may not demonstrate, test, examine, evaluate or otherwise use
the experimental features in a live operating environment or with data that has not been sufficiently backed up.
The purpose of experimental features is to get feedback early on, allowing customers and partners to influence the future product accordingly. By providing your
feedback (e.g. in the SAP Community), you accept that intellectual property rights of the contributions or derivative works shall remain the exclusive property of SAP.

Example Code
Any software coding and/or code snippets are examples. They are not for productive use. The example code is only intended to better explain and visualize the syntax
and phrasing rules. SAP does not warrant the correctness and completeness of the example code. SAP shall not be liable for errors or damages caused by the use of
example code unless damages have been caused by SAP's gross negligence or willful misconduct.

Bias-Free Language
SAP supports a culture of diversity and inclusion. Whenever possible, we use unbiased language in our documentation to refer to people of all cultures, ethnicities,
genders, and abilities.

SAP GUI Scripting API


322 PUBLIC Important Disclaimers and Legal Information
SAP GUI Scripting API
Important Disclaimers and Legal Information PUBLIC 323
www.sap.com/contactsap

© 2024 SAP SE or an SAP affiliate company. All rights reserved.

No part of this publication may be reproduced or transmitted in any form


or for any purpose without the express permission of SAP SE or an SAP
affiliate company. The information contained herein may be changed
without prior notice.

Some software products marketed by SAP SE and its distributors


contain proprietary software components of other software vendors.
National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for


informational purposes only, without representation or warranty of any
kind, and SAP or its affiliated companies shall not be liable for errors or
omissions with respect to the materials. The only warranties for SAP or
SAP affiliate company products and services are those that are set forth
in the express warranty statements accompanying such products and
services, if any. Nothing herein should be construed as constituting an
additional warranty.

SAP and other SAP products and services mentioned herein as well as
their respective logos are trademarks or registered trademarks of SAP
SE (or an SAP affiliate company) in Germany and other countries. All
other product and service names mentioned are the trademarks of their
respective companies.

Please see https://www.sap.com/about/legal/trademark.html for


additional trademark information and notices.

THE BEST RUN

You might also like