Sap Gui Scripting API
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.
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").
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 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
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
Classes
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.
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.
GuiCheckBox Object [page 67] GuiCheckBox extends GuiVComponent. The type prefix is
chk, the name is the fieldname taken from the SAP data
dictionary.
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.
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.
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].
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Syntax Description
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.
)
Syntax Description
DeleteBack Moves the cursor to the previous column, deleting the char-
acter currently residing there. Equivalent to pressing the
Public Sub DeleteBack()
backspace key.
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.
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.
Syntax Description
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
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
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.
Syntax Description
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.
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()
Syntax Description
IsAutoCompleteOpen Returns True if the auto completion list box is currently open.
Syntax Description
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
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.
MoveCursorLineEnd Positions the cursor in the last column of the current line.
MoveCursorLineHome Positions the cursor in the first column of the current line.
MoveCursorLineUp Moves the cursor up one line from its current position.
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()
ReplaceSelection Replaces the currently selected text with the text contained
in the Text parameter.
Public Sub ReplaceSelection( _
ByVal Text As String _
)
Syntax Description
SaveToFile
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.
SelectWordRight Selects the word to the right of the current cursor position.
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.
SetLineFeedStyle
Syntax Description
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.
SwapCase Inverts the case setting for the selected text. Upper case
characters are switched to lower case and vice versa.
Public Sub SwapCase()
Syntax Description
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.
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Syntax Description
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
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:
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
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
ClearSelection Calling clearSelection removes all row, column and cell se-
lections.
Public Sub ClearSelection()
Syntax Description
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 _
)
GetCellFormat
Syntax Description
GetFgdColorInfo This function returns the font color of the specified cell.
GetIconInfo
Syntax Description
SelectAll This function selects the whole grid content (i.e. all rows and
all columns).
Public Sub SelectAll()
SetCellValue This function enters the specified value in the specified cell.
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
Syntax Description
• 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.
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.
FixedColumnsRight (Read-only) The number of fixed columns at the right side of the grid.
FixedRowsBottom (Read-only) The number of fixed rows at the bottom of the grid.
FixedRowsTop (Read-only) The number of fixed rows at the top of the grid.
RowCount (Read-only) This property represents the number of rows in the control.
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
SelectedColumnsObject (Read-only)
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)
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].
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
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
Method
Syntax Description
• FindById
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.
Syntax Description
RevokeROT This method must be called before shutting down the Script-
ing component if registerROT was used.
Public Sub RevokeROT()
Property
Syntax Description
• 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
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
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.
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’.
NewVisualDesign (Read-only) Returns whether New Visual Design or Classic mode are
used for the user interface.
Public Property NewVisualDesign As
Byte
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
Event
Syntax Description
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
Syntax Description
Sub Engine_DestroySession(ByVal
Session)
Dim result
result = MsgBox("Session
destroyed",vbOKCancel)
If result = vbCancel then
Waiting = 0
End If
End Sub
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.
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>.
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.
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.
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
/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
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
• DumpState
• SetFocus
• Visualize
Syntax Description
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Syntax Description
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
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".
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
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
• DumpState
• SetFocus
• Visualize
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
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.
Description
The calendar control can be used to select single dates or periods of time. GuiCalendar extends the GuiShell
Object [page 207].
Example
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
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
2 Week Invocation on a
button for a spe-
cific week
Syntax Description
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
GetDay Returns the day of the date specified as parameter (in for-
mat “YYYYMMDD”).
Public Function GetDay( _
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
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
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Syntax Description
• 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”.
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
Syntax Description
startSelection (Read-only) The starting day of the selected date range (in format
“YYYYMMDD”).
Public Property startSelection As
String
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.
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Syntax Description
• 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.
1 x
2 y
4 x is time value
8 y is time value
16 z
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Syntax Description
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
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
• DumpState
• SetFocus
• Visualize
Syntax Description
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• 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
IsLeftLabel (Read-only) This property is True if the component has the 'assign left'
flag.
Public Property IsLeftLabel As Byte
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.
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].
Method
Syntax Description
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.
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.
Syntax Description
Description
GuiColorSelector displays a set of colors for selection. It extends the GuiShell Object [page 207].
Example
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Syntax Description
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
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
• 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()
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Tooltip
• Top
• Width
Syntax Description
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
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
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.
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Tooltip
• Top
• Width
• Children
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
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
Selected (Read-write) The key of the currently selected entry of the combo box.
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.
Description
Property
Syntax Description
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
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
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.
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.
Method
Syntax Description
Properties
Property
Syntax Description
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.
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:
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
• FindById
CloseConnection This method closes a connection along with all its sessions.
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Children (Read-only) This collection contains all direct children of the object.
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.
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.
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
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
Children (Read-only) This collection contains all direct children of the 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
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
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
• DumpState
• SetFocus
• Visualize
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
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
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.
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
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
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Syntax Description
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
Syntax Description
• Children
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
• DumpState
• SetFocus
• Visualize
• FindById
Syntax Description
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
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.
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
annotationTextRequest
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Syntax Description
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
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.
The GuiEAIViewer3D control is used to view 3-dimensional graphic images in the SAP system.
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
Syntax Description
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
Methods
Method
Syntax Description
Clone
Next
Reset
Skip
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.
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Syntax Description
• 0: BMP
• 1: JPG
• 2: PNG
• 3: GIF
• 4: TIFF
Syntax Description
Sample Code
The following example shows the hardcopy of an SAP
GUI main window ("wnd[0]").
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.
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
JumpForward Execute the Ctrl+Tab key on the window to jump forward one
block.
Public Sub JumpForward()
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
Syntax Description
TabForward Execute the Tab key on the window to jump forward one
element.
Public Sub TabForward()
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
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.
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.
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.
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
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Description
For the graphic adapter control only basic members from GuiShell are available. Recording and playback is not
possible.
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
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Syntax Description
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
Description
The grid view is similar to the dynpro table control, but significantly more powerful. GuiGridView extends the
GuiShell Object [page 207].
Example
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
ClearSelection Calling clearSelection removes all row, column and cell se-
lections.
Public Sub ClearSelection()
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.
Syntax Description
DeselectColumn This function removes the specified column from the collec-
tion of the selected columns.
Public Sub DeselectColumn( _
ByVal Column As String _
)
Syntax Description
Example
0 Value A
1 Value B
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
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
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
) As Long
) As String
Syntax Description
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
Syntax Description
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
GetColumnSortType Returns the sort type of the column. Possible values are:
Syntax Description
GetColumnTotalType Returns the total type of the column. Possible values are:
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
Public Function
GetToolbarButtonChecked( _
ByVal ButtonPos As Long _
) As Byte
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
Syntax Description
Public Function
GetToolbarButtonText( _
ByVal ButtonPos As Long _
) As String
Public Function
GetToolbarButtonTooltip( _
ByVal ButtonPos As Long _
) As String
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.
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
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
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
Example
0 Value A
1 Value B
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
Syntax Description
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
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 _
)
Syntax Description
PressF1 This emulates pressing the F1 key while the focus is on the
grid view.
Public Sub PressF1()
Syntax Description
PressToolbarContextButton This emulates opening the context menu of the grid view’s
toolbar.
Public Sub
PressToolbarContextButton( _
ByVal Id As String _
)
SelectAll This function selects the whole grid content (i.e. all rows and
all columns).
Public Sub SelectAll()
SelectionChanged This function notifies the server that the selection has
changed.
Public Sub SelectionChanged()
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 _
)
Syntax Description
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
Syntax Description
• Children
• 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.
Syntax Description
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.
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.
The GuiHTMLViewer is used to display an HTML document inside SAP GUI. GuiHTMLViewer extends the
GuiShell Object [page 207].
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Syntax Description
Sample Code
sapEvent("Frame1","","
sapevent:SUBMIT_FORM_AS_GET_METHOD?
FirstName=John&LastName=Smith");
Sample Code
sapEvent("Frame1",
"FirstName=John&LastName=Smith","
sapevent:SUBMIT_FORM_AS_POST_METHOD
");
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Syntax Description
• 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)
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
Syntax Description
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
FindButtonActivated (Read-only) This property is True when the current focus is on the Find
button.
Public Property FindButtonActivated
As Boolean
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.
LabelText (Read-only) The text of the label belonging to the input field.
PromptText (Read-only) The prompt text that is displayed in an empty input field, if
assigned by the application.
Public Property PromptText As String
Description
GuiLabel extends the GuiVComponent Object [page 281]. The type prefix is lbl, the name is the fieldname
taken from the SAP data dictionary.
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
Syntax Description
GetListProperty Remarks
• 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)
Syntax Description
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)
Syntax Description
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.
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• 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.
Syntax Description
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
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
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
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.
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.
Description
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• Close
• CompBitmap
• HardCopy
• HardCopyToMemory
• Iconify
• IsVKeyAllowed
• JumpBackward
• JumpForward
• Maximize
• Restore
• SendVKey
• ShowMessageBox
• TabBackward
• TabForward
Syntax Description
Table GUI_FKEY
Refer to Table GUI_FKEY [page 152]
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• 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.
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
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.
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
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
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
Description
For the map control only basic members from GuiShell are available. Recording and playback is not possible.
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
Syntax Description
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
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
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Property
Syntax Description
• 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
• Children
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.
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
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
• 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.
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• Text
• Tooltip
• Top
• Width
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.
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
Description
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Syntax Description
• Close
• CompBitmap
• HardCopy
• HardCopyToMemory
• Iconify
• IsVKeyAllowed
• JumpBackward
• JumpForward
• Maximize
• Restore
• SendVKey
• ShowMessageBox
• TabBackward
• TabForward
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• 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:
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
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
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Syntax Description
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
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 _
)
Syntax Description
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 _
)
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Syntax Description
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
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
Method Description
• DumpState
• SetFocus
• Visualize
PressF1 Emulate pressing the F1 key while the focus is on the GuiOk-
CodeField.
Public Sub PressF1()
Properties
Property
Syntax Description
• 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
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.
Description
• 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
• DumpState
• SetFocus
• Visualize
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
Syntax Description
• CaretPosition
• DisplayedText
• Highlighted
• IsHotspot
• sLeftLabel
• IsOField
• IsRightLabel
• LeftLabel
• MaxLength
• Numerical
• Required
• RightLabel
Description
The picture control displays a picture on an SAP GUI screen. GuiPicture extends the GuiShell Object [page
207].
Methods
Method Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• 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).
Syntax Description
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.
Description
GuiRadioButton extends the GuiVComponent Object [page 281]. The type prefix is rad, the name is the
fieldname taken from the SAP data dictionary.
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
GroupCount (Read-only) The number of radio buttons in the same group the current
object belongs to.
Public Property GroupCount As Long
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
Description
For the SAP chart control only basic members from GuiShell are available. Recording and playback is not
possible.
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Syntax Description
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
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.
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
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.
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
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Syntax Description
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
• FindById
Syntax Description
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.
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.
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.
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")
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
Syntax Description
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);
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
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• 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.
ErrorList (Read-write)
Syntax Description
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.
ListBoxCurrEntryTop (Read-only) The top position of the current entry of the listbox in pixels.
ListBoxCurrEntryWidth (Read-only) The width of the current entry of the listbox in pixels.
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.
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
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
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)
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.
Remarks
Currently only the following values are allowed for this prop-
erty:
• 0: Disable testToolMode
• 1: Enable testToolMode
Events
Event
Syntax Description
AbapScriptingEvent
Activated
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 _
)
Syntax Description
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.
Syntax Description
Method/Property
Type name Parameters
Method/Property
Type name Parameters
Method/Property
Type name Parameters
"SP" "TestToolMode" 0
Method/Property
Type name Parameters
"M" "Resize" 96
32
False
Syntax Description
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 _
)
Syntax Description
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 _
)
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.
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).
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.
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.
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.
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
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.
Remarks
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.
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
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.
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
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.
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
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
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 _
)
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
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
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.
Syntax Description
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
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Syntax Description
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• 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.
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
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.
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
Description
Method Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• 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
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
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• 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”.
Syntax Description
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
• DumpState
• SetFocus
• Visualize
• FindById
Syntax Description
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• 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.
Description
For the stage control only basic members from GuiShell are available. Recording and playback is not possible.
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Syntax Description
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
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
• DumpState
• SetFocus
• Visualize
• FindById
Syntax Description
• 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.
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• 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.
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).
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.
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
Sample Code
Sample Code
MessageType (Read-only) This property may have any of the following values:
S Success
W Warning
E Error
A Abort
I Information
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
• DumpState
• SetFocus
• Visualize
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
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.
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
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.
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• 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
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
Description
Method
Syntax Description
Properties
Property
Syntax Description
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
Syntax Description
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
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.
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.
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
DeselectAllColumns This function can be used for table controls with a button
that allows, to deselect all columns in one step.
Public Sub DeselectAllColumns()
Syntax Description
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
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
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.
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.
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.
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
Description
Methods
Method
Syntax Description
Property
Syntax Description
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.
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.
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
• DumpState
• SetFocus
• Visualize
• FindById
Syntax Description
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccText
• AccTextOnRequest
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
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].
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].
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
• DumpState
• SetFocus
• Visualize
• FindById
Syntax Description
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Syntax Description
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.
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
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• 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
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.
NumberOfUnprotectedTextParts (Read-only) The number of unprotected text parts, which are contained.
Public Property
NumberOfUnprotectedTextParts As Long
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.
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
Syntax Description
SelectionStartLine (Read-only) The number of the line in which the current selection starts.
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
• DumpState
• SetFocus
• Visualize
Syntax Description
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• 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.
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.
HistoryCurIndex (Read-only) Currently focused index in the history dropdown list box.
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
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
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
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
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
Syntax Description
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Properties
Property
Syntax Description
• 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
• Children
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.
Button/Element Index/Name
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.
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
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• Left
• Modified
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
1.2.68 GuiToolbarControl
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
GetButtonIcon Returns the name of the icon of the specified toolbar button.
Syntax Description
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.
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 _
)
Syntax Description
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
FocusedButton Zero-based index of the button that currently has the focus.
Example
• Simple Tree
• List Tree
• without header
• with header
• Column Tree
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
• SelectContextMenuItem
• SelectContextMenuItemByPosition
• SelectContextMenuItemByText
Syntax Description
CollapseNode This function closes the node with the key nodeKey.
DefaultContextMenu This method requests a context menu for the whole Tree
Control.
Public Sub DefaultContextMenu()
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.
FindNodeKeyByPath
Syntax Description
GetColumnTitleFromName Returns the column title of the column specified by the pa-
rameter.
Public Function
GetColumnTitleFromName( _
ByVal Key As String _
) As String
Syntax Description
GetHierarchyTitle
GetIsDisabled
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
Syntax Description
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
Syntax Description
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
GetNodeIndex Returns the index of the specified key within its node.
Syntax Description
GetNodesCol The collection contains the node keys of all the nodes in the
tree.
Public Function GetNodesCol() As
Object
GetNodeTextByKey This function returns the text of the node specified by the
given key.
Public Function GetNodeTextByKey( _
ByVal Path As String _
) As String
Syntax Description
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
• 0: Single Node
• 1: Multiple Node
• 2: Single Item
• 3: Multiple Item
Syntax Description
IsFolder Returns True if the specified object is a node and not a leaf.
Syntax Description
SelectNode The node with the key nodeKey is added to the Node Selec-
tion.
Public Sub SelectNode( _
ByVal NodeKey As String _
)
Syntax Description
UnselectNode The node with the key nodeKey is removed from the Node
Selection.
Public Sub UnselectNode( _
ByVal NodeKey As String _
)
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
• AccDescription
• DragDropSupported
• Handle
• OcxEvents
• SubType
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
Note
If you assign a new GuiCollection containing the column
names, you must not include fixed columns in this col-
lection.
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
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.
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.
Methods
Method
Syntax Description
• DumpState
• SetFocus
• Visualize
• FindById
• FindAllByName
• FindAllByNameEx
• FindByName
• FindByNameEx
Property
Syntax Description
• 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
• 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
VerticalScrollbar (Read-only) The user area is defined to be scrollable even if the scrollbars
are not always visible.
Public Property VerticalScrollbar As
GuiScrollbar
Methods
Method
Syntax Description
CloseFile This function closes a file that was opened using OpenFile.
OpenFile The file will be created in the SAP GUI Documents Folder.
Write Write text to an open file without a new line at the end.
Syntax Description
WriteLine Write text to an open file with a new line at the end.
Properties
Property
Syntax Description
Syntax Description
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].
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.
control.ItemCount = 42
control.GetItemValue(3, 2) =
'MyText'
control.GetItem('2','3').Property1.
MethodY('XYZ').Text = 'ABC'
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
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.
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
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
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
Syntax Description
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
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
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
• DumpState
• SetFocus
• Visualize
• FindById
Syntax Description
Properties
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
Syntax Description
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
• Children
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
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
• DumpState
• SetFocus
• Visualize
Property
Syntax Description
• ContainerType
• Id
• Name
• Parent
• Type
• TypeAsNumber
• AccLabelCollection
• AccText
• AccTextOnRequest
• AccTooltip
• Changeable
• DefaultTooltip
• Height
• IconName
• IsSymbolFont
• Left
• Modified
• ParentFrame
• ScreenLeft
• ScreenTop
• Text
• Tooltip
• Top
• Width
Event
Syntax Description
AbapScriptingEvent
Activated
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 _
)
Syntax Description
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
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
HistoryOpened
Syntax Description
ProgressIndicator
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:
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.
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.
"SP" TestToolMode 0
"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.
"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").
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
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
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_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
1.4.3 GuiEventType
Members
SapDefaultEvent 0 Default
1.4.4 GuiImageType
Members
Member Value
BMP 0
GIF 2
JPEG 1
PNG 2
1.4.5 GuiMagicDispIDs
Members
GuiDispIDOcxCall- 200889
backChange Note
This raises the
SAP_CUS-
TOM_DATA_CHAN
GE event (can be
called from ocx for
recording pur-
poses)
Note
Sends control
dispinterface to
wrapper
1.4.6 GuiMessageBoxOption
Members
1.4.7 GuiMessageBoxResult
Members
1.4.8 GuiMessageBoxType
Members
1.4.9 GuiScrollbarType
Members
Member Value
GuiScrollbarTypeHorizontal 2
GuiScrollbarTypeUnknown 0
GuiScrollbarTypeVertical 1
Members
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.
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.
Syntax
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
SapGuiAuto = ObjectGet("SAPGUI");
Application =
SapGuiAuto.GetScriptingEngine;
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.
Syntax
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
Object Wrapper,
Object RotSAPGUI,
Object SAPGUI
Let Wrapper = CreateObject
( "SapROTWr.SapROTWrapper")
Let RotSAPGUI =
Wrapper.GetROTEntry ( "SAPGUI")
Let SAPGUI =
RotSAPGUI.GetScriptingEngine
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);
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.
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 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.