You are on page 1of 1514

SAP GUI Scripting API 6.

40
2006 SAP AG

SAP GUI Scripting API 6.40


2006 SAP AG
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, and Informix are trademarks or registered trademarks of IBM Corporation. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of SAP AG. This document is a preliminary version and not subject to your license agreement or any other agreement with SAP. This document contains only intended strategies, developments, and functionalities of the SAP product and is not intended to be binding upon SAP to any particular course of business, product strategy, and/or development. Please note that this document is subject to change and may be changed by SAP at any time without notice. SAP assumes no responsibility for errors or omissions in this document. SAP does not warrant the accuracy or completeness of the information, text, graphics, links, or other items contained within this material. This document is provided without a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. This limitation shall not apply in cases of intent or gross negligence. The statutory liability for personal injury and defective products is not affected. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages.

Introduction

Introduction
SAP GUI Scripting API
Purpose
Ever since the release of SAP system version 4.6C, there has been only very limited support for emulating user interaction with a SAP system. Existing technologies, such as ITOLE or Guilib, connect to the SAP system at the protocol level and have never been able to emulate the behavior of the compound controls introduced with 4.6C. For this reason, applications relying on emulating user input worked only on the decreasing number of transactions using only standard dynpro elements. Examples of affected applications are: Automatic testing of SAP functionality Customized front end applications replacing the SAP GUI Tools to customize applications on the SAP GUI level -> GuiXT E-Learning applications that guide a user through SAP transactions

Integration
Many of the available SAP GUI controls were designed exclusively with user interaction in mind. As their business functionality is closely coupled with the user interface they cannot be instantiated outside the SAP GUI in a batch-like fashion. We therefore decided not to add the business functionality of the SAP GUI controls to a low-level integration component such as Guilib. 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. Available uses for the scripting component include Listening to the actions a user performs in the SAP GUI and record them as a script Running a script that emulates user interaction Logging the SAP system information, such as response time

Runtime hierarchy overview


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

GuiApplication represents the process in which the SAP system activity takes place. Because of this there should always be only one GuiApplication object within a process. The children of GuiApplication are all the connections of class GuiConnection to the SAP systems available for scripting. Connections are opened manually from the SAPLogon dialog or using the openConnection and openConnectionByConnectionString methods of GuiApplication from a script. As soon as a connection has been established a first session is created as a child of the connection. Up to 5 additional sessions can be created. Again, this can be done manually using the 'Create Session' menu item or toolbar button, or from a script using the CreateSession method of GuiSession. While GuiApplication represents the overall SAP GUI application, a GuiSession represents a specific task being performed. For any given session there is exactly one transaction currently executed, and most tasks performed in SAP GUI can be performed within the context of one GuiSession.

2006 SAP AG

SAP GUI Scripting API 6.40


These considerations determine the event model of the scripting component. A user's interactions are best recorded or logged in the context of one session, therefore the GuiSession exposes an outgoing interface that allows an application to listen to the user interaction. On the other hand, the GuiApplication exposes an outgoing interface that raises administrative events, for example when a session is created or destroyed.

Top level user interface objects


A session usually has a GuiMainWindow as its child. This window is the starting point for user interaction with a session.

The children of the GuiMainWindow are easily identified straightforward.

2006 SAP AG

Introduction

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

2006 SAP AG

SAP GUI Scripting API 6.40

Overview
Description

SAP GUI Scripting API 6.40


The latest version of this document is available at ftp://ftp.sap.com/pub/sapgui/win/640/scripting/ docs/

User Controls Control GuiApplication Description The GuiApplication represents the process in which all SAP GUI activity takes place. If the scripting component is accessed by attaching to a SAPlogon process, then GuiApplication will represent SAPlogon. GuiApplication is a creatable class. However, there must be only one component of this type in any process. GuiApplication extends GuiContainer.

Classes Class Module GuiBarChart Description The GuiBarChart is a powerful tool to display and modify time scale diagrams. The object is of a very technical nature. It should only be used for recording and playback, as most of the parameters can not be determined in any other way. GuiBarChart extends GuiShell.

2006 SAP AG

Overview
GuiBox

A GuiBox is a simple frame with a name. The items inside the frame are not children of the box. GuiBox extends GuiVComponent. The type prefix is box. The name property is the ABAP fieldname. GuiButton GuiButton represents all push buttons that are on dynpros, the toolbar or in table controls. GuiButton extends GuiVComponent. 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 The calendar control can be used to select single dates or periods of time. GuiCalendar extends GuiShell. GuiChart The GuiChart object is of a very technical nature. It should only be used for recording and playback, as most of the parameters can not be determined in any other way. GuiCheckBox GuiCheckBox extends GuiVComponent. The type prefix is chk, the name is the fieldname taken from the SAP data dictionary. GuiCollection GuiCollection is similar to GuiComponentCollection, but its members are not necessarily extensions of GuiComponent. It can be used to pass a collection as a parameter to functions of scriptable objects. An object of this class is created by calling the CreateGuiCollection function of the GuiApplication. GuiColorSelecto GuiColorSelector displays a set of colors for selection. It extends GuiShell. r GuiComboBox 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 GuiVComponent. The type prefix is cmb, the name is the fieldname taken from the SAP data dictionary. GuiComboBoxE Members of the Entries collection of a GuiComboBox are of type ntry GuiComBoxEntry GuiComponent 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.
GuiComponentC The GuiComponentCollection is used for collections elements such as the children ollection property of containers. Each element of the collection is an extension of GuiComponent. GuiConnection A GuiConnection represents the connection between SAP GUI and an application server. Connections can be opened from SAPlogon or from GuiApplications openConnection and openConnectionByConnectionString methods. GuiConnection extends GuiContainer. The type prefix for GuiConnection is con, the name is con plus the connection number in square brackets. GuiContainer 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 GuiComponent. GuiContainerSh A GuiContainerShell is a wrapper for a set of GuiShell objects. GuiContainerShell ell extends GuiVContainer. The type prefix is shellcont, the name is the last part of the id, shellcont[n]. GuiContextMen A GuiContextMenu may have other GuiContextMenu objects as children. u GuiContextMenu extends GuiMenu. The type is mnu, the name is the function code that is sent to the system when the menu item is selected. GuiCTextField 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.

2006 SAP AG

SAP GUI Scripting API 6.40


GuiCustomContr The GuiCustomControl is a wrapper object that is used to place ActiveX controls ol onto dynpro screens. While GuiCustomControl 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 The GuiDialogShell is an external window that is used as a container for other shells, for example a toolbar. GuiDialogShell extends GuiVContainer. The type prefix is shellcont, the name is the last part of the id, shellcont[n]. GuiEAIViewer2D The GuiEAIViewer2D control is used to view 2-dimensional graphic images in the SAP system. Presently Webviewer2D supports 22 available image types. The user can carry out redlining over the loaded image. The scripting wrapper for this control records all user actions during the redlining process and reproduces the same actions when the recorded script is replayed. GuiEAIViewer2D extends GuiShell. GuiEAIViewer3D GuiFrameWindo A GuiFrameWindow is a high level visual object in the runtime hierarchy. It can w 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 GuiVContainer. The type prefix is wnd, the name is wnd plus the window number in square brackets. GuiGOSShell 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 For the graphic adapter control only basic members from GuiShell are available. Recording and playback is not possible. GuiGridView The grid view is similar to the dynpro table control, but significantly more powerful. GuiGridView extends GuiShell. GuiHTMLViewer The GuiHTMLViewer is used to display an HTML document inside SAP GUI. GuiHTMLViewer extends GuiShell. GuiLabel GuiLabel extends GuiVComponent. The type prefix is lbl, the name is the fieldname taken from the SAP data dictionary.

2006 SAP AG

Overview
GuiMainWindow This window represents the main window of a SAP GUI session.

GuiMainWindow extends GuiFrameWindow. GuiMap GuiMenu For the map control only basic members from GuiShell are available. Recording and playback is not possible. 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]. Only the main window has a menubar. The children of the menubar are menus. GuiMenubar extends GuiVContainer. The type prefix and name are mbar.

GuiMenubar GuiMessageWin dow

2006 SAP AG

10

SAP GUI Scripting API 6.40


GuiModalWindo A GuiModalWindow is a dialog pop-up. w

GuiModalWindow extends GuiFrameWindow. GuiNetChart The GuiNetChart is a powerful tool to display and modify entity relationship diagrams. It is of a very technical nature and shoud only be used for recording and playback, as most of the parameters can not be determined in any other way.

GuiOfficeIntegra tion GuiOkCodeField 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 GuiVComponent. The type prefix is okcd, the name is empty. GuiPasswordFiel The only difference between GuiTextField and GuiPasswordField is that the Text d property can not 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 The picture control displays a picture on a SAP GUI screen. GuiPicture extends GuiShell. GuiRadioButton GuiRadioButton extends GuiVComponent. The type prefix is rad, the name is the fieldname taken from the SAP data dictionary. GuiSapChart For the SAP chart control only basic members from GuiShell are available. Recording and playback is not possible. GuiScrollbar The GuiScrollbar class is a utility class used for example in GuiScrollContainer or GuiTableControl. GuiScrollContai This container represents scrollable subscreens. A subscreen may be scrollable ner 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 extends GuiVContainer. The type prefix is ssub, the name is generated from the data dictionary settings. GuiSession 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 users actions regarding a specific task or play back those actions. GuiSession extends GuiContainer. The type prefix is ses, the name is ses plus the session number in square brackets. GuiSessionInfo GuiSessionInfo is a member of all GuiSession objects. It makes available technical information about the session. Some of its properties are displayed in the right corner of the SAP GUI status line. GuiShell GuiShell is an abstract object whose interface is supported by all the controls. GuiShell extends GuiVContainer. The type prefix is shell, the name is is the last part of the id, shell[n].

2006 SAP AG

Overview

11

GuiSimpleConta This container represents non-scrollable subscreens. It does not have any iner functionality apart from to the inherited interfaces. GuiSimpleContainer extends GuiVContainer. The type prefix is sub, the name is is generated from the data dictionary settings. GuiSplit GuiSplit extends GuiShell. GuiStage For the stage control only basic members from GuiShell are available. Recording and playback is not possible. GuiStatusbar GuiStatusbar represents the message displaying part of the statusbar on the bottom of the SAP GUI window. It does not include the system and login information displayed in the rightmost area of the statusbar as these are available from the GuiSessionInfo object. GuiStatusbar extends GuiVComponent. The type prefix is sbar. GuiStatusPane GuiTab 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 tabs button taken from SAP data dictionary. GuiTableColumn GuiTableColumn extends GuiComponentCollection. GuiTableControl 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 GuiTableRow extends GuiComponentCollection. GuiTabStrip 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 dictionary. GuiTextedit 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. GuiTextField GuiTextField extends GuiVComponent. The type prefix is txt, the name is the fieldname taken from the SAP data dictionary. GuiTitlebar The titlebar is only displayed and exposed as a separate object in New Visual Design mode. GuiTitlebar extends GuiVContainer. The type prefix and name of GuiTitlebar are titl. GuiToolbar Every GuiFrameWindow has a GuiToolbar. The GuiMainWindow has two toolbars unless the second has been turned off by the ABAP application. The upper toolbar is the system toolbar, while the second toolbar is the application toolbar. The children of a GuiToolbar are buttons. The indexes for toolbar buttons are determined by the virtual key values defined for the button. GuiToolbar extends GuiVContainer. The type prefix and name are tbar. GuiToolbarContr GuiToolbarControl extends GuiShell. ol GuiTree GuiUserArea The GuiUserArea comprises the area between the toolbar and statusbar for windows of GuiMainWindow type and the area between the titlebar and toolbar for modal windows, and may also be limited by docker controls. The standard dynpro elements can be found only in this area, with the exception of buttons, which are also found in the toolbars. GuiUserArea extends GuiVContainer. The type prefix and name are usr. GuiUtils GuiVComponent 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 GuiComponent. GuiVContainer 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 GuiContainer and GuiVComponent.

2006 SAP AG

12

SAP GUI Scripting API 6.40


Public Enumerations Enumeration GuiComponentType GuiErrorType GuiEventType GuiImageType GuiMessageBoxOption GuiMessageBoxResult GuiMessageBoxType GuiScrollbarType GuiTableSelectionType Remarks Description

SAP SAP SAP SAP

GUI GUI GUI GUI

Image types Message Box Options Message Box Results Message Box Types

SAP OSS Notes on SAP GUI Scripting


480149: Describes the ABAP and kernel patch level requirements 587202: Limitations of SAP GUI Scripting 548788: Creating trace files of SAP GUI Scripting problems to be send to SAP 527737: Composite SAP note on SAP GUI Scripting 612454: SAP GUI Scripting: Status and Lifetime 619459: SAP GUI Scripting support of SAP applications 692245 Additional server based security options for Scripting

SAP OSS Queue for SAP GUI Scripting


BC-FES-SCR

FAQ Integration with Excel

Getting Started
Requirements
SAP System
Scripting support is available for the 3.1I, 4.0B, 4.5B, 4.6B, 4.6C, 4.6D, 6.10, and 6.20 releases and all subsequent releases. For the releases 3.1I to 6.10 ABAP support packages and the SAP kernel patches are available to add the support, while they are already part of 6.20 and later releases. Note 480149 lists the required patch levels.

SAP GUI
The scripting interface can be installed with the SAP GUI release 6.20 and later releases.

2006 SAP AG

Objects

13

4
4.1

Objects
GuiApplication Control
See Also GuiApplication Members Description The GuiApplication represents the process in which all SAP GUI activity takes place. If the scripting component is accessed by attaching to a SAPlogon process, then GuiApplication will represent SAPlogon. GuiApplication is a creatable class. However, there must be only one component of this type in any process. GuiApplication extends GuiContainer. For a list of all members defined in this module, see GuiApplication members. Object Model

Remarks The type prefix and the value of the name property are 'app'. Example [Using GetObject (Visual Basic)] 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 Rem Set Set Get the first session of the first connection You may have to adjust this to access a different session connection = application.Children(0) session = connection.Children(0)

Rem Start a transaction session.findById("wnd[0]/tbar[0]/okcd").text = "/nbibs" session.findById("wnd[0]").sendVKey 0


See Also GuiApplication Members Example

Using CreateObject

2006 SAP AG

14

SAP GUI Scripting API 6.40

4.1.1

Overview
See Also GuiApplication Members Description The GuiApplication represents the process in which all SAP GUI activity takes place. If the scripting component is accessed by attaching to a SAPlogon process, then GuiApplication will represent SAPlogon. GuiApplication is a creatable class. However, there must be only one component of this type in any process. GuiApplication extends GuiContainer. For a list of all members defined in this module, see GuiApplication members. Object Model

Remarks The type prefix and the value of the name property are 'app'. Example [Using GetObject (Visual Basic)] 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 Rem Set Set Get the first session of the first connection You may have to adjust this to access a different session connection = application.Children(0) session = connection.Children(0)

Rem Start a transaction session.findById("wnd[0]/tbar[0]/okcd").text = "/nbibs" session.findById("wnd[0]").sendVKey 0


See Also GuiApplication Members Example

Using CreateObject

2006 SAP AG

Objects

15

4.1.2

Members
See Also GuiApplication Overview Public Methods AddHistoryEntry SAP GUI for Windows has an input history functionality, which displays for text fields the entries made in the past as a suggestion. With this function, an entry can be added to the history database so that it will be available the next time the end user accesses the text field with the given field name. Some functions accept collections as parameters. This function creates a collection object that is independent of the scripting language used, such as VBScript or JavaScript. Calling this function will delete all entries from the input history. The function returns True if the history data have been deleted successfully. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. eCATT uses this function to prevent scripts from accessing the session in which eCATT itself runs. Otherwise the the token handling would cause a dead lock. The parameter connectString should contain one of the descriptions displayed in SAPlogon, for example "XYZ [PUBLIC]". If you want to create a new SAP GUI instance and place it within your application you may add the suffix /INPLACE. This function will raise the exception E_ACCESSDENIED if the scripting support has been disabled by the administrator or the user. The parameter connectionData is the connection string for the SAP server, for example /R/ALR/G/SPACE. See the description of the OpenConnectionByConnectio openConnection method for a discussion of the sync and raise nString parameters. Accessing the SAPGUI entry in the Running Object Table from a C+ RegisterROT + application may fail unless the interface is registered with a strong reference. This is not required when using Visual Basic or scripting languages. The reference must be released using revokeRot before shutting down the Scripting component. Failing to do so will lead to undefined behaviour. Most applications do not need to use this method, and shouldnt call it. This method must be called before shutting down the Scripting RevokeROT component if registerROT was used. Public Properties ActiveSession AllowSystemMessages Returns the Session that the user is currently working with, which will be the topmost window. System messages are displayed when an administrator invokes them on the server to send a notification to users currently logged in. This may happen at any time and interfere with the recording or playback of a script. Setting this property to FALSE will prevent system messages from being displayed.

CreateGuiCollection

DropHistory

FindById

Ignore

OpenConnection

2006 SAP AG

16

SAP GUI Scripting API 6.40


Setting this property to FALSE hides the application toolbar of the main window. This collection contains all direct children of the object. This property contains the text of a connection error message. If openConnection fails you can retrieve information about the cause of the failure from this property. This property is another name for the Children property. It has been added for better readability as all the children of GuiApplication are connections. This property is TRUE, if the object is a container and therefore has the children property. The local history function can be enabled or disabled using this property. Disabling it will significantly improve the performance of SAP GUI, which may be crucial during load tests, for example. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Version of the SAP GUI release, for example 6.20. Build number of the scripting component. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Returns whether New Visual Design or Classic mode are used for the user interface. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Patchlevel of SAP GUI. Revision of the SAP GUI release. In SAP GUI for Windows this is the compilation number. Setting this property to FALSE hides the statusbar of the main window. Setting this property to FALSE hides the titlebar of the main window. Setting this property to FALSE hides the system toolbar of the main window. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. This property returns a global GuiUtils object.

ButtonbarVisible Children ConnectionErrorText

Connections

ContainerType HistoryEnabled

Id

MajorVersion MinorVersion Name

NewVisualDesign Parent Patchlevel Revision StatusbarVisible TitlebarVisible ToolbarVisible Type

TypeAsNumber

Utils Events CreateSession

DestroySession

This event is raised whenever a new session is created, irrespective of whether of the session being created manually, from ABAP or by a script. The event is only raised for a session if the scripting support has been enabled for the corresponding backend. This event is raised before a session is destroyed . This can be done either by closing the main window manually, or by calling the closeSession method of GuiConnection.

2006 SAP AG

Objects
Error

17

IgnoreSession

An error event is currently only raised, if the wrapper library required to access a SAP GUI ActiveX control from a script is not available. This event is also available on the GuiSession in which the error occurred. The event is fired when a session is set to Ignored using IgnoreSession function. This event is only fired when using SAP GUI Scripting while running eCATT in parallel.

See Also

GuiApplication Overview

4.1.3
4.1.3.1

Methods
AddHistoryEntry Method
See Also GuiApplication Control Fieldname Value Description SAP GUI for Windows has an input history functionality, which displays for text fields the entries made in the past as a suggestion. With this function, an entry can be added to the history database so that it will be available the next time the end user accesses the text field with the given field name. Syntax

Public Function AddHistoryEntry( _ ByVal Fieldname As String, _ ByVal Value As String _ ) As Boolean
Parameters Fieldname Value Remarks For a given text field, the field name can be determined by positioning the cursor on the field and pressing F1. A new window is then opened for the Performance Assistant, which has a Technical Information button. Using this will display the dialog below. The field name is displayed at the bottom of the dialog as Screen field. The functions returns True if the entry was added successfully.

2006 SAP AG

18

SAP GUI Scripting API 6.40

See Also

GuiApplication Control

4.1.3.2

CreateGuiCollection Method
See Also GuiApplication Control Description Some functions accept collections as parameters. This function creates a collection object that is independent of the scripting language used, such as VBScript or JavaScript. Syntax

Public Function CreateGuiCollection() As Object


See Also

GuiApplication Control

2006 SAP AG

Objects 4.1.3.3 DropHistory Method


See Also GuiApplication Control Description

19

Calling this function will delete all entries from the input history. The function returns True if the history data have been deleted successfully. Syntax

Public Function DropHistory() As Boolean


See Also

GuiApplication Control

4.1.3.4

FindById Method
See Also GuiApplication Control Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiApplication Control

2006 SAP AG

20 4.1.3.5

SAP GUI Scripting API 6.40 Ignore Method


See Also GuiApplication Control WindowHandle Description eCATT uses this function to prevent scripts from accessing the session in which eCATT itself runs. Otherwise the the token handling would cause a dead lock. Syntax

Public Sub Ignore( _ ByVal WindowHandle As Integer _ )


Parameters WindowHandle See Also

GuiApplication Control

4.1.3.6

OpenConnection Method
See Also GuiApplication Control Description Sync Raise Description The parameter connectString should contain one of the descriptions displayed in SAPlogon, for example "XYZ [PUBLIC]". If you want to create a new SAP GUI instance and place it within your application you may add the suffix /INPLACE. This function will raise the exception E_ACCESSDENIED if the scripting support has been disabled by the administrator or the user. Syntax

Public Function OpenConnection( _ ByVal Description As String, _ Optional ByVal Sync As Variant, _ Optional ByVal Raise As Variant _ ) As GuiConnection
Parameters Description

2006 SAP AG

Objects
Sync Raise Remarks

21

When opening connections manually SAP GUI executes the request asynchronously, so that the SAPLogon dialog remains responsive after requesting a new connection. This behaviour is also the default for SAP GUI Scripting. In the Scripting context it means that the call to openConnection may return before the new connection has been opened. A side effect of this is that when opening a connection fails SAP GUI displays an error popup that can not be handled from the script. This problem can be solved by setting the sync parameter to True. Then the call to openConnection will not return until a connection has been established, or an error has been detected. If sync is set to True and an error occurs an exception is raised, unless the parameter raise is set to False. Example In the following example the scripting component has been placed on an HTML page and the connection was opened in the pageLoad event handler using the /INPLACE switch.

See Also

GuiApplication Control

2006 SAP AG

22 4.1.3.7

SAP GUI Scripting API 6.40 OpenConnectionByConnectionString Method


See Also GuiApplication Control ConnectString Sync Raise Description The parameter connectionData is the connection string for the SAP server, for example /R/ALR/G/ SPACE. See the description of the openConnection method for a discussion of the sync and raise parameters. Syntax

Public Function OpenConnectionByConnectionString( _ ByVal ConnectString As String, _ Optional ByVal Sync As Variant, _ Optional ByVal Raise As Variant _ ) As GuiConnection
Parameters ConnectString Sync Raise Remarks 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. Simple Connection Strings In its simplest form, a connection string contains an IP address and a port number. This information is sufficient for SAP GUI to open a direct TCP connection to a destination, e.g. an application server. IP address and port number are marked with the prefixes '/H/' (for host) and '/S/' (for service). Note that the port number for an SAP application server is by convention 3200 plus the two-digit SAP system number. Example 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 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

2006 SAP AG

Objects

23

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

2006 SAP AG

24

SAP GUI Scripting API 6.40

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. Symbolic System Names The most user-friendly form of connection string addresses an SAP system only by its symbolic name (per convention, the system id) and the logon group name. These information are marked with the prefixes '/R/' (for the symbolic SAP system name) and '/G/' (for the logon group name). Example with SAP system (ALR) and logon group (SPACE): /R/ALR/G/SPACE Connection strings with symbolic system names are resolved by SAP GUI by looking up the symbolic SAP system name in the Message Server List (a text file containing a mapping between symbolic system names and message server addresses) and replacing the /R/ part of the connection string with the resulting message server address. The result is a complete message server connection string which is then further resolved as explained above. Formal syntax For the technically interested reader, the following BNF grammar formally describes the syntax of connection strings: <connection string> := [<router prefix>]<local> <local> := <simple>|<message server>|<symbolic> <simple> := "/H/"<host>"/S/"<service> <host> := <hostname>|<ipaddr> <hostname> := (any DNS hostname) <ipaddr> := (any IP address, in dotted decimal form) <service> := <servicename>|<port number> <servicename> := (any IP service name) <port number> := (any decimal number) <messageserver> := "/M/"<host>"/S/"<service>"/G/"<group> <group> := (any ASCII string not containing '/') <symbolic> := "/R/"<system>"/G/"<group> <system> := (any ASCII string not containing '/') <router prefix> := <router>* <router> := "/H/"<host>"/S/"<service>["/P/"<password>] <password> := (any ASCII string not containing '/') See Also

GuiApplication Control

4.1.3.8

RegisterROT Method
See Also GuiApplication Control Description Accessing the SAPGUI entry in the Running Object Table from a C++ application may fail unless the interface is registered with a strong reference. This is not required when using Visual Basic or scripting languages. The reference must be released using revokeRot before shutting down the Scripting component. Failing to do so will lead to undefined behaviour. Most applications do not need to use this method, and shouldnt call it. Syntax

2006 SAP AG

Objects Public Function RegisterROT() As Boolean


See Also

25

GuiApplication Control

4.1.3.9

RevokeROT Method
See Also GuiApplication Control Description This method must be called before shutting down the Scripting component if registerROT was used. Syntax

Public Sub RevokeROT()


See Also

GuiApplication Control

4.1.4
4.1.4.1

Properties
ActiveSession Property
See Also GuiApplication Control Description Returns the Session that the user is currently working with, which will be the topmost window. Property type Read-only property Syntax (Visual Basic)

Public Property ActiveSession() As Object


See Also

GuiApplication Control

4.1.4.2

AllowSystemMessages Property
See Also GuiApplication Control Description

2006 SAP AG

26

SAP GUI Scripting API 6.40


System messages are displayed when an administrator invokes them on the server to send a notification to users currently logged in. This may happen at any time and interfere with the recording or playback of a script. Setting this property to FALSE will prevent system messages from being displayed. Property type Read-write property Syntax (Visual Basic)

Public Property AllowSystemMessages() As Boolean


See Also

GuiApplication Control

4.1.4.3

ButtonbarVisible Property
See Also GuiApplication Control Description Setting this property to FALSE hides the application toolbar of the main window. Property type Read-write property Syntax (Visual Basic)

Public Property ButtonbarVisible() As Boolean


Remarks Hiding the application toolbar may be useful if SAP GUI is displayed inplace, for example in a web page. The property should not be used when displaying SAP GUI as a standalone application. See Also

GuiApplication Control

4.1.4.4

Children Property
See Also GuiApplication Control Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection

2006 SAP AG

Objects
See Also

27

GuiApplication Control

4.1.4.5

ConnectionErrorText Property
See Also GuiApplication Control Description This property contains the text of a connection error message. If openConnection fails you can retrieve information about the cause of the failure from this property. Property type Read-only property Syntax (Visual Basic)

Public Property ConnectionErrorText() As String


See Also

GuiApplication Control

4.1.4.6

Connections Property
See Also GuiApplication Control Description This property is another name for the Children property. It has been added for better readability as all the children of GuiApplication are connections. Property type Read-only property Syntax (Visual Basic)

Public Property Connections() As GuiComponentCollection


See Also

GuiApplication Control

4.1.4.7

ContainerType Property
See Also GuiApplication Control Description

2006 SAP AG

28

SAP GUI Scripting API 6.40


This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiApplication Control

4.1.4.8

HistoryEnabled Property
See Also GuiApplication Control Description The local history function can be enabled or disabled using this property. Disabling it will significantly improve the performance of SAP GUI, which may be crucial during load tests, for example. Property type Read-write property Syntax (Visual Basic)

Public Property HistoryEnabled() As Boolean


See Also

GuiApplication Control

4.1.4.9

Id Property
See Also GuiApplication Control Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it

2006 SAP AG

Objects

29

begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiApplication Control

4.1.4.10 MajorVersion Property


See Also GuiApplication Control Description Version of the SAP GUI release, for example 6.20. Property type Read-only property Syntax (Visual Basic)

Public Property MajorVersion() As Long


See Also

GuiApplication Control

4.1.4.11 MinorVersion Property


See Also GuiApplication Control Description Build number of the scripting component. Property type Read-only property Syntax (Visual Basic)

Public Property MinorVersion() As Long

2006 SAP AG

30

SAP GUI Scripting API 6.40


See Also

GuiApplication Control

4.1.4.12 Name Property


See Also GuiApplication Control Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiApplication Control

4.1.4.13 NewVisualDesign Property


See Also GuiApplication Control Description Returns whether New Visual Design or Classic mode are used for the user interface. Property type Read-only property Syntax (Visual Basic)

Public Property NewVisualDesign() As Boolean


Example False: Classic mode

2006 SAP AG

Objects

31

True: New Visual Design

See Also

GuiApplication Control

2006 SAP AG

32

SAP GUI Scripting API 6.40

4.1.4.14 Parent Property


See Also GuiApplication Control Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiApplication Control

4.1.4.15 Patchlevel Property


See Also GuiApplication Control Description Patchlevel of SAP GUI. Property type Read-only property Syntax (Visual Basic)

Public Property Patchlevel() As Long


See Also

GuiApplication Control

4.1.4.16 Revision Property


See Also GuiApplication Control Description Revision of the SAP GUI release. In SAP GUI for Windows this is the compilation number. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Revision() As Long


See Also

33

GuiApplication Control

4.1.4.17 StatusbarVisible Property


See Also GuiApplication Control Description Setting this property to FALSE hides the statusbar of the main window. Property type Read-write property Syntax (Visual Basic)

Public Property StatusbarVisible() As Boolean


Remarks Hiding the statusbar may be useful if SAP GUI is displayed inplace, for example in a web page. The property should not be used when displaying SAP GUI as a standalone application. See Also

GuiApplication Control

4.1.4.18 TitlebarVisible Property


See Also GuiApplication Control Description Setting this property to FALSE hides the titlebar of the main window. Property type Read-write property Syntax (Visual Basic)

Public Property TitlebarVisible() As Boolean


Remarks The titlebar is only available when SAP GUI is displayed in New Visual Design. Hiding the titlebar may be useful if SAP GUI is displayed inplace, for example in a web page. The property should not be used when displaying SAP GUI as a standalone application. See Also

2006 SAP AG

34

SAP GUI Scripting API 6.40


GuiApplication Control

4.1.4.19 ToolbarVisible Property


See Also GuiApplication Control Description Setting this property to FALSE hides the system toolbar of the main window. Property type Read-write property Syntax (Visual Basic)

Public Property ToolbarVisible() As Boolean


Return Type Hiding the system toolbar may be useful if SAP GUI is displayed inplace, for example in a web page. The property should not be used when displaying SAP GUI as a standalone application. See Also

GuiApplication Control

4.1.4.20 Type Property


See Also GuiApplication Control Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiApplication Control

4.1.4.21 TypeAsNumber Property


See Also GuiApplication Control Description While the type property is a string value, the typeAsNumber property is a long value that can

2006 SAP AG

Objects

35

alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiApplication Control

4.1.4.22 Utils Property


See Also GuiApplication Control Description This property returns a global GuiUtils object. Property type Read-only property Syntax (Visual Basic)

Public Property Utils() As GuiUtils


See Also

GuiApplication Control

4.1.5
4.1.5.1

Events
CreateSession Event
See Also GuiApplication Control Session Description This event is raised whenever a new session is created, irrespective of whether of the session being created manually, from ABAP or by a script. The event is only raised for a session if the scripting support has been enabled for the corresponding backend. Syntax

Public Event CreateSession( _ ByVal Session As GuiSession _ )


Parameters

2006 SAP AG

36

SAP GUI Scripting API 6.40


Session 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 See Also

GuiApplication Control

4.1.5.2

DestroySession Event
See Also GuiApplication Control Session Description This event is raised before a session is destroyed . This can be done either by closing the main window manually, or by calling the closeSession method of GuiConnection. Syntax

Public Event DestroySession( _ ByVal Session As GuiSession _ )


Parameters Session Example You can handle this event from VBScript by adding the following procedure to the sample script on previous page: Sub Engine_DestroySession(ByVal Session) Dim result result = MsgBox("Session destroyed",vbOKCancel)

2006 SAP AG

Objects
If result = vbCancel then Waiting = 0 End If End Sub See Also

37

GuiApplication Control

4.1.5.3

Error Event
See Also GuiApplication Control ErrorId Desc1 Desc2 Desc3 Desc4 Description An error event is currently only raised, if the wrapper library required to access a SAP GUI ActiveX control from a script is not available. This event is also available on the GuiSession in which the error occurred. Syntax

Public Event Error( _ ByVal ErrorId As Long, _ ByVal Desc1 As String, _ ByVal Desc2 As String, _ ByVal Desc3 As String, _ ByVal Desc4 As String _ )
Parameters ErrorId Desc1 Desc2 Desc3 Desc4 See Also

GuiApplication Control

2006 SAP AG

38 4.1.5.4

SAP GUI Scripting API 6.40 IgnoreSession Event


See Also GuiApplication Control SessionMainWindowHandle Description The event is fired when a session is set to Ignored using IgnoreSession function. This event is only fired when using SAP GUI Scripting while running eCATT in parallel. Syntax

Public Event IgnoreSession( _ ByVal SessionMainWindowHandle As Integer _ )


Parameters SessionMainWindowHandle See Also

GuiApplication Control

4.2

GuiBarChart Object
See Also GuiBarChart Members Description The GuiBarChart is a powerful tool to display and modify time scale diagrams. The object is of a very technical nature. It should only be used for recording and playback, as most of the parameters can not be determined in any other way. GuiBarChart extends GuiShell. For a list of all members defined in this module, see GuiBarChart members. Object Model

2006 SAP AG

Objects

39

Example

See Also

2006 SAP AG

40

SAP GUI Scripting API 6.40


GuiBarChart Members

4.2.1

Overview
See Also GuiBarChart Members Description The GuiBarChart is a powerful tool to display and modify time scale diagrams. The object is of a very technical nature. It should only be used for recording and playback, as most of the parameters can not be determined in any other way. GuiBarChart extends GuiShell. For a list of all members defined in this module, see GuiBarChart members. Object Model

Example

2006 SAP AG

Objects

41

See Also

GuiBarChart Members

4.2.2

Members
See Also GuiBarChart Overview Public Methods BarCount DumpState Returns the number of bars in the given chart. This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used.

FindAllByName

FindAllByNameEx

2006 SAP AG

42

SAP GUI Scripting API 6.40


Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Returns the content of the bar. Returns the content of the grid line. Returns the number of grids within the chart. Returns the number of links within the given chart. Select an item from the controls context menu.

FindById

FindByName

FindByNameEx

GetBarContent GetGridLineContent GridCount LinkCount SelectContextMenuItem

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item SelectContextMenuItemByPo text. sition Select a menu item of a context menu using the text of the item and possible higher level menus. SelectContextMenuItemByTe xt Send data to the server. SendData This function can be used to set the focus onto an object. If a user SetFocus interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. ShowContextMenu Calling this method of a component will display a red frame around Visualize the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Public Properties AccDescription AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable ChartCount Accessibility description of the shell. This description can be used for shells that do not have a title element. The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. Number of charts.

2006 SAP AG

Objects
This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. This property is only set when a context menu is available at the shell object. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. This property is True if the shell allows drag and drop operations. The window handle of the control that is connected to the GuiShell. Height of the component in pixels.

43

Children ContainerType CurrentContextMenu DefaultTooltip DragDropSupported Handle Height IconName Id

IsSymbolFont Left Modified Name

If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value sapbarc. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration.

OcxEvents Parent ParentFrame ScreenLeft ScreenTop SubType

Text

Tooltip Top Type

TypeAsNumber

2006 SAP AG

44

SAP GUI Scripting API 6.40


Width of the component in pixels.

Width See Also

GuiBarChart Overview

4.2.3
4.2.3.1

Methods
BarCount Method
See Also GuiBarChart Object chartId Index of the chart Description Returns the number of bars in the given chart. Syntax

Public Function BarCount( _ ByVal chartId As Long _ ) As Long


Parameters chartId Index of the chart See Also

GuiBarChart Object

4.2.3.2

DumpState Method
See Also GuiBarChart Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _

2006 SAP AG

Objects ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

45

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

2006 SAP AG

46

SAP GUI Scripting API 6.40 Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiBarChart Object

4.2.3.3

FindAllByName Method
See Also GuiBarChart Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiBarChart Object

2006 SAP AG

Objects 4.2.3.4 FindAllByNameEx Method


See Also GuiBarChart Object Name Type Description

47

The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiBarChart Object

4.2.3.5

FindById Method
See Also GuiBarChart Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise

2006 SAP AG

48

SAP GUI Scripting API 6.40


Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiBarChart Object

4.2.3.6

FindByName Method
See Also GuiBarChart Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiBarChart Object

4.2.3.7

FindByNameEx Method
See Also GuiBarChart Object Name Type

2006 SAP AG

Objects
Description

49

This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiBarChart Object

4.2.3.8

GetBarContent Method
See Also GuiBarChart Object chartId Index of the chart barId

Index of the bar within the given chart.


textId Internal value, do be determined during recording. Description Returns the content of the bar. Syntax

Public Function GetBarContent( _ ByVal chartId As Long, _ ByVal barId As Long, _ ByVal textId As Long _ ) As String
Parameters chartId Index of the chart barId

Index of the bar within the given chart.


textId Internal value, do be determined during recording. See Also

2006 SAP AG

50

SAP GUI Scripting API 6.40

GuiBarChart Object

4.2.3.9

GetGridLineContent Method
See Also GuiBarChart Object chartId Index of the chart gridlineId Index of the grid line within the given chart. textId Internal value, do be determined during recording. Description Returns the content of the grid line. Syntax

Public Function GetGridLineContent( _ ByVal chartId As Long, _ ByVal gridlineId As Long, _ ByVal textId As Long _ ) As String
Parameters chartId Index of the chart gridlineId Index of the grid line within the given chart. textId Internal value, do be determined during recording. See Also

GuiBarChart Object

4.2.3.10 GridCount Method


See Also GuiBarChart Object chartId Index of the chart Description Returns the number of grids within the chart. Syntax

Public Function GridCount( _ ByVal chartId As Long _

2006 SAP AG

Objects ) As Long
Parameters chartId Index of the chart See Also

51

GuiBarChart Object

4.2.3.11 LinkCount Method


See Also GuiBarChart Object chartId Index of the chart Description Returns the number of links within the given chart. Syntax

Public Function LinkCount( _ ByVal chartId As Long _ ) As Long


Parameters chartId Index of the chart See Also

GuiBarChart Object

4.2.3.12 SelectContextMenuItem Method


See Also GuiBarChart Object FunctionCode Description Select an item from the controls context menu. Syntax

Public Sub SelectContextMenuItem( _ ByVal FunctionCode As String _ )


Parameters

2006 SAP AG

52

SAP GUI Scripting API 6.40


FunctionCode See Also

GuiBarChart Object

4.2.3.13 SelectContextMenuItemByPosition Method


See Also GuiBarChart Object PositionDesc Description This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item text. Syntax

Public Sub SelectContextMenuItemByPosition( _ ByVal PositionDesc As String _ )


Parameters PositionDesc Remarks The parameter is a string containing the path to the item. If the context menu item is on the top level menu, this is just the zero-base index of the item. Otherwise, the positions on the menu and respective submenus should be concatenated, separated by "|". See Also

GuiBarChart Object

4.2.3.14 SelectContextMenuItemByText Method


See Also GuiBarChart Object Text Description Select a menu item of a context menu using the text of the item and possible higher level menus. Syntax

Public Sub SelectContextMenuItemByText( _ ByVal Text As String _ )


Parameters Text

2006 SAP AG

Objects
See Also

53

GuiBarChart Object

4.2.3.15 SendData Method


See Also GuiBarChart Object Data Internal data stream. To be determined during recording. Description Send data to the server. Syntax

Public Sub SendData( _ ByVal Data As String _ )


Parameters Data Internal data stream. To be determined during recording. See Also

GuiBarChart Object

4.2.3.16 SetFocus Method


See Also GuiBarChart Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiBarChart Object

2006 SAP AG

54

SAP GUI Scripting API 6.40

4.2.3.17 ShowContextMenu Method


See Also GuiBarChart Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiBarChart Object

4.2.3.18 Visualize Method


See Also GuiBarChart Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiBarChart Object

2006 SAP AG

Objects

55

4.2.4
4.2.4.1

Properties
AccDescription Property
See Also GuiBarChart Object Description Accessibility description of the shell. This description can be used for shells that do not have a title element. Property type Read-only property Syntax (Visual Basic)

Public Property AccDescription() As String


See Also

GuiBarChart Object

4.2.4.2

AccLabelCollection Property
See Also GuiBarChart Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiBarChart Object

4.2.4.3

AccText Property
See Also GuiBarChart Object Description An additional text for accessibility support. Property type Read-only property

2006 SAP AG

56

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiBarChart Object

4.2.4.4

AccTextOnRequest Property
See Also GuiBarChart Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiBarChart Object

4.2.4.5

AccTooltip Property
See Also GuiBarChart Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiBarChart Object

2006 SAP AG

Objects 4.2.4.6 Changeable Property


See Also GuiBarChart Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

57

Public Property Changeable() As Boolean


See Also

GuiBarChart Object

4.2.4.7

ChartCount Property
See Also GuiBarChart Object Description Number of charts. Property type Read-only property Syntax (Visual Basic)

Public Property ChartCount() As Long


See Also

GuiBarChart Object

4.2.4.8

Children Property
See Also GuiBarChart Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection

2006 SAP AG

58

SAP GUI Scripting API 6.40


See Also

GuiBarChart Object

4.2.4.9

ContainerType Property
See Also GuiBarChart Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiBarChart Object

4.2.4.10 CurrentContextMenu Property


See Also GuiBarChart Object Description This property is only set when a context menu is available at the shell object. Property type Read-only property Syntax (Visual Basic)

Public Property CurrentContextMenu() As GuiContextMenu


See Also

GuiBarChart Object

4.2.4.11 DefaultTooltip Property


See Also GuiBarChart Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

59

Public Property DefaultTooltip() As String


See Also

GuiBarChart Object

4.2.4.12 DragDropSupported Property


See Also GuiBarChart Object Description This property is True if the shell allows drag and drop operations. Property type Read-only property Syntax (Visual Basic)

Public Property DragDropSupported() As Boolean


See Also

GuiBarChart Object

4.2.4.13 Handle Property


See Also GuiBarChart Object Description The window handle of the control that is connected to the GuiShell. Property type Read-only property Syntax (Visual Basic)

Public Property Handle() As Long


See Also

GuiBarChart Object

2006 SAP AG

60

SAP GUI Scripting API 6.40

4.2.4.14 Height Property


See Also GuiBarChart Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiBarChart Object

4.2.4.15 IconName Property


See Also GuiBarChart Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiBarChart Object

4.2.4.16 Id Property
See Also GuiBarChart Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Id() As String


Remarks

61

Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiBarChart Object

4.2.4.17 IsSymbolFont Property


See Also GuiBarChart Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiBarChart Object

4.2.4.18 Left Property


See Also GuiBarChart Object Description Left position of the element in screen coordinates

2006 SAP AG

62

SAP GUI Scripting API 6.40


Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiBarChart Object

4.2.4.19 Modified Property


See Also GuiBarChart Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiBarChart Object

4.2.4.20 Name Property


See Also GuiBarChart Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

2006 SAP AG

Objects
GuiBarChart Object

63

4.2.4.21 OcxEvents Property


See Also GuiBarChart Object Description Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. Property type Read-only property Syntax (Visual Basic)

Public Property OcxEvents() As GuiCollection


See Also

GuiBarChart Object

4.2.4.22 Parent Property


See Also GuiBarChart Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiBarChart Object

4.2.4.23 ParentFrame Property


See Also GuiBarChart Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property

2006 SAP AG

64

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiBarChart Object

4.2.4.24 ScreenLeft Property


See Also GuiBarChart Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiBarChart Object

4.2.4.25 ScreenTop Property


See Also GuiBarChart Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiBarChart Object

2006 SAP AG

Objects 4.2.4.26 SubType Property


See Also GuiBarChart Object Description Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value sapbarc. Property type Read-only property Syntax (Visual Basic)

65

Public Property SubType() As String


See Also

GuiBarChart Object

4.2.4.27 Text Property


See Also GuiBarChart Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiBarChart Object

4.2.4.28 Tooltip Property


See Also GuiBarChart Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property

2006 SAP AG

66

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiBarChart Object

4.2.4.29 Top Property


See Also GuiBarChart Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiBarChart Object

4.2.4.30 Type Property


See Also GuiBarChart Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiBarChart Object

2006 SAP AG

Objects 4.2.4.31 TypeAsNumber Property


See Also GuiBarChart Object Description

67

While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiBarChart Object

4.2.4.32 Width Property


See Also GuiBarChart Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiBarChart Object

4.3

GuiBox Object
See Also GuiBox Members Description A GuiBox is a simple frame with a name. The items inside the frame are not children of the box. GuiBox extends GuiVComponent. The type prefix is box. The name property is the ABAP fieldname. For a list of all members defined in this module, see GuiBox members. Object Model

2006 SAP AG

68

SAP GUI Scripting API 6.40

See Also

GuiBox Members

4.3.1

Overview
See Also GuiBox Members Description A GuiBox is a simple frame with a name. The items inside the frame are not children of the box. GuiBox extends GuiVComponent. The type prefix is box. The name property is the ABAP fieldname. For a list of all members defined in this module, see GuiBox members. Object Model

See Also

GuiBox Members

4.3.2

Members
See Also GuiBox Overview Public Methods

2006 SAP AG

Objects

69

DumpState

SetFocus

ShowContextMenu Visualize

This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable CharHeight CharLeft CharTop CharWidth ContainerType DefaultTooltip Height IconName Id The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. Height of the dynpro element in character metric. Left coordinate of the dynpro element in character metric. Top coordinate of the dynpro element in character metric. Width of the dynpro element in character metric. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system.

IsSymbolFont Left Modified

2006 SAP AG

70

SAP GUI Scripting API 6.40


The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

Name

Parent ParentFrame ScreenLeft ScreenTop Text

Tooltip Top Type

TypeAsNumber

Width See Also

GuiBox Overview

4.3.3
4.3.3.1

Methods
DumpState Method
See Also GuiBox Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

2006 SAP AG

Objects Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

71

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

2006 SAP AG

72

SAP GUI Scripting API 6.40

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiBox Object

4.3.3.2

SetFocus Method
See Also GuiBox Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiBox Object

4.3.3.3

ShowContextMenu Method
See Also GuiBox Object Description

2006 SAP AG

Objects
Shows the context menu of the control. Syntax

73

Public Sub ShowContextMenu()


See Also

GuiBox Object

4.3.3.4

Visualize Method
See Also GuiBox Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiBox Object

4.3.4
4.3.4.1

Properties
AccLabelCollection Property
See Also GuiBox Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property

2006 SAP AG

74

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiBox Object

4.3.4.2

AccText Property
See Also GuiBox Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiBox Object

4.3.4.3

AccTextOnRequest Property
See Also GuiBox Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiBox Object

2006 SAP AG

Objects 4.3.4.4 AccTooltip Property


See Also GuiBox Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

75

Public Property AccTooltip() As String


See Also

GuiBox Object

4.3.4.5

Changeable Property
See Also GuiBox Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiBox Object

4.3.4.6

CharHeight Property
See Also GuiBox Object Description Height of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharHeight() As Long

2006 SAP AG

76

SAP GUI Scripting API 6.40


See Also

GuiBox Object

4.3.4.7

CharLeft Property
See Also GuiBox Object Description Left coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharLeft() As Long


See Also

GuiBox Object

4.3.4.8

CharTop Property
See Also GuiBox Object Description Top coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharTop() As Long


See Also

GuiBox Object

4.3.4.9

CharWidth Property
See Also GuiBox Object Description Width of the dynpro element in character metric.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

77

Public Property CharWidth() As Long


See Also

GuiBox Object

4.3.4.10 ContainerType Property


See Also GuiBox Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiBox Object

4.3.4.11 DefaultTooltip Property


See Also GuiBox Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiBox Object

2006 SAP AG

78

SAP GUI Scripting API 6.40

4.3.4.12 Height Property


See Also GuiBox Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiBox Object

4.3.4.13 IconName Property


See Also GuiBox Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiBox Object

4.3.4.14 Id Property
See Also GuiBox Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Id() As String


Remarks

79

Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiBox Object

4.3.4.15 IsSymbolFont Property


See Also GuiBox Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiBox Object

4.3.4.16 Left Property


See Also GuiBox Object Description Left position of the element in screen coordinates

2006 SAP AG

80

SAP GUI Scripting API 6.40


Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiBox Object

4.3.4.17 Modified Property


See Also GuiBox Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiBox Object

4.3.4.18 Name Property


See Also GuiBox Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

2006 SAP AG

Objects
GuiBox Object

81

4.3.4.19 Parent Property


See Also GuiBox Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiBox Object

4.3.4.20 ParentFrame Property


See Also GuiBox Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiBox Object

4.3.4.21 ScreenLeft Property


See Also GuiBox Object Description The y position of the component in screen coordinates. Property type Read-only property

2006 SAP AG

82

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiBox Object

4.3.4.22 ScreenTop Property


See Also GuiBox Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiBox Object

4.3.4.23 Text Property


See Also GuiBox Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiBox Object

2006 SAP AG

Objects 4.3.4.24 Tooltip Property


See Also GuiBox Object Description

83

The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiBox Object

4.3.4.25 Top Property


See Also GuiBox Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiBox Object

4.3.4.26 Type Property


See Also GuiBox Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

84

SAP GUI Scripting API 6.40 Public Property Type() As String


See Also

GuiBox Object

4.3.4.27 TypeAsNumber Property


See Also GuiBox Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiBox Object

4.3.4.28 Width Property


See Also GuiBox Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiBox Object

2006 SAP AG

Objects

85

4.4

GuiButton Object
See Also GuiButton Members Description GuiButton represents all push buttons that are on dynpros, the toolbar or in table controls. GuiButton extends GuiVComponent. 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. For a list of all members defined in this module, see GuiButton members. Object Model

See Also

GuiButton Members

4.4.1

Overview
See Also GuiButton Members Description GuiButton represents all push buttons that are on dynpros, the toolbar or in table controls. GuiButton extends GuiVComponent. 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. For a list of all members defined in this module, see GuiButton members. Object Model

2006 SAP AG

86

SAP GUI Scripting API 6.40

See Also

GuiButton Members

4.4.2

Members
See Also GuiButton Overview Public Methods DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. This emulates manually pressing a button. Pressing a button will always cause server communication to occur, rendering all references to elements below the window level invalid. The following code will therefore fail: Set TextField = session.findById(".../txtF1") session.findById(".../btnPB5").press TextField.text = "Hello" SetFocus This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control.

Press

ShowContextMenu

2006 SAP AG

Objects

87

Visualize

Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable CharHeight CharLeft CharTop CharWidth ContainerType DefaultTooltip Height IconName Id The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. Height of the dynpro element in character metric. Left coordinate of the dynpro element in character metric. Top coordinate of the dynpro element in character metric. Width of the dynpro element in character metric. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates Left label of the component. The label is assigned in the screenpainter, using the flag 'assign left'. An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Right label of the component. This property is set in screenpainter using the 'assign right' flag. The y position of the component in screen coordinates. The x position of the component in screen coordinates.

IsSymbolFont Left LeftLabel Modified Name

Parent ParentFrame RightLabel ScreenLeft ScreenTop

2006 SAP AG

88

SAP GUI Scripting API 6.40


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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

Text

Tooltip Top Type

TypeAsNumber

Width See Also

GuiButton Overview

4.4.3
4.4.3.1

Methods
DumpState Method
See Also GuiButton Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property

2006 SAP AG

Objects that is to be dumped. -

89

The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

2006 SAP AG

90

SAP GUI Scripting API 6.40

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiButton Object

4.4.3.2

Press Method
See Also GuiButton Object Description This emulates manually pressing a button. Pressing a button will always cause server communication to occur, rendering all references to elements below the window level invalid. The following code will therefore fail: Set TextField = session.findById(".../txtF1") session.findById(".../btnPB5").press TextField.text = "Hello" Syntax

Public Sub Press()


See Also

GuiButton Object

4.4.3.3

SetFocus Method
See Also GuiButton Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry.

2006 SAP AG

Objects
See Also

91

GuiButton Object

4.4.3.4

ShowContextMenu Method
See Also GuiButton Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiButton Object

4.4.3.5

Visualize Method
See Also GuiButton Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiButton Object

2006 SAP AG

92

SAP GUI Scripting API 6.40

4.4.4
4.4.4.1

Properties
AccLabelCollection Property
See Also GuiButton Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiButton Object

4.4.4.2

AccText Property
See Also GuiButton Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiButton Object

4.4.4.3

AccTextOnRequest Property
See Also GuiButton Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property AccTextOnRequest() As String


See Also

93

GuiButton Object

4.4.4.4

AccTooltip Property
See Also GuiButton Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiButton Object

4.4.4.5

Changeable Property
See Also GuiButton Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiButton Object

2006 SAP AG

94 4.4.4.6

SAP GUI Scripting API 6.40 CharHeight Property


See Also GuiButton Object Description Height of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharHeight() As Long


See Also

GuiButton Object

4.4.4.7

CharLeft Property
See Also GuiButton Object Description Left coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharLeft() As Long


See Also

GuiButton Object

4.4.4.8

CharTop Property
See Also GuiButton Object Description Top coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharTop() As Long

2006 SAP AG

Objects
See Also

95

GuiButton Object

4.4.4.9

CharWidth Property
See Also GuiButton Object Description Width of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharWidth() As Long


See Also

GuiButton Object

4.4.4.10 ContainerType Property


See Also GuiButton Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiButton Object

4.4.4.11 DefaultTooltip Property


See Also GuiButton Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type.

2006 SAP AG

96

SAP GUI Scripting API 6.40


Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiButton Object

4.4.4.12 Height Property


See Also GuiButton Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiButton Object

4.4.4.13 IconName Property


See Also GuiButton Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiButton Object

2006 SAP AG

Objects 4.4.4.14 Id Property


See Also GuiButton Object Description

97

An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiButton Object

4.4.4.15 IsSymbolFont Property


See Also GuiButton Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean

2006 SAP AG

98

SAP GUI Scripting API 6.40


See Also

GuiButton Object

4.4.4.16 Left Property


See Also GuiButton Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiButton Object

4.4.4.17 LeftLabel Property


See Also GuiButton Object Description Left label of the component. The label is assigned in the screenpainter, using the flag 'assign left'. Property type Read-only property Syntax (Visual Basic)

Public Property LeftLabel() As GuiVComponent


See Also

GuiButton Object

4.4.4.18 Modified Property


See Also GuiButton Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

99

Public Property Modified() As Boolean


See Also

GuiButton Object

4.4.4.19 Name Property


See Also GuiButton Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiButton Object

4.4.4.20 Parent Property


See Also GuiButton Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiButton Object

2006 SAP AG

100

SAP GUI Scripting API 6.40

4.4.4.21 ParentFrame Property


See Also GuiButton Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiButton Object

4.4.4.22 RightLabel Property


See Also GuiButton Object Description Right label of the component. This property is set in screenpainter using the 'assign right' flag. Property type Read-only property Syntax (Visual Basic)

Public Property RightLabel() As GuiVComponent


See Also

GuiButton Object

4.4.4.23 ScreenLeft Property


See Also GuiButton Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long

2006 SAP AG

Objects
See Also

101

GuiButton Object

4.4.4.24 ScreenTop Property


See Also GuiButton Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiButton Object

4.4.4.25 Text Property


See Also GuiButton Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiButton Object

2006 SAP AG

102

SAP GUI Scripting API 6.40

4.4.4.26 Tooltip Property


See Also GuiButton Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiButton Object

4.4.4.27 Top Property


See Also GuiButton Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiButton Object

4.4.4.28 Type Property


See Also GuiButton Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Type() As String


See Also

103

GuiButton Object

4.4.4.29 TypeAsNumber Property


See Also GuiButton Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiButton Object

4.4.4.30 Width Property


See Also GuiButton Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiButton Object

2006 SAP AG

104

SAP GUI Scripting API 6.40

4.5

GuiCalendar Object
See Also GuiCalendar Members Description The calendar control can be used to select single dates or periods of time. GuiCalendar extends GuiShell. For a list of all members defined in this module, see GuiCalendar members. Object Model

Example

2006 SAP AG

Objects
See Also

105

GuiCalendar Members

4.5.1

Overview
See Also GuiCalendar Members Description The calendar control can be used to select single dates or periods of time. GuiCalendar extends GuiShell. For a list of all members defined in this module, see GuiCalendar members. Object Model

Example

2006 SAP AG

106

SAP GUI Scripting API 6.40

See Also

GuiCalendar Members

4.5.2

Members
See Also GuiCalendar Overview Public Methods ContextMenu CreateDate DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Calling this function opens a context menu.

FindAllByName

FindAllByNameEx

FindById

2006 SAP AG

Objects

107

FindByName

FindByNameEx

Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber.

GetColor GetColorInfo GetDateTooltip GetDay GetMonth GetWeekday GetWeekNumber GetYear IsWeekend SelectContextMenuItem Select an item from the controls context menu.

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item SelectContextMenuItemByPo text. sition Select a menu item of a context menu using the text of the item and possible higher level menus. SelectContextMenuItemByTe xt SelectMonth SelectRange SelectWeek SetFocus This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

ShowContextMenu Visualize

Public Properties AccDescription AccLabelCollection AccText Accessibility description of the shell. This description can be used for shells that do not have a title element. The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support.

2006 SAP AG

108

SAP GUI Scripting API 6.40


An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. This property is only set when a context menu is available at the shell object. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. This property is True if the shell allows drag and drop operations.

AccTextOnRequest AccTooltip Changeable Children ContainerType CurrentContextMenu DefaultTooltip DragDropSupported endSelection FirstVisibleDate FocusDate

Handle Height horizontal IconName Id

This is the earliest date visible in the calendar control. In the example above the value would be 20020228. The currently focussed date (identified by the focus border; see picture above) in the calendar control is available in the format YYYYMMDD. In this example it is 20020320 The window handle of the control that is connected to the GuiShell. Height of the component in pixels.

IsSymbolFont LastVisibleDate Left Modified Name

If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font.

Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. The interval is represented by two concatenated date strings separated by a comma.

OcxEvents Parent ParentFrame ScreenLeft ScreenTop SelectionInterval startSelection SubType

Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value Calendar.

2006 SAP AG

Objects

109

Text

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 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 cant change it, whereas you can only set the text property of a password field, but not read it.

Today Tooltip Top Type The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

TypeAsNumber

Width See Also

GuiCalendar Overview

4.5.3
4.5.3.1

Methods
ContextMenu Method
See Also GuiCalendar Object CtxMenuId Indicates the cell type of the cell in which the context menu was opened: Value Cell Type Description Invocation on a cell with a single 0 Date date Weekday Invocation on a button 1 Weekday for a certain day of the week. Invocation on a button for a 2 Week specific week. CtxMenuCellRow CtxMenuCellCol DateBegin DateEnd Description Calling this function opens a context menu. Syntax

Public Sub ContextMenu( _

2006 SAP AG

110

SAP GUI Scripting API 6.40 ByVal CtxMenuId As Long, _ ByVal CtxMenuCellRow As Long, _

ByVal CtxMenuCellCol As Long, _ ByVal DateBegin As String, _ ByVal DateEnd As String _ )


Parameters CtxMenuId Indicates the cell type of the cell in which the context menu was opened: Value Cell Type Description Invocation on a cell with a single 0 Date date Weekday Invocation on a button 1 Weekday for a certain day of the week. Invocation on a button for a 2 Week specific week. CtxMenuCellRow CtxMenuCellCol DateBegin DateEnd See Also

GuiCalendar Object

4.5.3.2

CreateDate Method
See Also GuiCalendar Object day month year Syntax

Public Function CreateDate( _ ByVal day As Long, _ ByVal month As Long, _ ByVal year As Long _ ) As String
Parameters

2006 SAP AG

Objects
day month year See Also

111

GuiCalendar Object

4.5.3.3

DumpState Method
See Also GuiCalendar Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

2006 SAP AG

112

SAP GUI Scripting API 6.40

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiCalendar Object

2006 SAP AG

Objects 4.5.3.4 FindAllByName Method


See Also GuiCalendar Object Name Type Description

113

The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiCalendar Object

4.5.3.5

FindAllByNameEx Method
See Also GuiCalendar Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type

2006 SAP AG

114

SAP GUI Scripting API 6.40


See Also

GuiCalendar Object

4.5.3.6

FindById Method
See Also GuiCalendar Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiCalendar Object

4.5.3.7

FindByName Method
See Also GuiCalendar Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not

2006 SAP AG

Objects

115

have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiCalendar Object

4.5.3.8

FindByNameEx Method
See Also GuiCalendar Object Name Type Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiCalendar Object

2006 SAP AG

116 4.5.3.9

SAP GUI Scripting API 6.40 GetColor Method


See Also GuiCalendar Object from Syntax

Public Function GetColor( _ ByVal from As String _ ) As Long


Parameters from See Also

GuiCalendar Object

4.5.3.10 GetColorInfo Method


See Also GuiCalendar Object Color Syntax

Public Function GetColorInfo( _ ByVal Color As Long _ ) As String


Parameters Color See Also

GuiCalendar Object

4.5.3.11 GetDateTooltip Method


See Also GuiCalendar Object date Syntax

Public Function GetDateTooltip( _

2006 SAP AG

Objects ByVal date As String _ ) As String


Parameters date See Also

117

GuiCalendar Object

4.5.3.12 GetDay Method


See Also GuiCalendar Object date Syntax

Public Function GetDay( _ ByVal date As String _ ) As Long


Parameters date See Also

GuiCalendar Object

4.5.3.13 GetMonth Method


See Also GuiCalendar Object date Syntax

Public Function GetMonth( _ ByVal date As String _ ) As Long


Parameters date See Also

GuiCalendar Object

2006 SAP AG

118

SAP GUI Scripting API 6.40

4.5.3.14 GetWeekday Method


See Also GuiCalendar Object date Syntax

Public Function GetWeekday( _ ByVal date As String _ ) As String


Parameters date See Also

GuiCalendar Object

4.5.3.15 GetWeekNumber Method


See Also GuiCalendar Object date Syntax

Public Function GetWeekNumber( _ ByVal date As String _ ) As Long


Parameters date See Also

GuiCalendar Object

4.5.3.16 GetYear Method


See Also GuiCalendar Object date Syntax

Public Function GetYear( _

2006 SAP AG

Objects ByVal date As String _ ) As Long


Parameters date See Also

119

GuiCalendar Object

4.5.3.17 IsWeekend Method


See Also GuiCalendar Object date Syntax

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


Parameters date See Also

GuiCalendar Object

4.5.3.18 SelectContextMenuItem Method


See Also GuiCalendar Object FunctionCode Description Select an item from the controls context menu. Syntax

Public Sub SelectContextMenuItem( _ ByVal FunctionCode As String _ )


Parameters FunctionCode See Also

2006 SAP AG

120

SAP GUI Scripting API 6.40

GuiCalendar Object

4.5.3.19 SelectContextMenuItemByPosition Method


See Also GuiCalendar Object PositionDesc Description This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item text. Syntax

Public Sub SelectContextMenuItemByPosition( _ ByVal PositionDesc As String _ )


Parameters PositionDesc Remarks The parameter is a string containing the path to the item. If the context menu item is on the top level menu, this is just the zero-base index of the item. Otherwise, the positions on the menu and respective submenus should be concatenated, separated by "|". See Also

GuiCalendar Object

4.5.3.20 SelectContextMenuItemByText Method


See Also GuiCalendar Object Text Description Select a menu item of a context menu using the text of the item and possible higher level menus. Syntax

Public Sub SelectContextMenuItemByText( _ ByVal Text As String _ )


Parameters Text See Also

2006 SAP AG

Objects
GuiCalendar Object

121

4.5.3.21 SelectMonth Method


See Also GuiCalendar Object month year Syntax

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


Parameters month year See Also

GuiCalendar Object

4.5.3.22 SelectRange Method


See Also GuiCalendar Object from to Syntax

Public Sub SelectRange( _ ByVal from As String, _ ByVal to As String _ )


Parameters from to See Also

GuiCalendar Object

2006 SAP AG

122

SAP GUI Scripting API 6.40

4.5.3.23 SelectWeek Method


See Also GuiCalendar Object week year Syntax

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


Parameters week year See Also

GuiCalendar Object

4.5.3.24 SetFocus Method


See Also GuiCalendar Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiCalendar Object

2006 SAP AG

Objects 4.5.3.25 ShowContextMenu Method


See Also GuiCalendar Object Description Shows the context menu of the control. Syntax

123

Public Sub ShowContextMenu()


See Also

GuiCalendar Object

4.5.3.26 Visualize Method


See Also GuiCalendar Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiCalendar Object

2006 SAP AG

124

SAP GUI Scripting API 6.40

4.5.4
4.5.4.1

Properties
AccDescription Property
See Also GuiCalendar Object Description Accessibility description of the shell. This description can be used for shells that do not have a title element. Property type Read-only property Syntax (Visual Basic)

Public Property AccDescription() As String


See Also

GuiCalendar Object

4.5.4.2

AccLabelCollection Property
See Also GuiCalendar Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiCalendar Object

4.5.4.3

AccText Property
See Also GuiCalendar Object Description An additional text for accessibility support. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

125

Public Property AccText() As String


See Also

GuiCalendar Object

4.5.4.4

AccTextOnRequest Property
See Also GuiCalendar Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiCalendar Object

4.5.4.5

AccTooltip Property
See Also GuiCalendar Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiCalendar Object

2006 SAP AG

126 4.5.4.6

SAP GUI Scripting API 6.40 Changeable Property


See Also GuiCalendar Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiCalendar Object

4.5.4.7

Children Property
See Also GuiCalendar Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiCalendar Object

4.5.4.8

ContainerType Property
See Also GuiCalendar Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean

2006 SAP AG

Objects
See Also

127

GuiCalendar Object

4.5.4.9

CurrentContextMenu Property
See Also GuiCalendar Object Description This property is only set when a context menu is available at the shell object. Property type Read-only property Syntax (Visual Basic)

Public Property CurrentContextMenu() As GuiContextMenu


See Also

GuiCalendar Object

4.5.4.10 DefaultTooltip Property


See Also GuiCalendar Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiCalendar Object

4.5.4.11 DragDropSupported Property


See Also GuiCalendar Object Description This property is True if the shell allows drag and drop operations.

2006 SAP AG

128

SAP GUI Scripting API 6.40


Property type Read-only property Syntax (Visual Basic)

Public Property DragDropSupported() As Boolean


See Also

GuiCalendar Object

4.5.4.12 endSelection Property


See Also GuiCalendar Object Property type Read-only property Syntax (Visual Basic)

Public Property endSelection() As String


See Also

GuiCalendar Object

4.5.4.13 FirstVisibleDate Property


See Also GuiCalendar Object Description This is the earliest date visible in the calendar control. In the example above the value would be 20020228. Property type Read-write property Syntax (Visual Basic)

Public Property FirstVisibleDate() As String


See Also

GuiCalendar Object

2006 SAP AG

Objects 4.5.4.14 FocusDate Property


See Also GuiCalendar Object Description

129

The currently focussed date (identified by the focus border; see picture above) in the calendar control is available in the format YYYYMMDD. In this example it is 20020320 Property type Read-write property Syntax (Visual Basic)

Public Property FocusDate() As String


See Also

GuiCalendar Object

4.5.4.15 Handle Property


See Also GuiCalendar Object Description The window handle of the control that is connected to the GuiShell. Property type Read-only property Syntax (Visual Basic)

Public Property Handle() As Long


See Also

GuiCalendar Object

4.5.4.16 Height Property


See Also GuiCalendar Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

130

SAP GUI Scripting API 6.40 Public Property Height() As Long


See Also

GuiCalendar Object

4.5.4.17 horizontal Property


See Also GuiCalendar Object Property type Read-only property Syntax (Visual Basic)

Public Property horizontal() As Long


See Also

GuiCalendar Object

4.5.4.18 IconName Property


See Also GuiCalendar Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiCalendar Object

4.5.4.19 Id Property
See Also GuiCalendar Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at

2006 SAP AG

Objects
the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

131

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiCalendar Object

4.5.4.20 IsSymbolFont Property


See Also GuiCalendar Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiCalendar Object

2006 SAP AG

132

SAP GUI Scripting API 6.40

4.5.4.21 LastVisibleDate Property


See Also GuiCalendar Object Property type Read-only property Syntax (Visual Basic)

Public Property LastVisibleDate() As String


See Also

GuiCalendar Object

4.5.4.22 Left Property


See Also GuiCalendar Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiCalendar Object

4.5.4.23 Modified Property


See Also GuiCalendar Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

2006 SAP AG

Objects

133

GuiCalendar Object

4.5.4.24 Name Property


See Also GuiCalendar Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiCalendar Object

4.5.4.25 OcxEvents Property


See Also GuiCalendar Object Description Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. Property type Read-only property Syntax (Visual Basic)

Public Property OcxEvents() As GuiCollection


See Also

GuiCalendar Object

4.5.4.26 Parent Property


See Also GuiCalendar Object Description

2006 SAP AG

134

SAP GUI Scripting API 6.40


The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiCalendar Object

4.5.4.27 ParentFrame Property


See Also GuiCalendar Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiCalendar Object

4.5.4.28 ScreenLeft Property


See Also GuiCalendar Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiCalendar Object

2006 SAP AG

Objects 4.5.4.29 ScreenTop Property


See Also GuiCalendar Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

135

Public Property ScreenTop() As Long


See Also

GuiCalendar Object

4.5.4.30 SelectionInterval Property


See Also GuiCalendar Object Description The interval is represented by two concatenated date strings separated by a comma. Property type Read-write property Syntax (Visual Basic)

Public Property SelectionInterval() As String


Example

Depending on the order in which the user has selected the dates, the value of selectionInterval is either 20020318,20020322 or 20020322,20020318. See Also

GuiCalendar Object

2006 SAP AG

136

SAP GUI Scripting API 6.40

4.5.4.31 startSelection Property


See Also GuiCalendar Object Property type Read-only property Syntax (Visual Basic)

Public Property startSelection() As String


See Also

GuiCalendar Object

4.5.4.32 SubType Property


See Also GuiCalendar Object Description Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value Calendar. Property type Read-only property Syntax (Visual Basic)

Public Property SubType() As String


See Also

GuiCalendar Object

4.5.4.33 Text Property


See Also GuiCalendar Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String

2006 SAP AG

Objects
See Also

137

GuiCalendar Object

4.5.4.34 Today Property


See Also GuiCalendar Object Property type Read-only property Syntax (Visual Basic)

Public Property Today() As String


See Also

GuiCalendar Object

4.5.4.35 Tooltip Property


See Also GuiCalendar Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiCalendar Object

4.5.4.36 Top Property


See Also GuiCalendar Object Description Top coordinate of the element in screen coordinates. Property type Read-only property

2006 SAP AG

138

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiCalendar Object

4.5.4.37 Type Property


See Also GuiCalendar Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiCalendar Object

4.5.4.38 TypeAsNumber Property


See Also GuiCalendar Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiCalendar Object

2006 SAP AG

Objects 4.5.4.39 Width Property


See Also GuiCalendar Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

139

Public Property Width() As Long


See Also

GuiCalendar Object

4.6

GuiChart Object
See Also GuiChart Members Description The GuiChart object is of a very technical nature. It should only be used for recording and playback, as most of the parameters can not be determined in any other way. For a list of all members defined in this module, see GuiChart members. Object Model

2006 SAP AG

140

SAP GUI Scripting API 6.40

Example

See Also

GuiChart Members

2006 SAP AG

Objects

141

4.6.1

Overview
See Also GuiChart Members Description The GuiChart object is of a very technical nature. It should only be used for recording and playback, as most of the parameters can not be determined in any other way. For a list of all members defined in this module, see GuiChart members. Object Model

Example

2006 SAP AG

142

SAP GUI Scripting API 6.40

See Also

GuiChart Members

4.6.2

Members
See Also GuiChart Overview Public Methods DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False.

FindAllByName

FindAllByNameEx

FindById

2006 SAP AG

Objects

143

FindByName

FindByNameEx

SelectContextMenuItem

Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Select an item from the controls context menu.

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item SelectContextMenuItemByPo text. sition Select a menu item of a context menu using the text of the item and possible higher level menus. SelectContextMenuItemByTe xt This function can be used to set the focus onto an object. If a user SetFocus interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. ShowContextMenu ValueChange Visualize Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

Public Properties AccDescription AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children ContainerType CurrentContextMenu DefaultTooltip DragDropSupported Handle Height Accessibility description of the shell. This description can be used for shells that do not have a title element. The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. This property is only set when a context menu is available at the shell object. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. This property is True if the shell allows drag and drop operations. The window handle of the control that is connected to the GuiShell. Height of the component in pixels.

2006 SAP AG

144

SAP GUI Scripting API 6.40


If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value Chart. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

IconName Id

IsSymbolFont Left Modified Name

OcxEvents Parent ParentFrame ScreenLeft ScreenTop SubType

Text

Tooltip Top Type

TypeAsNumber

Width See Also

GuiChart Overview

2006 SAP AG

Objects

145

4.6.3
4.6.3.1

Methods
DumpState Method
See Also GuiChart Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection:

2006 SAP AG

146

SAP GUI Scripting API 6.40 First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiChart Object

4.6.3.2

FindAllByName Method
See Also GuiChart Object Name Type Description

2006 SAP AG

Objects

147

The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiChart Object

4.6.3.3

FindAllByNameEx Method
See Also GuiChart Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiChart Object

2006 SAP AG

148 4.6.3.4

SAP GUI Scripting API 6.40 FindById Method


See Also GuiChart Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiChart Object

4.6.3.5

FindByName Method
See Also GuiChart Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _

2006 SAP AG

Objects ByVal Type As String _ ) As GuiComponent


Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

149

GuiChart Object

4.6.3.6

FindByNameEx Method
See Also GuiChart Object Name Type Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiChart Object

4.6.3.7

SelectContextMenuItem Method
See Also GuiChart Object FunctionCode Description Select an item from the controls context menu.

2006 SAP AG

150

SAP GUI Scripting API 6.40


Syntax

Public Sub SelectContextMenuItem( _ ByVal FunctionCode As String _ )


Parameters FunctionCode See Also

GuiChart Object

4.6.3.8

SelectContextMenuItemByPosition Method
See Also GuiChart Object PositionDesc Description This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item text. Syntax

Public Sub SelectContextMenuItemByPosition( _ ByVal PositionDesc As String _ )


Parameters PositionDesc Remarks The parameter is a string containing the path to the item. If the context menu item is on the top level menu, this is just the zero-base index of the item. Otherwise, the positions on the menu and respective submenus should be concatenated, separated by "|". See Also

GuiChart Object

4.6.3.9

SelectContextMenuItemByText Method
See Also GuiChart Object Text Description Select a menu item of a context menu using the text of the item and possible higher level menus. Syntax

2006 SAP AG

Objects Public Sub SelectContextMenuItemByText( _ ByVal Text As String _ )


Parameters Text See Also

151

GuiChart Object

4.6.3.10 SetFocus Method


See Also GuiChart Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiChart Object

4.6.3.11 ShowContextMenu Method


See Also GuiChart Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiChart Object

2006 SAP AG

152

SAP GUI Scripting API 6.40

4.6.3.12 ValueChange Method


See Also GuiChart Object Series Number of the data set within the row that should be changed. Point Number of the data point within the row that should be changed. XValue New x value. YValue New y value. DataChange Setting this parameter to True means the value was not changed interactively within the graphic but rather by entering the new value on the DataPoint property page. Id GFW data container id of the changed point. May be used instead of the pair series/point. ZValue New z value. ChangeFlag Notify which value was changed or if it was a time value. The value is set as a bit array, using the lower 5 bits. 1 x 2 y 4 x is time value 8 y is time value 16 z

If the new value is a point in time, it should be set using a string of the format mm/dd/yyyy hh: mm:ss .

Syntax

Public Sub ValueChange( _ ByVal Series As Long, _ ByVal Point As Long, _ ByVal XValue As String, _ ByVal YValue As String, _ ByVal DataChange As Boolean, _ ByVal Id As String, _ ByVal ZValue As String, _ ByVal ChangeFlag As Long _ )
Parameters Series Number of the data set within the row that should be changed. Point Number of the data point within the row that should be changed.

2006 SAP AG

Objects
XValue New x value. YValue New y value. DataChange

153

Setting this parameter to True means the value was not changed interactively within the graphic but rather by entering the new value on the DataPoint property page. Id GFW data container id of the changed point. May be used instead of the pair series/point. ZValue New z value. ChangeFlag Notify which value was changed or if it was a time value. The value is set as a bit array, using the lower 5 bits. 1 x 2 y 4 x is time value 8 y is time value 16 z

If the new value is a point in time, it should be set using a string of the format mm/dd/yyyy hh: mm:ss .

See Also

GuiChart Object

4.6.3.13 Visualize Method


See Also GuiChart Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On

2006 SAP AG

154

SAP GUI Scripting API 6.40


InnerObject See Also

GuiChart Object

4.6.4
4.6.4.1

Properties
AccDescription Property
See Also GuiChart Object Description Accessibility description of the shell. This description can be used for shells that do not have a title element. Property type Read-only property Syntax (Visual Basic)

Public Property AccDescription() As String


See Also

GuiChart Object

4.6.4.2

AccLabelCollection Property
See Also GuiChart Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiChart Object

2006 SAP AG

Objects 4.6.4.3 AccText Property


See Also GuiChart Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

155

Public Property AccText() As String


See Also

GuiChart Object

4.6.4.4

AccTextOnRequest Property
See Also GuiChart Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiChart Object

4.6.4.5

AccTooltip Property
See Also GuiChart Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String

2006 SAP AG

156

SAP GUI Scripting API 6.40


See Also

GuiChart Object

4.6.4.6

Changeable Property
See Also GuiChart Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiChart Object

4.6.4.7

Children Property
See Also GuiChart Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiChart Object

4.6.4.8

ContainerType Property
See Also GuiChart Object Description This property is TRUE, if the object is a container and therefore has the children property.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

157

Public Property ContainerType() As Boolean


See Also

GuiChart Object

4.6.4.9

CurrentContextMenu Property
See Also GuiChart Object Description This property is only set when a context menu is available at the shell object. Property type Read-only property Syntax (Visual Basic)

Public Property CurrentContextMenu() As GuiContextMenu


See Also

GuiChart Object

4.6.4.10 DefaultTooltip Property


See Also GuiChart Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiChart Object

2006 SAP AG

158

SAP GUI Scripting API 6.40

4.6.4.11 DragDropSupported Property


See Also GuiChart Object Description This property is True if the shell allows drag and drop operations. Property type Read-only property Syntax (Visual Basic)

Public Property DragDropSupported() As Boolean


See Also

GuiChart Object

4.6.4.12 Handle Property


See Also GuiChart Object Description The window handle of the control that is connected to the GuiShell. Property type Read-only property Syntax (Visual Basic)

Public Property Handle() As Long


See Also

GuiChart Object

4.6.4.13 Height Property


See Also GuiChart Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long

2006 SAP AG

Objects
See Also

159

GuiChart Object

4.6.4.14 IconName Property


See Also GuiChart Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiChart Object

4.6.4.15 Id Property
See Also GuiChart Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field

2006 SAP AG

160

SAP GUI Scripting API 6.40


name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiChart Object

4.6.4.16 IsSymbolFont Property


See Also GuiChart Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiChart Object

4.6.4.17 Left Property


See Also GuiChart Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiChart Object

2006 SAP AG

Objects 4.6.4.18 Modified Property


See Also GuiChart Object Description

161

An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiChart Object

4.6.4.19 Name Property


See Also GuiChart Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiChart Object

4.6.4.20 OcxEvents Property


See Also GuiChart Object Description Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. Property type Read-only property

2006 SAP AG

162

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property OcxEvents() As GuiCollection


See Also

GuiChart Object

4.6.4.21 Parent Property


See Also GuiChart Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiChart Object

4.6.4.22 ParentFrame Property


See Also GuiChart Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiChart Object

2006 SAP AG

Objects 4.6.4.23 ScreenLeft Property


See Also GuiChart Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

163

Public Property ScreenLeft() As Long


See Also

GuiChart Object

4.6.4.24 ScreenTop Property


See Also GuiChart Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiChart Object

4.6.4.25 SubType Property


See Also GuiChart Object Description Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value Chart. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

164

SAP GUI Scripting API 6.40 Public Property SubType() As String


See Also

GuiChart Object

4.6.4.26 Text Property


See Also GuiChart Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiChart Object

4.6.4.27 Tooltip Property


See Also GuiChart Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiChart Object

2006 SAP AG

Objects 4.6.4.28 Top Property


See Also GuiChart Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

165

Public Property Top() As Long


See Also

GuiChart Object

4.6.4.29 Type Property


See Also GuiChart Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiChart Object

4.6.4.30 TypeAsNumber Property


See Also GuiChart Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

166

SAP GUI Scripting API 6.40 Public Property TypeAsNumber() As Long


See Also

GuiChart Object

4.6.4.31 Width Property


See Also GuiChart Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiChart Object

4.7

GuiCheckBox Object
See Also GuiCheckBox Members Description GuiCheckBox extends GuiVComponent. The type prefix is chk, the name is the fieldname taken from the SAP data dictionary. For a list of all members defined in this module, see GuiCheckBox members. Object Model

See Also

2006 SAP AG

Objects

167

GuiCheckBox Members

4.7.1

Overview
See Also GuiCheckBox Members Description GuiCheckBox extends GuiVComponent. The type prefix is chk, the name is the fieldname taken from the SAP data dictionary. For a list of all members defined in this module, see GuiCheckBox members. Object Model

See Also

GuiCheckBox Members

4.7.2

Members
See Also GuiCheckBox Overview Public Methods DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. This method returns information that is compiled on the server to enhance the ABAP lists with accessibility information. See GuiLabel:: GetListProperty for a description of available attributes.

GetListProperty

2006 SAP AG

168

SAP GUI Scripting API 6.40


This method returns information that is compiled on the server to enhance the ABAP lists with accessibility information. See GuiLabel:: GetListProperty for a description of available attributes. In contrast to the method GetListProperty, GetListPropertyNonRec will only return information that is set for the specific element, and ignore list properties set for parent elements. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

GetListPropertyNonRec

SetFocus

ShowContextMenu Visualize

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable CharHeight CharLeft CharTop CharWidth ColorIndex ColorIntensified ColorInverse ContainerType DefaultTooltip Flushing The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. Height of the dynpro element in character metric. Left coordinate of the dynpro element in character metric. Top coordinate of the dynpro element in character metric. Width of the dynpro element in character metric. This number defines the index of the list color of this element. This property is True if the Intensified flag is set in screen painter for this dynpro element. This property is True if the inverse color style is set in screen painter for the element. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Some components such as radio buttons or check boxes may cause a round trip when their value is changed. If this is the case, the Flushing property is True. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. This property is True if the component has the 'assign left' flag. This property is True if the element is on an ABAP list, not a dynpro screen.

Height IconName Id

IsLeftLabel IsListElement

2006 SAP AG

Objects
This property is True if the component has the 'assign right' flag.

169

IsRightLabel IsSymbolFont Left LeftLabel Modified Name

The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates Left label of the component. The label is assigned in the screenpainter, using the flag 'assign left'. An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Right label of the component. This property is set in screenpainter using the 'assign right' flag. This property is only available in ABAP list screens. It returns the text of the while line containing the current component. The y position of the component in screen coordinates. The x position of the component in screen coordinates. Like radio buttons, checking a checkbox can cause server communication, depending on the ABAP screen painter definition. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

Parent ParentFrame RightLabel RowText ScreenLeft ScreenTop Selected Text

Tooltip Top Type

TypeAsNumber

Width See Also

GuiCheckBox Overview

2006 SAP AG

170

SAP GUI Scripting API 6.40

4.7.3
4.7.3.1

Methods
DumpState Method
See Also GuiCheckBox Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection:

2006 SAP AG

Objects First entry: OpCode GPR Name ItemCount

171

Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiCheckBox Object

4.7.3.2

GetListProperty Method
See Also GuiCheckBox Object Property Description This method returns information that is compiled on the server to enhance the ABAP lists with accessibility information. See GuiLabel::GetListProperty for a description of available attributes.

2006 SAP AG

172

SAP GUI Scripting API 6.40


Syntax

Public Function GetListProperty( _ ByVal Property As String _ ) As String


Parameters Property See Also

GuiCheckBox Object

4.7.3.3

GetListPropertyNonRec Method
See Also GuiCheckBox Object Property Description This method returns information that is compiled on the server to enhance the ABAP lists with accessibility information. See GuiLabel::GetListProperty for a description of available attributes. In contrast to the method GetListProperty, GetListPropertyNonRec will only return information that is set for the specific element, and ignore list properties set for parent elements. Syntax

Public Function GetListPropertyNonRec( _ ByVal Property As String _ ) As String


Parameters Property See Also

GuiCheckBox Object

4.7.3.4

SetFocus Method
See Also GuiCheckBox Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

2006 SAP AG

Objects Public Sub SetFocus()


Example

173

Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiCheckBox Object

4.7.3.5

ShowContextMenu Method
See Also GuiCheckBox Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiCheckBox Object

4.7.3.6

Visualize Method
See Also GuiCheckBox Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject

2006 SAP AG

174

SAP GUI Scripting API 6.40


See Also

GuiCheckBox Object

4.7.4
4.7.4.1

Properties
AccLabelCollection Property
See Also GuiCheckBox Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiCheckBox Object

4.7.4.2

AccText Property
See Also GuiCheckBox Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiCheckBox Object

2006 SAP AG

Objects 4.7.4.3 AccTextOnRequest Property


See Also GuiCheckBox Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

175

Public Property AccTextOnRequest() As String


See Also

GuiCheckBox Object

4.7.4.4

AccTooltip Property
See Also GuiCheckBox Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiCheckBox Object

4.7.4.5

Changeable Property
See Also GuiCheckBox Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean

2006 SAP AG

176

SAP GUI Scripting API 6.40


See Also

GuiCheckBox Object

4.7.4.6

CharHeight Property
See Also GuiCheckBox Object Description Height of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharHeight() As Long


See Also

GuiCheckBox Object

4.7.4.7

CharLeft Property
See Also GuiCheckBox Object Description Left coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharLeft() As Long


See Also

GuiCheckBox Object

4.7.4.8

CharTop Property
See Also GuiCheckBox Object Description Top coordinate of the dynpro element in character metric.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

177

Public Property CharTop() As Long


See Also

GuiCheckBox Object

4.7.4.9

CharWidth Property
See Also GuiCheckBox Object Description Width of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharWidth() As Long


See Also

GuiCheckBox Object

4.7.4.10 ColorIndex Property


See Also GuiCheckBox Object Description This number defines the index of the list color of this element. Property type Read-only property Syntax (Visual Basic)

Public Property ColorIndex() As Long


See Also

GuiCheckBox Object

2006 SAP AG

178

SAP GUI Scripting API 6.40

4.7.4.11 ColorIntensified Property


See Also GuiCheckBox Object Description This property is True if the Intensified flag is set in screen painter for this dynpro element. Property type Read-only property Syntax (Visual Basic)

Public Property ColorIntensified() As Boolean


See Also

GuiCheckBox Object

4.7.4.12 ColorInverse Property


See Also GuiCheckBox Object Description This property is True if the inverse color style is set in screen painter for the element. Property type Read-only property Syntax (Visual Basic)

Public Property ColorInverse() As Boolean


See Also

GuiCheckBox Object

4.7.4.13 ContainerType Property


See Also GuiCheckBox Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean

2006 SAP AG

Objects
See Also

179

GuiCheckBox Object

4.7.4.14 DefaultTooltip Property


See Also GuiCheckBox Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiCheckBox Object

4.7.4.15 Flushing Property


See Also GuiCheckBox Object Description Some components such as radio buttons or check boxes may cause a round trip when their value is changed. If this is the case, the Flushing property is True. Property type Read-only property Syntax (Visual Basic)

Public Property Flushing() As Boolean


See Also

GuiCheckBox Object

4.7.4.16 Height Property


See Also GuiCheckBox Object Description

2006 SAP AG

180

SAP GUI Scripting API 6.40


Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiCheckBox Object

4.7.4.17 IconName Property


See Also GuiCheckBox Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiCheckBox Object

4.7.4.18 Id Property
See Also GuiCheckBox Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it

2006 SAP AG

Objects

181

begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiCheckBox Object

4.7.4.19 IsLeftLabel Property


See Also GuiCheckBox Object Description This property is True if the component has the 'assign left' flag. Property type Read-only property Syntax (Visual Basic)

Public Property IsLeftLabel() As Boolean


See Also

GuiCheckBox Object

4.7.4.20 IsListElement Property


See Also GuiCheckBox Object Description This property is True if the element is on an ABAP list, not a dynpro screen. Property type Read-only property Syntax (Visual Basic)

Public Property IsListElement() As Boolean

2006 SAP AG

182

SAP GUI Scripting API 6.40


See Also

GuiCheckBox Object

4.7.4.21 IsRightLabel Property


See Also GuiCheckBox Object Description This property is True if the component has the 'assign right' flag. Property type Read-only property Syntax (Visual Basic)

Public Property IsRightLabel() As Boolean


See Also

GuiCheckBox Object

4.7.4.22 IsSymbolFont Property


See Also GuiCheckBox Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiCheckBox Object

4.7.4.23 Left Property


See Also GuiCheckBox Object Description Left position of the element in screen coordinates

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

183

Public Property Left() As Long


See Also

GuiCheckBox Object

4.7.4.24 LeftLabel Property


See Also GuiCheckBox Object Description Left label of the component. The label is assigned in the screenpainter, using the flag 'assign left'. Property type Read-only property Syntax (Visual Basic)

Public Property LeftLabel() As GuiVComponent


See Also

GuiCheckBox Object

4.7.4.25 Modified Property


See Also GuiCheckBox Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiCheckBox Object

2006 SAP AG

184

SAP GUI Scripting API 6.40

4.7.4.26 Name Property


See Also GuiCheckBox Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiCheckBox Object

4.7.4.27 Parent Property


See Also GuiCheckBox Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiCheckBox Object

4.7.4.28 ParentFrame Property


See Also GuiCheckBox Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

185

Public Property ParentFrame() As GuiComponent


See Also

GuiCheckBox Object

4.7.4.29 RightLabel Property


See Also GuiCheckBox Object Description Right label of the component. This property is set in screenpainter using the 'assign right' flag. Property type Read-only property Syntax (Visual Basic)

Public Property RightLabel() As GuiVComponent


See Also

GuiCheckBox Object

4.7.4.30 RowText Property


See Also GuiCheckBox Object Description This property is only available in ABAP list screens. It returns the text of the while line containing the current component. Property type Read-only property Syntax (Visual Basic)

Public Property RowText() As String


See Also

GuiCheckBox Object

2006 SAP AG

186

SAP GUI Scripting API 6.40

4.7.4.31 ScreenLeft Property


See Also GuiCheckBox Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiCheckBox Object

4.7.4.32 ScreenTop Property


See Also GuiCheckBox Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiCheckBox Object

4.7.4.33 Selected Property


See Also GuiCheckBox Object Description Like radio buttons, checking a checkbox can cause server communication, depending on the ABAP screen painter definition. Property type Read-write property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Selected() As Boolean


See Also

187

GuiCheckBox Object

4.7.4.34 Text Property


See Also GuiCheckBox Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiCheckBox Object

4.7.4.35 Tooltip Property


See Also GuiCheckBox Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiCheckBox Object

2006 SAP AG

188

SAP GUI Scripting API 6.40

4.7.4.36 Top Property


See Also GuiCheckBox Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiCheckBox Object

4.7.4.37 Type Property


See Also GuiCheckBox Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiCheckBox Object

4.7.4.38 TypeAsNumber Property


See Also GuiCheckBox Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property TypeAsNumber() As Long


See Also

189

GuiCheckBox Object

4.7.4.39 Width Property


See Also GuiCheckBox Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiCheckBox Object

4.8

GuiCollection Collection
See Also GuiCollection Members Description GuiCollection is similar to GuiComponentCollection, but its members are not necessarily extensions of GuiComponent. It can be used to pass a collection as a parameter to functions of scriptable objects. An object of this class is created by calling the CreateGuiCollection function of the GuiApplication. For a list of all members defined in this module, see GuiCollection members. See Also

GuiCollection Members

4.8.1

Overview
See Also GuiCollection Members Description GuiCollection is similar to GuiComponentCollection, but its members are not necessarily extensions of GuiComponent. It can be used to pass a collection as a parameter to functions of scriptable objects. An object of this class is created by calling the CreateGuiCollection function of the GuiApplication.

2006 SAP AG

190

SAP GUI Scripting API 6.40


For a list of all members defined in this module, see GuiCollection members. See Also

GuiCollection Members

4.8.2

Members
See Also GuiCollection Overview Public Methods Add ElementAt After a GuiCollection has been created, items can be added by calling the add function. This function returns the member in the collection at position index, where index may range from 0 to count-1. If no member can be found for the given index, an exception is raised. This function returns the member in the collection at position index, where index may range from 0 to count-1. It has been added for compatibility with Microsoft Visual Basic collections. If no member can be found for the given index, an exception is raised.

Item

Public Properties Count Length NewEnum Type The number of elements in the collection. This property has been added for compatibility with Microsoft Visual Basic collections. The number of elements in the collection. It has been added for compatibility with Microsoft Visual Basic collections. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. The value is GuiCollection. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. The value is 120.

TypeAsNumber

See Also

GuiCollection Overview

4.8.3
4.8.3.1

Methods
Add Method
See Also GuiCollection Collection Item Description After a GuiCollection has been created, items can be added by calling the add function.

2006 SAP AG

Objects
Syntax

191

Public Sub Add( _ ByVal Item As Variant _ )


Parameters Item See Also

GuiCollection Collection

4.8.3.2

ElementAt Method
See Also GuiCollection Collection Index Description This function returns the member in the collection at position index, where index may range from 0 to count-1. If no member can be found for the given index, an exception is raised. Syntax

Public Function ElementAt( _ ByVal Index As Long _ ) As Variant


Parameters Index See Also

GuiCollection Collection

4.8.3.3

Item Method
See Also GuiCollection Collection Index Description This function returns the member in the collection at position index, where index may range from 0 to count-1. It has been added for compatibility with Microsoft Visual Basic collections. If no member can be found for the given index, an exception is raised. Syntax

Public Function Item( _ ByVal Index As Variant _

2006 SAP AG

192

SAP GUI Scripting API 6.40 ) As Variant


Parameters Index See Also

GuiCollection Collection

4.8.4
4.8.4.1

Properties
Count Property
See Also GuiCollection Collection Description The number of elements in the collection. This property has been added for compatibility with Microsoft Visual Basic collections. Property type Read-only property Syntax (Visual Basic)

Public Property Count() As Long


See Also

GuiCollection Collection

4.8.4.2

Length Property
See Also GuiCollection Collection Description The number of elements in the collection. Property type Read-only property Syntax (Visual Basic)

Public Property Length() As Long


See Also

GuiCollection Collection

2006 SAP AG

Objects 4.8.4.3 NewEnum Property


See Also GuiCollection Collection Description It has been added for compatibility with Microsoft Visual Basic collections. Property type Read-only property Syntax (Visual Basic)

193

Public Property NewEnum() As Unknown


See Also

GuiCollection Collection

4.8.4.4

Type Property
See Also GuiCollection Collection Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. The value is GuiCollection. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiCollection Collection

4.8.4.5

TypeAsNumber Property
See Also GuiCollection Collection Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. The value is 120. Property type Read-only property

2006 SAP AG

194

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiCollection Collection

4.9

GuiColorSelector Object
See Also GuiColorSelector Members Description GuiColorSelector displays a set of colors for selection. It extends GuiShell. For a list of all members defined in this module, see GuiColorSelector members. Object Model

Example

2006 SAP AG

Objects

195

See Also

GuiColorSelector Members

4.9.1

Overview
See Also GuiColorSelector Members Description GuiColorSelector displays a set of colors for selection. It extends GuiShell. For a list of all members defined in this module, see GuiColorSelector members. Object Model

2006 SAP AG

196

SAP GUI Scripting API 6.40

Example

See Also

GuiColorSelector Members

4.9.2

Members
See Also GuiColorSelector Overview Public Methods

2006 SAP AG

Objects

197

ChangeSelection DumpState

FindAllByName

FindAllByNameEx

FindById

FindByName

FindByNameEx

SelectContextMenuItem

This function emulates the users selection of the color at the given index position. This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Select an item from the controls context menu.

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item SelectContextMenuItemByPo text. sition Select a menu item of a context menu using the text of the item and possible higher level menus. SelectContextMenuItemByTe xt This function can be used to set the focus onto an object. If a user SetFocus interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. ShowContextMenu Calling this method of a component will display a red frame around Visualize the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Public Properties

2006 SAP AG

198

SAP GUI Scripting API 6.40


Accessibility description of the shell. This description can be used for shells that do not have a title element. The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. This property is only set when a context menu is available at the shell object. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. This property is True if the shell allows drag and drop operations. The window handle of the control that is connected to the GuiShell. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value ColorSelector 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 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 cant change it, whereas you can only set the text property of a password field, but not read it.

AccDescription AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children ContainerType CurrentContextMenu DefaultTooltip DragDropSupported Handle Height IconName Id

IsSymbolFont Left Modified Name

OcxEvents Parent ParentFrame ScreenLeft ScreenTop SubType

Text

2006 SAP AG

Objects
The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates.

199

Tooltip Top Type

TypeAsNumber

Width See Also

The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

GuiColorSelector Overview

4.9.3
4.9.3.1

Methods
ChangeSelection Method
See Also GuiColorSelector Object i Description This function emulates the users selection of the color at the given index position. Syntax

Public Sub ChangeSelection( _ ByVal i As Integer _ )


Parameters i See Also

GuiColorSelector Object

4.9.3.2

DumpState Method
See Also GuiColorSelector Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the

2006 SAP AG

200

SAP GUI Scripting API 6.40


GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry:

2006 SAP AG

Objects OpCode Name Parameter1

201

Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiColorSelector Object

4.9.3.3

FindAllByName Method
See Also GuiColorSelector Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name

2006 SAP AG

202

SAP GUI Scripting API 6.40


Type See Also

GuiColorSelector Object

4.9.3.4

FindAllByNameEx Method
See Also GuiColorSelector Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiColorSelector Object

4.9.3.5

FindById Method
See Also GuiColorSelector Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _

2006 SAP AG

Objects ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent


Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

203

GuiColorSelector Object

4.9.3.6

FindByName Method
See Also GuiColorSelector Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiColorSelector Object

2006 SAP AG

204 4.9.3.7

SAP GUI Scripting API 6.40 FindByNameEx Method


See Also GuiColorSelector Object Name Type Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiColorSelector Object

4.9.3.8

SelectContextMenuItem Method
See Also GuiColorSelector Object FunctionCode Description Select an item from the controls context menu. Syntax

Public Sub SelectContextMenuItem( _ ByVal FunctionCode As String _ )


Parameters FunctionCode See Also

GuiColorSelector Object

2006 SAP AG

Objects 4.9.3.9 SelectContextMenuItemByPosition Method


See Also GuiColorSelector Object PositionDesc Description

205

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item text. Syntax

Public Sub SelectContextMenuItemByPosition( _ ByVal PositionDesc As String _ )


Parameters PositionDesc Remarks The parameter is a string containing the path to the item. If the context menu item is on the top level menu, this is just the zero-base index of the item. Otherwise, the positions on the menu and respective submenus should be concatenated, separated by "|". See Also

GuiColorSelector Object

4.9.3.10 SelectContextMenuItemByText Method


See Also GuiColorSelector Object Text Description Select a menu item of a context menu using the text of the item and possible higher level menus. Syntax

Public Sub SelectContextMenuItemByText( _ ByVal Text As String _ )


Parameters Text See Also

GuiColorSelector Object

2006 SAP AG

206

SAP GUI Scripting API 6.40

4.9.3.11 SetFocus Method


See Also GuiColorSelector Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiColorSelector Object

4.9.3.12 ShowContextMenu Method


See Also GuiColorSelector Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiColorSelector Object

4.9.3.13 Visualize Method


See Also GuiColorSelector Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

2006 SAP AG

Objects
Syntax

207

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiColorSelector Object

4.9.4
4.9.4.1

Properties
AccDescription Property
See Also GuiColorSelector Object Description Accessibility description of the shell. This description can be used for shells that do not have a title element. Property type Read-only property Syntax (Visual Basic)

Public Property AccDescription() As String


See Also

GuiColorSelector Object

4.9.4.2

AccLabelCollection Property
See Also GuiColorSelector Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection

2006 SAP AG

208

SAP GUI Scripting API 6.40


See Also

GuiColorSelector Object

4.9.4.3

AccText Property
See Also GuiColorSelector Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiColorSelector Object

4.9.4.4

AccTextOnRequest Property
See Also GuiColorSelector Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiColorSelector Object

4.9.4.5

AccTooltip Property
See Also GuiColorSelector Object Description An additional tooltip text for accessibility support.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

209

Public Property AccTooltip() As String


See Also

GuiColorSelector Object

4.9.4.6

Changeable Property
See Also GuiColorSelector Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiColorSelector Object

4.9.4.7

Children Property
See Also GuiColorSelector Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiColorSelector Object

2006 SAP AG

210 4.9.4.8

SAP GUI Scripting API 6.40 ContainerType Property


See Also GuiColorSelector Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiColorSelector Object

4.9.4.9

CurrentContextMenu Property
See Also GuiColorSelector Object Description This property is only set when a context menu is available at the shell object. Property type Read-only property Syntax (Visual Basic)

Public Property CurrentContextMenu() As GuiContextMenu


See Also

GuiColorSelector Object

4.9.4.10 DefaultTooltip Property


See Also GuiColorSelector Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property DefaultTooltip() As String


See Also

211

GuiColorSelector Object

4.9.4.11 DragDropSupported Property


See Also GuiColorSelector Object Description This property is True if the shell allows drag and drop operations. Property type Read-only property Syntax (Visual Basic)

Public Property DragDropSupported() As Boolean


See Also

GuiColorSelector Object

4.9.4.12 Handle Property


See Also GuiColorSelector Object Description The window handle of the control that is connected to the GuiShell. Property type Read-only property Syntax (Visual Basic)

Public Property Handle() As Long


See Also

GuiColorSelector Object

2006 SAP AG

212

SAP GUI Scripting API 6.40

4.9.4.13 Height Property


See Also GuiColorSelector Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiColorSelector Object

4.9.4.14 IconName Property


See Also GuiColorSelector Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiColorSelector Object

4.9.4.15 Id Property
See Also GuiColorSelector Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Id() As String


Remarks

213

Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiColorSelector Object

4.9.4.16 IsSymbolFont Property


See Also GuiColorSelector Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiColorSelector Object

4.9.4.17 Left Property


See Also GuiColorSelector Object Description Left position of the element in screen coordinates

2006 SAP AG

214

SAP GUI Scripting API 6.40


Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiColorSelector Object

4.9.4.18 Modified Property


See Also GuiColorSelector Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiColorSelector Object

4.9.4.19 Name Property


See Also GuiColorSelector Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

2006 SAP AG

Objects
GuiColorSelector Object

215

4.9.4.20 OcxEvents Property


See Also GuiColorSelector Object Description Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. Property type Read-only property Syntax (Visual Basic)

Public Property OcxEvents() As GuiCollection


See Also

GuiColorSelector Object

4.9.4.21 Parent Property


See Also GuiColorSelector Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiColorSelector Object

4.9.4.22 ParentFrame Property


See Also GuiColorSelector Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property

2006 SAP AG

216

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiColorSelector Object

4.9.4.23 ScreenLeft Property


See Also GuiColorSelector Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiColorSelector Object

4.9.4.24 ScreenTop Property


See Also GuiColorSelector Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiColorSelector Object

2006 SAP AG

Objects 4.9.4.25 SubType Property


See Also GuiColorSelector Object Description Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value ColorSelector Property type Read-only property Syntax (Visual Basic)

217

Public Property SubType() As String


See Also

GuiColorSelector Object

4.9.4.26 Text Property


See Also GuiColorSelector Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiColorSelector Object

4.9.4.27 Tooltip Property


See Also GuiColorSelector Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property

2006 SAP AG

218

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiColorSelector Object

4.9.4.28 Top Property


See Also GuiColorSelector Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiColorSelector Object

4.9.4.29 Type Property


See Also GuiColorSelector Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiColorSelector Object

2006 SAP AG

Objects 4.9.4.30 TypeAsNumber Property


See Also GuiColorSelector Object Description

219

While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiColorSelector Object

4.9.4.31 Width Property


See Also GuiColorSelector Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiColorSelector Object

4.10

GuiComboBox Object
See Also GuiComboBox Members 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 GuiVComponent. The type prefix is cmb, the name is the fieldname taken from the SAP data dictionary. For a list of all members defined in this module, see GuiComboBox members.

2006 SAP AG

220

SAP GUI Scripting API 6.40


Object Model

Remarks A combo box can be configured to send a function code to the server when the selection changes, which will invalidate references to all visible elements below the window level. See Also

GuiComboBox Members

4.10.1 Overview
See Also GuiComboBox Members 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 GuiVComponent. The type prefix is cmb, the name is the fieldname taken from the SAP data dictionary. For a list of all members defined in this module, see GuiComboBox members. Object Model

2006 SAP AG

Objects

221

Remarks A combo box can be configured to send a function code to the server when the selection changes, which will invalidate references to all visible elements below the window level. See Also

GuiComboBox Members

4.10.2 Members
See Also GuiComboBox Overview Public Methods DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. This function sets the key property of the combo box to the space character. It was introduced for eCATT. Shows the context menu of the control.

SetFocus

SetKeySpace ShowContextMenu

2006 SAP AG

222

SAP GUI Scripting API 6.40


Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

Visualize

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable CharHeight CharLeft CharTop CharWidth ContainerType CurListBoxEntry DefaultTooltip Entries The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. Height of the dynpro element in character metric. Left coordinate of the dynpro element in character metric. Top coordinate of the dynpro element in character metric. Width of the dynpro element in character metric. This property is TRUE, if the object is a container and therefore has the children property. The currently focussed entry of the dropdown list. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. All members of this collection are of GuiComboBoxEntry type and have just two properties, key and value, both of type String. The key data can be displayed in SAP GUI by setting the Show keys check box on the option dialogs expert page. Some components such as radio buttons or check boxes may cause a round trip when their value is changed. If this is the case, the Flushing property is True. Height of the component in pixels. This property is True if the Highlighted flag is set in the screen painter for the dynpro element. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. This property is True if the component has the 'assign left' flag. This property is True if the list box of the the combo box is currently open. This property is True if the component has the 'assign right' flag. The property is TRUE if the component's text is visualized in the SAP symbol font. This is the key of the currently selected item. You can change this item by setting the key property to a new value. Left position of the element in screen coordinates Left label of the component. The label is assigned in the screenpainter, using the flag 'assign left'. This label has been defined in ABAP Screen Painter to be the left label of the control.

Flushing

Height Highlighted IconName Id

IsLeftLabel IsListBoxActive IsRightLabel IsSymbolFont Key Left LeftLabel

2006 SAP AG

Objects

223

Modified Name

Parent ParentFrame Required

RightLabel

ScreenLeft ScreenTop Text

An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. This property is True if the component is a required value for the screen. If the required flag is set for a combo box then the empty entry is not selectable from the list. Right label of the component. This property is set in screenpainter using the 'assign right' flag. This label has been defined in ABAP Screen Painter to be the right label of the control. The y position of the component in screen coordinates. The x position of the component in screen coordinates. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. This is the value of the currently selected item. You can change this item by setting the value property to a new value. Width of the component in pixels.

Tooltip Top Type

TypeAsNumber

Value Width See Also

GuiComboBox Overview

4.10.3 Methods
4.10.3.1 DumpState Method
See Also GuiComboBox Object InnerObject Description

2006 SAP AG

224

SAP GUI Scripting API 6.40


This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry:

2006 SAP AG

Objects

225

OpCode

Name

Parameter1

Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiComboBox Object

4.10.3.2 SetFocus Method


See Also GuiComboBox Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

2006 SAP AG

226

SAP GUI Scripting API 6.40


GuiComboBox Object

4.10.3.3 SetKeySpace Method


See Also GuiComboBox Object Description This function sets the key property of the combo box to the space character. It was introduced for eCATT. Syntax

Public Sub SetKeySpace()


See Also

GuiComboBox Object

4.10.3.4 ShowContextMenu Method


See Also GuiComboBox Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiComboBox Object

4.10.3.5 Visualize Method


See Also GuiComboBox Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

2006 SAP AG

Objects Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

227

GuiComboBox Object

4.10.4 Properties
4.10.4.1 AccLabelCollection Property
See Also GuiComboBox Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiComboBox Object

4.10.4.2 AccText Property


See Also GuiComboBox Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

2006 SAP AG

228

SAP GUI Scripting API 6.40

GuiComboBox Object

4.10.4.3 AccTextOnRequest Property


See Also GuiComboBox Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiComboBox Object

4.10.4.4 AccTooltip Property


See Also GuiComboBox Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiComboBox Object

4.10.4.5 Changeable Property


See Also GuiComboBox Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

229

Public Property Changeable() As Boolean


See Also

GuiComboBox Object

4.10.4.6 CharHeight Property


See Also GuiComboBox Object Description Height of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharHeight() As Long


See Also

GuiComboBox Object

4.10.4.7 CharLeft Property


See Also GuiComboBox Object Description Left coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharLeft() As Long


See Also

GuiComboBox Object

2006 SAP AG

230

SAP GUI Scripting API 6.40

4.10.4.8 CharTop Property


See Also GuiComboBox Object Description Top coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharTop() As Long


See Also

GuiComboBox Object

4.10.4.9 CharWidth Property


See Also GuiComboBox Object Description Width of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharWidth() As Long


See Also

GuiComboBox Object

4.10.4.10 ContainerType Property


See Also GuiComboBox Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean

2006 SAP AG

Objects
See Also

231

GuiComboBox Object

4.10.4.11 CurListBoxEntry Property


See Also GuiComboBox Object Description The currently focussed entry of the dropdown list. Property type Read-only property Syntax (Visual Basic)

Public Property CurListBoxEntry() As GuiComboBoxEntry


See Also

GuiComboBox Object

4.10.4.12 DefaultTooltip Property


See Also GuiComboBox Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiComboBox Object

4.10.4.13 Entries Property


See Also GuiComboBox Object Description All members of this collection are of GuiComboBoxEntry type and have just two properties, key and

2006 SAP AG

232

SAP GUI Scripting API 6.40


value, both of type String. The key data can be displayed in SAP GUI by setting the Show keys check box on the option dialogs expert page. Property type Read-only property Syntax (Visual Basic)

Public Property Entries() As GuiCollection


Example

In this example the first column contains the key property and the second column contains the value property. See Also

GuiComboBox Object

4.10.4.14 Flushing Property


See Also GuiComboBox Object Description Some components such as radio buttons or check boxes may cause a round trip when their value is changed. If this is the case, the Flushing property is True. Property type Read-only property Syntax (Visual Basic)

Public Property Flushing() As Boolean


See Also

GuiComboBox Object

2006 SAP AG

Objects 4.10.4.15 Height Property


See Also GuiComboBox Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

233

Public Property Height() As Long


See Also

GuiComboBox Object

4.10.4.16 Highlighted Property


See Also GuiComboBox Object Description This property is True if the Highlighted flag is set in the screen painter for the dynpro element. Property type Read-only property Syntax (Visual Basic)

Public Property Highlighted() As Boolean


See Also

GuiComboBox Object

4.10.4.17 IconName Property


See Also GuiComboBox Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

234

SAP GUI Scripting API 6.40 Public Property IconName() As String


See Also

GuiComboBox Object

4.10.4.18 Id Property
See Also GuiComboBox Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiComboBox Object

4.10.4.19 IsLeftLabel Property


See Also GuiComboBox Object Description

2006 SAP AG

Objects
This property is True if the component has the 'assign left' flag. Property type Read-only property Syntax (Visual Basic)

235

Public Property IsLeftLabel() As Boolean


See Also

GuiComboBox Object

4.10.4.20 IsListBoxActive Property


See Also GuiComboBox Object Description This property is True if the list box of the the combo box is currently open. Property type Read-only property Syntax (Visual Basic)

Public Property IsListBoxActive() As Boolean


See Also

GuiComboBox Object

4.10.4.21 IsRightLabel Property


See Also GuiComboBox Object Description This property is True if the component has the 'assign right' flag. Property type Read-only property Syntax (Visual Basic)

Public Property IsRightLabel() As Boolean


See Also

GuiComboBox Object

2006 SAP AG

236

SAP GUI Scripting API 6.40

4.10.4.22 IsSymbolFont Property


See Also GuiComboBox Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiComboBox Object

4.10.4.23 Key Property


See Also GuiComboBox Object Description This is the key of the currently selected item. You can change this item by setting the key property to a new value. Property type Read-write property Syntax (Visual Basic)

Public Property Key() As String


See Also

GuiComboBox Object

4.10.4.24 Left Property


See Also GuiComboBox Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Left() As Long


See Also

237

GuiComboBox Object

4.10.4.25 LeftLabel Property


See Also GuiComboBox Object Description Left label of the component. The label is assigned in the screenpainter, using the flag 'assign left'. This label has been defined in ABAP Screen Painter to be the left label of the control. Property type Read-only property Syntax (Visual Basic)

Public Property LeftLabel() As GuiVComponent


See Also

GuiComboBox Object

4.10.4.26 Modified Property


See Also GuiComboBox Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiComboBox Object

2006 SAP AG

238

SAP GUI Scripting API 6.40

4.10.4.27 Name Property


See Also GuiComboBox Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiComboBox Object

4.10.4.28 Parent Property


See Also GuiComboBox Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiComboBox Object

4.10.4.29 ParentFrame Property


See Also GuiComboBox Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

239

Public Property ParentFrame() As GuiComponent


See Also

GuiComboBox Object

4.10.4.30 Required Property


See Also GuiComboBox Object Description This property is True if the component is a required value for the screen. If the required flag is set for a combo box then the empty entry is not selectable from the list. Property type Read-only property Syntax (Visual Basic)

Public Property Required() As Boolean


See Also

GuiComboBox Object

4.10.4.31 RightLabel Property


See Also GuiComboBox Object Description Right label of the component. This property is set in screenpainter using the 'assign right' flag. This label has been defined in ABAP Screen Painter to be the right label of the control. Property type Read-only property Syntax (Visual Basic)

Public Property RightLabel() As GuiVComponent


See Also

GuiComboBox Object

2006 SAP AG

240

SAP GUI Scripting API 6.40

4.10.4.32 ScreenLeft Property


See Also GuiComboBox Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiComboBox Object

4.10.4.33 ScreenTop Property


See Also GuiComboBox Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiComboBox Object

4.10.4.34 Text Property


See Also GuiComboBox Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Text() As String


See Also

241

GuiComboBox Object

4.10.4.35 Tooltip Property


See Also GuiComboBox Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiComboBox Object

4.10.4.36 Top Property


See Also GuiComboBox Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiComboBox Object

2006 SAP AG

242

SAP GUI Scripting API 6.40

4.10.4.37 Type Property


See Also GuiComboBox Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiComboBox Object

4.10.4.38 TypeAsNumber Property


See Also GuiComboBox Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiComboBox Object

4.10.4.39 Value Property


See Also GuiComboBox Object Description This is the value of the currently selected item. You can change this item by setting the value property to a new value. Property type Read-write property

2006 SAP AG

Objects
Syntax (Visual Basic)

243

Public Property Value() As String


See Also

GuiComboBox Object

4.10.4.40 Width Property


See Also GuiComboBox Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiComboBox Object

4.11

GuiComboBoxEntry Object
See Also GuiComboBoxEntry Members Description Members of the Entries collection of a GuiComboBox are of type GuiComBoxEntry For a list of all members defined in this module, see GuiComboBoxEntry members. See Also

GuiComboBoxEntry Members

4.11.1 Overview
See Also GuiComboBoxEntry Members Description Members of the Entries collection of a GuiComboBox are of type GuiComBoxEntry For a list of all members defined in this module, see GuiComboBoxEntry members.

2006 SAP AG

244

SAP GUI Scripting API 6.40


See Also

GuiComboBoxEntry Members

4.11.2 Members
See Also GuiComboBoxEntry Overview Public Properties Key Pos Value See Also Key value of the combo box entry. Position of the combo box entry. Value of the combo box entry.

GuiComboBoxEntry Overview

4.11.3 Properties
4.11.3.1 Key Property
See Also GuiComboBoxEntry Object Description Key value of the combo box entry. Property type Read-only property Syntax (Visual Basic)

Public Property Key() As String


See Also

GuiComboBoxEntry Object

4.11.3.2 Pos Property


See Also GuiComboBoxEntry Object Description Position of the combo box entry. Property type

2006 SAP AG

Objects
Read-only property Syntax (Visual Basic)

245

Public Property Pos() As Long


See Also

GuiComboBoxEntry Object

4.11.3.3 Value Property


See Also GuiComboBoxEntry Object Description Value of the combo box entry. Property type Read-only property Syntax (Visual Basic)

Public Property Value() As String


See Also

GuiComboBoxEntry Object

4.12

GuiComponent Object
See Also GuiComponent Members Description

It was designed to allow generic programming, meaning you can work with objects without knowing their exact type.
GuiComponent is the base class for most classes in the Scripting API. For a list of all members defined in this module, see GuiComponent members. Remarks GuiComponent is an abstract class. See Also

GuiComponent Members

2006 SAP AG

246

SAP GUI Scripting API 6.40

4.12.1 Overview
See Also GuiComponent Members Description

It was designed to allow generic programming, meaning you can work with objects without knowing their exact type.
GuiComponent is the base class for most classes in the Scripting API. For a list of all members defined in this module, see GuiComponent members. Remarks GuiComponent is an abstract class. See Also

GuiComponent Members

4.12.2 Members
See Also GuiComponent Overview Public Properties ContainerType Id This property is TRUE, if the object is a container and therefore has the children property. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration.

Name

Parent Type

TypeAsNumber

See Also

GuiComponent Overview

2006 SAP AG

Objects

247

4.12.3 Properties
4.12.3.1 ContainerType Property
See Also GuiComponent Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiComponent Object

4.12.3.2 Id Property
See Also GuiComponent Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand,

2006 SAP AG

248

SAP GUI Scripting API 6.40


list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiComponent Object

4.12.3.3 Name Property


See Also GuiComponent Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiComponent Object

4.12.3.4 Parent Property


See Also GuiComponent Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As Object


See Also

GuiComponent Object

2006 SAP AG

Objects 4.12.3.5 Type Property


See Also GuiComponent Object Description

249

The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiComponent Object

4.12.3.6 TypeAsNumber Property


See Also GuiComponent Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiComponent Object

4.13

GuiComponentCollection Collection
See Also GuiComponentCollection Members 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. For a list of all members defined in this module, see GuiComponentCollection members. Object Model

2006 SAP AG

250

SAP GUI Scripting API 6.40

See Also

GuiComponentCollection Members

4.13.1 Overview
See Also GuiComponentCollection Members 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. For a list of all members defined in this module, see GuiComponentCollection members. Object Model

See Also

GuiComponentCollection Members

4.13.2 Members
See Also GuiComponentCollection Overview Public Methods ElementAt This function returns the member in the collection at position index, where index may range from 0 to count-1. If no member can be found for the given index, the exception Gui_Err_Enumerator_Index (614) is raised. This function returns the member in the collection at position index, where index may range from 0 to count-1. It has been added for compatibility with Microsoft Visual Basic collections. If no member can be found for the given index the exception Gui_Err_Enumerator_Index (614) is raised.

Item

Public Properties Count Length NewEnum Type The number of elements in the collection. This property is used implicitly from Visual Basic applications. The number of elements in the collection. This property is used implicitly from Visual Basic applications. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. The value is GuiCollection.

2006 SAP AG

Objects

251

TypeAsNumber

While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. The value is 120.

See Also

GuiComponentCollection Overview

4.13.3 Methods
4.13.3.1 ElementAt Method
See Also GuiComponentCollection Collection Index Description This function returns the member in the collection at position index, where index may range from 0 to count-1. If no member can be found for the given index, the exception Gui_Err_Enumerator_Index (614) is raised. Syntax

Public Function ElementAt( _ ByVal Index As Long _ ) As GuiComponent


Parameters Index See Also

GuiComponentCollection Collection

4.13.3.2 Item Method


See Also GuiComponentCollection Collection Index Description This function returns the member in the collection at position index, where index may range from 0 to count-1. It has been added for compatibility with Microsoft Visual Basic collections. If no member can be found for the given index the exception Gui_Err_Enumerator_Index (614) is raised. Syntax

Public Function Item( _ ByVal Index As Variant _

2006 SAP AG

252

SAP GUI Scripting API 6.40 ) As GuiComponent


Parameters Index See Also

GuiComponentCollection Collection

4.13.4 Properties
4.13.4.1 Count Property
See Also GuiComponentCollection Collection Description The number of elements in the collection. This property is used implicitly from Visual Basic applications. Property type Read-only property Syntax (Visual Basic)

Public Property Count() As Long


See Also

GuiComponentCollection Collection

4.13.4.2 Length Property


See Also GuiComponentCollection Collection Description The number of elements in the collection. Property type Read-only property Syntax (Visual Basic)

Public Property Length() As Long


See Also

GuiComponentCollection Collection

2006 SAP AG

Objects 4.13.4.3 NewEnum Property


See Also GuiComponentCollection Collection Description This property is used implicitly from Visual Basic applications. Property type Read-only property Syntax (Visual Basic)

253

Public Property NewEnum() As Unknown


See Also

GuiComponentCollection Collection

4.13.4.4 Type Property


See Also GuiComponentCollection Collection Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. The value is GuiCollection. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiComponentCollection Collection

4.13.4.5 TypeAsNumber Property


See Also GuiComponentCollection Collection Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. The value is 120. Property type Read-only property

2006 SAP AG

254

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiComponentCollection Collection

4.14

GuiConnection Object
See Also GuiConnection Members Description A GuiConnection represents the connection between SAP GUI and an application server. Connections can be opened from SAPlogon or from GuiApplications openConnection and openConnectionByConnectionString methods. GuiConnection extends GuiContainer. The type prefix for GuiConnection is con, the name is con plus the connection number in square brackets. For a list of all members defined in this module, see GuiConnection members. Object Model

Remarks It is possible to connect to an application server from ABAP using the following command: CALL FUNCTION func DESTINATION dest. However, this connection is implemented as a re-direction between the two application servers involved. There will therefore be no new GuiConnection object available and the existing object will not reflect the server switch. See Also

GuiConnection Members

4.14.1 Overview
See Also GuiConnection Members Description A GuiConnection represents the connection between SAP GUI and an application server. Connections can be opened from SAPlogon or from GuiApplications openConnection and openConnectionByConnectionString methods. GuiConnection extends GuiContainer. The type prefix for GuiConnection is con, the name is con plus the connection number in square brackets. For a list of all members defined in this module, see GuiConnection members.

2006 SAP AG

Objects
Object Model

255

Remarks It is possible to connect to an application server from ABAP using the following command: CALL FUNCTION func DESTINATION dest. However, this connection is implemented as a re-direction between the two application servers involved. There will therefore be no new GuiConnection object available and the existing object will not reflect the server switch. See Also

GuiConnection Members

4.14.2 Members
See Also GuiConnection Overview Public Methods CloseSession A session can be closed by calling this method of the connection. Closing the last session of a connection will close the connection, too. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False.

FindById

Public Properties Children ConnectionString This collection contains all direct children of the object. This property contains the connection string defining the backend connection. It is more difficult to read, but it doesnt rely on the SAPLogon entries. This property is TRUE, if the object is a container and therefore has the children property. This description is only available if the connection was started either from SAPlogon or using GuiApplication.OpenConnection. In both cases the description can then be used when calling the OpenConnection method to play back a script on the same system. This property is set to True if the scripting support has not been enabled for the application server . An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object.

ContainerType Description

DisabledByServer Id

2006 SAP AG

256

SAP GUI Scripting API 6.40


The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. This property is another name for the children property. It was added for better readability as all the children of GuiConnection are sessions. Accessing either the children property or the sessions property can cause the exception Gui_Err_Scripting_Disabled_Srv (624) to be raised if the respective application server has not enabled the scripting support. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration.

Name

Parent Sessions

Type

TypeAsNumber

See Also

GuiConnection Overview

4.14.3 Methods
4.14.3.1 CloseSession Method
See Also GuiConnection Object Id Description A session can be closed by calling this method of the connection. Closing the last session of a connection will close the connection, too. Syntax

Public Sub CloseSession( _ ByVal Id As String _ )


Parameters Id See Also

GuiConnection Object

2006 SAP AG

Objects 4.14.3.2 FindById Method


See Also GuiConnection Object Id Raise Description

257

Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiConnection Object

4.14.4 Properties
4.14.4.1 Children Property
See Also GuiConnection Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

2006 SAP AG

258

SAP GUI Scripting API 6.40


GuiConnection Object

4.14.4.2 ConnectionString Property


See Also GuiConnection Object Description This property contains the connection string defining the backend connection. It is more difficult to read, but it doesnt rely on the SAPLogon entries. Property type Read-only property Syntax (Visual Basic)

Public Property ConnectionString() As String


See Also

GuiConnection Object

4.14.4.3 ContainerType Property


See Also GuiConnection Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiConnection Object

4.14.4.4 Description Property


See Also GuiConnection Object Description This description is only available if the connection was started either from SAPlogon or using GuiApplication.OpenConnection. In both cases the description can then be used when calling the OpenConnection method to play back a script on the same system. Property type

2006 SAP AG

Objects
Read-only property Syntax (Visual Basic)

259

Public Property Description() As String


See Also

GuiConnection Object

4.14.4.5 DisabledByServer Property


See Also GuiConnection Object Description This property is set to True if the scripting support has not been enabled for the application server . Property type Read-only property Syntax (Visual Basic)

Public Property DisabledByServer() As Boolean


See Also

GuiConnection Object

4.14.4.6 Id Property
See Also GuiConnection Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open.

2006 SAP AG

260

SAP GUI Scripting API 6.40


Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiConnection Object

4.14.4.7 Name Property


See Also GuiConnection Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiConnection Object

4.14.4.8 Parent Property


See Also GuiConnection Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent

2006 SAP AG

Objects
See Also

261

GuiConnection Object

4.14.4.9 Sessions Property


See Also GuiConnection Object Description This property is another name for the children property. It was added for better readability as all the children of GuiConnection are sessions. Accessing either the children property or the sessions property can cause the exception Gui_Err_Scripting_Disabled_Srv (624) to be raised if the respective application server has not enabled the scripting support. Property type Read-only property Syntax (Visual Basic)

Public Property Sessions() As GuiComponentCollection


See Also

GuiConnection Object

4.14.4.10 Type Property


See Also GuiConnection Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiConnection Object

2006 SAP AG

262

SAP GUI Scripting API 6.40

4.14.4.11 TypeAsNumber Property


See Also GuiConnection Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiConnection Object

4.15

GuiContainer Object
See Also GuiContainer Members 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 GuiComponent. For a list of all members defined in this module, see GuiContainer members. Object Model

See Also

GuiContainer Members

4.15.1 Overview
See Also GuiContainer Members Description This interface resembles GuiVContainer. The only difference is that it is not intended for visual objects

2006 SAP AG

Objects

263

but rather administrative objects such as connections or sessions. Objects exposing this interface will therefore support GuiComponent but not GuiVComponent. GuiContainer extends GuiComponent. For a list of all members defined in this module, see GuiContainer members. Object Model

See Also

GuiContainer Members

4.15.2 Members
See Also GuiContainer Overview Public Methods 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 thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False.

Public Properties Children ContainerType Id This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration.

Name

Parent Type

TypeAsNumber

See Also

2006 SAP AG

264

SAP GUI Scripting API 6.40


GuiContainer Overview

4.15.3 Methods
4.15.3.1 FindById Method
See Also GuiContainer Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiContainer Object

4.15.4 Properties
4.15.4.1 Children Property
See Also GuiContainer Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Children() As GuiComponentCollection


See Also

265

GuiContainer Object

4.15.4.2 ContainerType Property


See Also GuiContainer Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiContainer Object

4.15.4.3 Id Property
See Also GuiContainer Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It

2006 SAP AG

266

SAP GUI Scripting API 6.40


is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiContainer Object

4.15.4.4 Name Property


See Also GuiContainer Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiContainer Object

4.15.4.5 Parent Property


See Also GuiContainer Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

2006 SAP AG

Objects
GuiContainer Object

267

4.15.4.6 Type Property


See Also GuiContainer Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiContainer Object

4.15.4.7 TypeAsNumber Property


See Also GuiContainer Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiContainer Object

4.16

GuiContainerShell Object
See Also GuiContainerShell Members Description A GuiContainerShell is a wrapper for a set of GuiShell objects. GuiContainerShell extends GuiVContainer. The type prefix is shellcont, the name is the last part of the id, shellcont[n].

2006 SAP AG

268

SAP GUI Scripting API 6.40


For a list of all members defined in this module, see GuiContainerShell members. Object Model

See Also

GuiContainerShell Members

4.16.1 Overview
See Also GuiContainerShell Members Description A GuiContainerShell is a wrapper for a set of GuiShell objects. GuiContainerShell extends GuiVContainer. The type prefix is shellcont, the name is the last part of the id, shellcont[n]. For a list of all members defined in this module, see GuiContainerShell members. Object Model

2006 SAP AG

Objects

269

See Also

GuiContainerShell Members

4.16.2 Members
See Also GuiContainerShell Overview Public Methods DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used.

FindAllByName

FindAllByNameEx

2006 SAP AG

270

SAP GUI Scripting API 6.40


Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

FindById

FindByName

FindByNameEx

SetFocus

ShowContextMenu Visualize

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children ContainerType DefaultTooltip Height IconName Id The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system.

IsSymbolFont Left Modified

2006 SAP AG

Objects

271

Name

Parent ParentFrame ScreenLeft ScreenTop Text

The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

Tooltip Top Type

TypeAsNumber

Width See Also

GuiContainerShell Overview

4.16.3 Methods
4.16.3.1 DumpState Method
See Also GuiContainerShell Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

2006 SAP AG

272

SAP GUI Scripting API 6.40 Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection
Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

2006 SAP AG

Objects

273

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiContainerShell Object

4.16.3.2 FindAllByName Method


See Also GuiContainerShell Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiContainerShell Object

2006 SAP AG

274

SAP GUI Scripting API 6.40

4.16.3.3 FindAllByNameEx Method


See Also GuiContainerShell Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiContainerShell Object

4.16.3.4 FindById Method


See Also GuiContainerShell Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise

2006 SAP AG

Objects
Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

275

GuiContainerShell Object

4.16.3.5 FindByName Method


See Also GuiContainerShell Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiContainerShell Object

4.16.3.6 FindByNameEx Method


See Also GuiContainerShell Object Name Type

2006 SAP AG

276

SAP GUI Scripting API 6.40


Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiContainerShell Object

4.16.3.7 SetFocus Method


See Also GuiContainerShell Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiContainerShell Object

4.16.3.8 ShowContextMenu Method


See Also GuiContainerShell Object Description Shows the context menu of the control. Syntax

2006 SAP AG

Objects Public Sub ShowContextMenu()


See Also

277

GuiContainerShell Object

4.16.3.9 Visualize Method


See Also GuiContainerShell Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiContainerShell Object

4.16.4 Properties
4.16.4.1 AccLabelCollection Property
See Also GuiContainerShell Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

278

SAP GUI Scripting API 6.40 Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiContainerShell Object

4.16.4.2 AccText Property


See Also GuiContainerShell Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiContainerShell Object

4.16.4.3 AccTextOnRequest Property


See Also GuiContainerShell Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiContainerShell Object

2006 SAP AG

Objects 4.16.4.4 AccTooltip Property


See Also GuiContainerShell Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

279

Public Property AccTooltip() As String


See Also

GuiContainerShell Object

4.16.4.5 Changeable Property


See Also GuiContainerShell Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiContainerShell Object

4.16.4.6 Children Property


See Also GuiContainerShell Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection

2006 SAP AG

280

SAP GUI Scripting API 6.40


See Also

GuiContainerShell Object

4.16.4.7 ContainerType Property


See Also GuiContainerShell Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiContainerShell Object

4.16.4.8 DefaultTooltip Property


See Also GuiContainerShell Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiContainerShell Object

4.16.4.9 Height Property


See Also GuiContainerShell Object Description Height of the component in pixels.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

281

Public Property Height() As Long


See Also

GuiContainerShell Object

4.16.4.10 IconName Property


See Also GuiContainerShell Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiContainerShell Object

4.16.4.11 Id Property
See Also GuiContainerShell Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is

2006 SAP AG

282

SAP GUI Scripting API 6.40


usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiContainerShell Object

4.16.4.12 IsSymbolFont Property


See Also GuiContainerShell Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiContainerShell Object

4.16.4.13 Left Property


See Also GuiContainerShell Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

2006 SAP AG

Objects

283

GuiContainerShell Object

4.16.4.14 Modified Property


See Also GuiContainerShell Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiContainerShell Object

4.16.4.15 Name Property


See Also GuiContainerShell Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiContainerShell Object

4.16.4.16 Parent Property


See Also GuiContainerShell Object Description

2006 SAP AG

284

SAP GUI Scripting API 6.40


The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiContainerShell Object

4.16.4.17 ParentFrame Property


See Also GuiContainerShell Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiContainerShell Object

4.16.4.18 ScreenLeft Property


See Also GuiContainerShell Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiContainerShell Object

2006 SAP AG

Objects 4.16.4.19 ScreenTop Property


See Also GuiContainerShell Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

285

Public Property ScreenTop() As Long


See Also

GuiContainerShell Object

4.16.4.20 Text Property


See Also GuiContainerShell Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiContainerShell Object

4.16.4.21 Tooltip Property


See Also GuiContainerShell Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property

2006 SAP AG

286

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiContainerShell Object

4.16.4.22 Top Property


See Also GuiContainerShell Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiContainerShell Object

4.16.4.23 Type Property


See Also GuiContainerShell Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiContainerShell Object

2006 SAP AG

Objects 4.16.4.24 TypeAsNumber Property


See Also GuiContainerShell Object Description

287

While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiContainerShell Object

4.16.4.25 Width Property


See Also GuiContainerShell Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiContainerShell Object

4.17

GuiContextMenu Object
See Also GuiContextMenu Members Description A GuiContextMenu may have other GuiContextMenu objects as children. GuiContextMenu extends GuiMenu. The type is mnu, the name is the function code that is sent to the system when the menu item is selected. For a list of all members defined in this module, see GuiContextMenu members. Object Model

2006 SAP AG

288

SAP GUI Scripting API 6.40

See Also

GuiContextMenu Members

4.17.1 Overview
See Also GuiContextMenu Members Description A GuiContextMenu may have other GuiContextMenu objects as children. GuiContextMenu extends GuiMenu. The type is mnu, the name is the function code that is sent to the system when the menu item is selected. For a list of all members defined in this module, see GuiContextMenu members. Object Model

2006 SAP AG

Objects

289

See Also

GuiContextMenu Members

4.17.2 Members
See Also GuiContextMenu Overview Public Methods DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used.

FindAllByName

FindAllByNameEx

2006 SAP AG

290

SAP GUI Scripting API 6.40


Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Select the context menu item. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

FindById

FindByName

FindByNameEx

Select SetFocus

ShowContextMenu Visualize

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children ContainerType DefaultTooltip Height IconName Id The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system.

IsSymbolFont Left Modified

2006 SAP AG

Objects

291

Name

Parent ParentFrame ScreenLeft ScreenTop Text

The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

Tooltip Top Type

TypeAsNumber

Width See Also

GuiContextMenu Overview

4.17.3 Methods
4.17.3.1 DumpState Method
See Also GuiContextMenu Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

2006 SAP AG

292

SAP GUI Scripting API 6.40 Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection
Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

2006 SAP AG

Objects

293

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiContextMenu Object

4.17.3.2 FindAllByName Method


See Also GuiContextMenu Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiContextMenu Object

2006 SAP AG

294

SAP GUI Scripting API 6.40

4.17.3.3 FindAllByNameEx Method


See Also GuiContextMenu Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiContextMenu Object

4.17.3.4 FindById Method


See Also GuiContextMenu Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise

2006 SAP AG

Objects
Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

295

GuiContextMenu Object

4.17.3.5 FindByName Method


See Also GuiContextMenu Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiContextMenu Object

4.17.3.6 FindByNameEx Method


See Also GuiContextMenu Object Name Type

2006 SAP AG

296

SAP GUI Scripting API 6.40


Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiContextMenu Object

4.17.3.7 Select Method


See Also GuiContextMenu Object Description Select the context menu item. Syntax

Public Sub Select()


See Also

GuiContextMenu Object

4.17.3.8 SetFocus Method


See Also GuiContextMenu Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus

2006 SAP AG

Objects
has already been set on the respective entry. See Also

297

GuiContextMenu Object

4.17.3.9 ShowContextMenu Method


See Also GuiContextMenu Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiContextMenu Object

4.17.3.10 Visualize Method


See Also GuiContextMenu Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiContextMenu Object

2006 SAP AG

298

SAP GUI Scripting API 6.40

4.17.4 Properties
4.17.4.1 AccLabelCollection Property
See Also GuiContextMenu Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiContextMenu Object

4.17.4.2 AccText Property


See Also GuiContextMenu Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiContextMenu Object

4.17.4.3 AccTextOnRequest Property


See Also GuiContextMenu Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property AccTextOnRequest() As String


See Also

299

GuiContextMenu Object

4.17.4.4 AccTooltip Property


See Also GuiContextMenu Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiContextMenu Object

4.17.4.5 Changeable Property


See Also GuiContextMenu Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiContextMenu Object

2006 SAP AG

300

SAP GUI Scripting API 6.40

4.17.4.6 Children Property


See Also GuiContextMenu Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiContextMenu Object

4.17.4.7 ContainerType Property


See Also GuiContextMenu Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiContextMenu Object

4.17.4.8 DefaultTooltip Property


See Also GuiContextMenu Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property DefaultTooltip() As String


See Also

301

GuiContextMenu Object

4.17.4.9 Height Property


See Also GuiContextMenu Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiContextMenu Object

4.17.4.10 IconName Property


See Also GuiContextMenu Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiContextMenu Object

2006 SAP AG

302

SAP GUI Scripting API 6.40

4.17.4.11 Id Property
See Also GuiContextMenu Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiContextMenu Object

4.17.4.12 IsSymbolFont Property


See Also GuiContextMenu Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean

2006 SAP AG

Objects
See Also

303

GuiContextMenu Object

4.17.4.13 Left Property


See Also GuiContextMenu Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiContextMenu Object

4.17.4.14 Modified Property


See Also GuiContextMenu Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiContextMenu Object

4.17.4.15 Name Property


See Also GuiContextMenu Object Description The name property is especially useful when working with simple scripts that only access dynpro fields.

2006 SAP AG

304

SAP GUI Scripting API 6.40


In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiContextMenu Object

4.17.4.16 Parent Property


See Also GuiContextMenu Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiContextMenu Object

4.17.4.17 ParentFrame Property


See Also GuiContextMenu Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiContextMenu Object

2006 SAP AG

Objects 4.17.4.18 ScreenLeft Property


See Also GuiContextMenu Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

305

Public Property ScreenLeft() As Long


See Also

GuiContextMenu Object

4.17.4.19 ScreenTop Property


See Also GuiContextMenu Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiContextMenu Object

4.17.4.20 Text Property


See Also GuiContextMenu Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

2006 SAP AG

306

SAP GUI Scripting API 6.40 Public Property Text() As String


See Also

GuiContextMenu Object

4.17.4.21 Tooltip Property


See Also GuiContextMenu Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiContextMenu Object

4.17.4.22 Top Property


See Also GuiContextMenu Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiContextMenu Object

2006 SAP AG

Objects 4.17.4.23 Type Property


See Also GuiContextMenu Object Description

307

The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiContextMenu Object

4.17.4.24 TypeAsNumber Property


See Also GuiContextMenu Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiContextMenu Object

4.17.4.25 Width Property


See Also GuiContextMenu Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

308

SAP GUI Scripting API 6.40 Public Property Width() As Long


See Also

GuiContextMenu Object

4.18

GuiCTextField Object
See Also GuiCTextField Members 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 GuiTextField. The type prefix is ctxt, the name is the Fieldname taken from the SAP data dictionary. For a list of all members defined in this module, see GuiCTextField members. Object Model

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. See Also

GuiCTextField Members

2006 SAP AG

Objects

309

4.18.1 Overview
See Also GuiCTextField Members 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 GuiTextField. The type prefix is ctxt, the name is the Fieldname taken from the SAP data dictionary. For a list of all members defined in this module, see GuiCTextField members. Object Model

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. See Also

GuiCTextField Members

4.18.2 Members
See Also GuiCTextField Overview Public Methods

2006 SAP AG

310

SAP GUI Scripting API 6.40


This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

DumpState

SetFocus

ShowContextMenu Visualize

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip CaretPosition Changeable CharHeight CharLeft CharTop CharWidth ContainerType DefaultTooltip DisplayedText The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. Position of the text caret in the input field. An object is changeable if it is neither disabled nor read-only. Height of the dynpro element in character metric. Left coordinate of the dynpro element in character metric. Top coordinate of the dynpro element in character metric. Width of the dynpro element in character metric. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. This property contains the text as it is displayed on the screen, including preceding or trailing blanks. These blanks are stripped from the text property. Height of the component in pixels. This property is True if the Highlighted flag is set in the screen painter for the dynpro element. Text of the currently focussed entry in the history list box. Currently focussed index in the history dropdown list box. This property is True if the local input field history drop down is currently open.

Height Highlighted HistoryCurEntry HistoryCurIndex HistoryIsActive

2006 SAP AG

Objects
List of entries in the local history list box.

311

HistoryList IconName Id

IsHotspot

IsLeftLabel IsOField

If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Dynpro elements such as labels may be configured to cause a round trip when they are clicked. In that case the mouse cursor changes to the hand shape. This is called a hot spot. This property is True if the component has the 'assign left' flag. OField is a special ABAP dynpro element, the Output Field. These fields can be set programmatically to a value at runtime. In this respect they differ from labels. However they can not be used to enter data, so they are not input fields. This property is True if the component has the 'assign right' flag. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates Left label of the component. The label is assigned in the screenpainter, using the flag 'assign left'. Maximum length of the input field in number of characters. An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. This property is True if the component is an input field that only accepts numeric characters. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. This property is True if the component is a required value for the screen. Right label of the component. This property is set in screenpainter using the 'assign right' flag. The y position of the component in screen coordinates. The x position of the component in screen coordinates. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation.

IsRightLabel IsSymbolFont Left LeftLabel MaxLength Modified Name

Numerical Parent ParentFrame Required RightLabel ScreenLeft ScreenTop Text

Tooltip Top Type

2006 SAP AG

312

SAP GUI Scripting API 6.40


While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

TypeAsNumber

Width See Also

GuiCTextField Overview

4.18.3 Methods
4.18.3.1 DumpState Method
See Also GuiCTextField Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value.

2006 SAP AG

Objects -

313

GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiCTextField Object

2006 SAP AG

314

SAP GUI Scripting API 6.40

4.18.3.2 SetFocus Method


See Also GuiCTextField Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiCTextField Object

4.18.3.3 ShowContextMenu Method


See Also GuiCTextField Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiCTextField Object

4.18.3.4 Visualize Method


See Also GuiCTextField Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

2006 SAP AG

Objects
Syntax

315

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiCTextField Object

4.18.4 Properties
4.18.4.1 AccLabelCollection Property
See Also GuiCTextField Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiCTextField Object

4.18.4.2 AccText Property


See Also GuiCTextField Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String

2006 SAP AG

316

SAP GUI Scripting API 6.40


See Also

GuiCTextField Object

4.18.4.3 AccTextOnRequest Property


See Also GuiCTextField Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiCTextField Object

4.18.4.4 AccTooltip Property


See Also GuiCTextField Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiCTextField Object

4.18.4.5 CaretPosition Property


See Also GuiCTextField Object Description Position of the text caret in the input field.

2006 SAP AG

Objects
Property type Read-write property Syntax (Visual Basic)

317

Public Property CaretPosition() As Long


See Also

GuiCTextField Object

4.18.4.6 Changeable Property


See Also GuiCTextField Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiCTextField Object

4.18.4.7 CharHeight Property


See Also GuiCTextField Object Description Height of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharHeight() As Long


See Also

GuiCTextField Object

2006 SAP AG

318

SAP GUI Scripting API 6.40

4.18.4.8 CharLeft Property


See Also GuiCTextField Object Description Left coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharLeft() As Long


See Also

GuiCTextField Object

4.18.4.9 CharTop Property


See Also GuiCTextField Object Description Top coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharTop() As Long


See Also

GuiCTextField Object

4.18.4.10 CharWidth Property


See Also GuiCTextField Object Description Width of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharWidth() As Long

2006 SAP AG

Objects
See Also

319

GuiCTextField Object

4.18.4.11 ContainerType Property


See Also GuiCTextField Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiCTextField Object

4.18.4.12 DefaultTooltip Property


See Also GuiCTextField Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiCTextField Object

4.18.4.13 DisplayedText Property


See Also GuiCTextField Object Description This property contains the text as it is displayed on the screen, including preceding or trailing blanks.

2006 SAP AG

320

SAP GUI Scripting API 6.40


These blanks are stripped from the text property. Property type Read-only property Syntax (Visual Basic)

Public Property DisplayedText() As String


See Also

GuiCTextField Object

4.18.4.14 Height Property


See Also GuiCTextField Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiCTextField Object

4.18.4.15 Highlighted Property


See Also GuiCTextField Object Description This property is True if the Highlighted flag is set in the screen painter for the dynpro element. Property type Read-only property Syntax (Visual Basic)

Public Property Highlighted() As Boolean


See Also

GuiCTextField Object

2006 SAP AG

Objects 4.18.4.16 HistoryCurEntry Property


See Also GuiCTextField Object Description Text of the currently focussed entry in the history list box. Property type Read-only property Syntax (Visual Basic)

321

Public Property HistoryCurEntry() As String


See Also

GuiCTextField Object

4.18.4.17 HistoryCurIndex Property


See Also GuiCTextField Object Description Currently focussed index in the history dropdown list box. Property type Read-only property Syntax (Visual Basic)

Public Property HistoryCurIndex() As Long


See Also

GuiCTextField Object

4.18.4.18 HistoryIsActive Property


See Also GuiCTextField Object Description This property is True if the local input field history drop down is currently open. Property type Read-only property Syntax (Visual Basic)

Public Property HistoryIsActive() As Boolean

2006 SAP AG

322

SAP GUI Scripting API 6.40


See Also

GuiCTextField Object

4.18.4.19 HistoryList Property


See Also GuiCTextField Object Description List of entries in the local history list box. Property type Read-only property Syntax (Visual Basic)

Public Property HistoryList() As GuiCollection


See Also

GuiCTextField Object

4.18.4.20 IconName Property


See Also GuiCTextField Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiCTextField Object

4.18.4.21 Id Property
See Also GuiCTextField Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at

2006 SAP AG

Objects
the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

323

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiCTextField Object

4.18.4.22 IsHotspot Property


See Also GuiCTextField Object Description Dynpro elements such as labels may be configured to cause a round trip when they are clicked. In that case the mouse cursor changes to the hand shape. This is called a hot spot. Property type Read-only property Syntax (Visual Basic)

Public Property IsHotspot() As Boolean


See Also

GuiCTextField Object

2006 SAP AG

324

SAP GUI Scripting API 6.40

4.18.4.23 IsLeftLabel Property


See Also GuiCTextField Object Description This property is True if the component has the 'assign left' flag. Property type Read-only property Syntax (Visual Basic)

Public Property IsLeftLabel() As Boolean


See Also

GuiCTextField Object

4.18.4.24 IsOField Property


See Also GuiCTextField Object Description OField is a special ABAP dynpro element, the Output Field. These fields can be set programmatically to a value at runtime. In this respect they differ from labels. However they can not be used to enter data, so they are not input fields. Property type Read-only property Syntax (Visual Basic)

Public Property IsOField() As Boolean


See Also

GuiCTextField Object

4.18.4.25 IsRightLabel Property


See Also GuiCTextField Object Description This property is True if the component has the 'assign right' flag. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property IsRightLabel() As Boolean


See Also

325

GuiCTextField Object

4.18.4.26 IsSymbolFont Property


See Also GuiCTextField Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiCTextField Object

4.18.4.27 Left Property


See Also GuiCTextField Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiCTextField Object

2006 SAP AG

326

SAP GUI Scripting API 6.40

4.18.4.28 LeftLabel Property


See Also GuiCTextField Object Description Left label of the component. The label is assigned in the screenpainter, using the flag 'assign left'. Property type Read-only property Syntax (Visual Basic)

Public Property LeftLabel() As GuiVComponent


See Also

GuiCTextField Object

4.18.4.29 MaxLength Property


See Also GuiCTextField Object Description Maximum length of the input field in number of characters. Property type Read-only property Syntax (Visual Basic)

Public Property MaxLength() As Long


See Also

GuiCTextField Object

4.18.4.30 Modified Property


See Also GuiCTextField Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Modified() As Boolean


See Also

327

GuiCTextField Object

4.18.4.31 Name Property


See Also GuiCTextField Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiCTextField Object

4.18.4.32 Numerical Property


See Also GuiCTextField Object Description This property is True if the component is an input field that only accepts numeric characters. Property type Read-only property Syntax (Visual Basic)

Public Property Numerical() As Boolean


See Also

GuiCTextField Object

2006 SAP AG

328

SAP GUI Scripting API 6.40

4.18.4.33 Parent Property


See Also GuiCTextField Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiCTextField Object

4.18.4.34 ParentFrame Property


See Also GuiCTextField Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiCTextField Object

4.18.4.35 Required Property


See Also GuiCTextField Object Description This property is True if the component is a required value for the screen. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Required() As Boolean


See Also

329

GuiCTextField Object

4.18.4.36 RightLabel Property


See Also GuiCTextField Object Description Right label of the component. This property is set in screenpainter using the 'assign right' flag. Property type Read-only property Syntax (Visual Basic)

Public Property RightLabel() As GuiVComponent


See Also

GuiCTextField Object

4.18.4.37 ScreenLeft Property


See Also GuiCTextField Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiCTextField Object

2006 SAP AG

330

SAP GUI Scripting API 6.40

4.18.4.38 ScreenTop Property


See Also GuiCTextField Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiCTextField Object

4.18.4.39 Text Property


See Also GuiCTextField Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiCTextField Object

4.18.4.40 Tooltip Property


See Also GuiCTextField Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

331

Public Property Tooltip() As String


See Also

GuiCTextField Object

4.18.4.41 Top Property


See Also GuiCTextField Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiCTextField Object

4.18.4.42 Type Property


See Also GuiCTextField Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiCTextField Object

2006 SAP AG

332

SAP GUI Scripting API 6.40

4.18.4.43 TypeAsNumber Property


See Also GuiCTextField Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiCTextField Object

4.18.4.44 Width Property


See Also GuiCTextField Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiCTextField Object

4.19

GuiCustomControl Object
See Also GuiCustomControl Members 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 GuiVContainer. The type prefix is cntl, the name is the fieldname taken from the SAP data dictionary. For a list of all members defined in this module, see GuiCustomControl members.

2006 SAP AG

Objects
Object Model

333

See Also

GuiCustomControl Members

4.19.1 Overview
See Also GuiCustomControl Members 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 GuiVContainer. The type prefix is cntl, the name is the fieldname taken from the SAP data dictionary. For a list of all members defined in this module, see GuiCustomControl members. Object Model

2006 SAP AG

334

SAP GUI Scripting API 6.40

See Also

GuiCustomControl Members

4.19.2 Members
See Also GuiCustomControl Overview Public Methods DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used.

FindAllByName

FindAllByNameEx

2006 SAP AG

Objects

335

FindById

FindByName

FindByNameEx

SetFocus

ShowContextMenu Visualize

Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable CharHeight CharLeft CharTop CharWidth Children ContainerType DefaultTooltip Height IconName Id The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. Height of the dynpro element in character metric. Left coordinate of the dynpro element in character metric. Top coordinate of the dynpro element in character metric. Width of the dynpro element in character metric. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font.

IsSymbolFont

2006 SAP AG

336

SAP GUI Scripting API 6.40


Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

Left Modified Name

Parent ParentFrame ScreenLeft ScreenTop Text

Tooltip Top Type

TypeAsNumber

Width See Also

GuiCustomControl Overview

4.19.3 Methods
4.19.3.1 DumpState Method
See Also GuiCustomControl Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those

2006 SAP AG

Objects
components that support it. Syntax

337

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue

2006 SAP AG

338

SAP GUI Scripting API 6.40 MR GetItemValue 3 2 MyText

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiCustomControl Object

4.19.3.2 FindAllByName Method


See Also GuiCustomControl Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

2006 SAP AG

Objects

339

GuiCustomControl Object

4.19.3.3 FindAllByNameEx Method


See Also GuiCustomControl Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiCustomControl Object

4.19.3.4 FindById Method


See Also GuiCustomControl Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _

2006 SAP AG

340

SAP GUI Scripting API 6.40 ) As GuiComponent


Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiCustomControl Object

4.19.3.5 FindByName Method


See Also GuiCustomControl Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiCustomControl Object

2006 SAP AG

Objects 4.19.3.6 FindByNameEx Method


See Also GuiCustomControl Object Name Type Description

341

This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiCustomControl Object

4.19.3.7 SetFocus Method


See Also GuiCustomControl Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiCustomControl Object

2006 SAP AG

342

SAP GUI Scripting API 6.40

4.19.3.8 ShowContextMenu Method


See Also GuiCustomControl Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiCustomControl Object

4.19.3.9 Visualize Method


See Also GuiCustomControl Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiCustomControl Object

2006 SAP AG

Objects

343

4.19.4 Properties
4.19.4.1 AccLabelCollection Property
See Also GuiCustomControl Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiCustomControl Object

4.19.4.2 AccText Property


See Also GuiCustomControl Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiCustomControl Object

4.19.4.3 AccTextOnRequest Property


See Also GuiCustomControl Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

344

SAP GUI Scripting API 6.40 Public Property AccTextOnRequest() As String


See Also

GuiCustomControl Object

4.19.4.4 AccTooltip Property


See Also GuiCustomControl Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiCustomControl Object

4.19.4.5 Changeable Property


See Also GuiCustomControl Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiCustomControl Object

2006 SAP AG

Objects 4.19.4.6 CharHeight Property


See Also GuiCustomControl Object Description Height of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

345

Public Property CharHeight() As Long


See Also

GuiCustomControl Object

4.19.4.7 CharLeft Property


See Also GuiCustomControl Object Description Left coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharLeft() As Long


See Also

GuiCustomControl Object

4.19.4.8 CharTop Property


See Also GuiCustomControl Object Description Top coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharTop() As Long

2006 SAP AG

346

SAP GUI Scripting API 6.40


See Also

GuiCustomControl Object

4.19.4.9 CharWidth Property


See Also GuiCustomControl Object Description Width of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharWidth() As Long


See Also

GuiCustomControl Object

4.19.4.10 Children Property


See Also GuiCustomControl Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiCustomControl Object

4.19.4.11 ContainerType Property


See Also GuiCustomControl Object Description This property is TRUE, if the object is a container and therefore has the children property.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

347

Public Property ContainerType() As Boolean


See Also

GuiCustomControl Object

4.19.4.12 DefaultTooltip Property


See Also GuiCustomControl Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiCustomControl Object

4.19.4.13 Height Property


See Also GuiCustomControl Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiCustomControl Object

2006 SAP AG

348

SAP GUI Scripting API 6.40

4.19.4.14 IconName Property


See Also GuiCustomControl Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiCustomControl Object

4.19.4.15 Id Property
See Also GuiCustomControl Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well.

2006 SAP AG

Objects
See Also

349

GuiCustomControl Object

4.19.4.16 IsSymbolFont Property


See Also GuiCustomControl Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiCustomControl Object

4.19.4.17 Left Property


See Also GuiCustomControl Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiCustomControl Object

4.19.4.18 Modified Property


See Also GuiCustomControl Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system.

2006 SAP AG

350

SAP GUI Scripting API 6.40


Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiCustomControl Object

4.19.4.19 Name Property


See Also GuiCustomControl Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiCustomControl Object

4.19.4.20 Parent Property


See Also GuiCustomControl Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiCustomControl Object

2006 SAP AG

Objects 4.19.4.21 ParentFrame Property


See Also GuiCustomControl Object Description

351

If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiCustomControl Object

4.19.4.22 ScreenLeft Property


See Also GuiCustomControl Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiCustomControl Object

4.19.4.23 ScreenTop Property


See Also GuiCustomControl Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long

2006 SAP AG

352

SAP GUI Scripting API 6.40


See Also

GuiCustomControl Object

4.19.4.24 Text Property


See Also GuiCustomControl Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiCustomControl Object

4.19.4.25 Tooltip Property


See Also GuiCustomControl Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiCustomControl Object

2006 SAP AG

Objects 4.19.4.26 Top Property


See Also GuiCustomControl Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

353

Public Property Top() As Long


See Also

GuiCustomControl Object

4.19.4.27 Type Property


See Also GuiCustomControl Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiCustomControl Object

4.19.4.28 TypeAsNumber Property


See Also GuiCustomControl Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

354

SAP GUI Scripting API 6.40 Public Property TypeAsNumber() As Long


See Also

GuiCustomControl Object

4.19.4.29 Width Property


See Also GuiCustomControl Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiCustomControl Object

4.20

GuiDialogShell Object
See Also GuiDialogShell Members Description The GuiDialogShell is an external window that is used as a container for other shells, for example a toolbar. GuiDialogShell extends GuiVContainer. The type prefix is shellcont, the name is the last part of the id, shellcont[n]. For a list of all members defined in this module, see GuiDialogShell members. Object Model

2006 SAP AG

Objects

355

Example

See Also

GuiDialogShell Members

4.20.1 Overview
See Also GuiDialogShell Members Description The GuiDialogShell is an external window that is used as a container for other shells, for example a toolbar. GuiDialogShell extends GuiVContainer. The type prefix is shellcont, the name is the last part of the id, shellcont[n]. For a list of all members defined in this module, see GuiDialogShell members. Object Model

2006 SAP AG

356

SAP GUI Scripting API 6.40

Example

See Also

GuiDialogShell Members

4.20.2 Members
See Also GuiDialogShell Overview Public Methods Close DumpState This method closes the external window. This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it.

2006 SAP AG

Objects

357

FindAllByName

FindAllByNameEx

FindById

FindByName

FindByNameEx

SetFocus

ShowContextMenu Visualize

The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children ContainerType DefaultTooltip Height IconName Id The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object.

2006 SAP AG

358

SAP GUI Scripting API 6.40


The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Title of the dialog. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

IsSymbolFont Left Modified Name

Parent ParentFrame ScreenLeft ScreenTop Text

Title Tooltip Top Type

TypeAsNumber

Width See Also

GuiDialogShell Overview

4.20.3 Methods
4.20.3.1 Close Method
See Also GuiDialogShell Object Description This method closes the external window. Syntax

2006 SAP AG

Objects Public Sub Close()


See Also

359

GuiDialogShell Object

4.20.3.2 DumpState Method


See Also GuiDialogShell Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

2006 SAP AG

360

SAP GUI Scripting API 6.40 For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiDialogShell Object

2006 SAP AG

Objects 4.20.3.3 FindAllByName Method


See Also GuiDialogShell Object Name Type Description

361

The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiDialogShell Object

4.20.3.4 FindAllByNameEx Method


See Also GuiDialogShell Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type

2006 SAP AG

362

SAP GUI Scripting API 6.40


See Also

GuiDialogShell Object

4.20.3.5 FindById Method


See Also GuiDialogShell Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiDialogShell Object

4.20.3.6 FindByName Method


See Also GuiDialogShell Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not

2006 SAP AG

Objects

363

have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiDialogShell Object

4.20.3.7 FindByNameEx Method


See Also GuiDialogShell Object Name Type Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiDialogShell Object

2006 SAP AG

364

SAP GUI Scripting API 6.40

4.20.3.8 SetFocus Method


See Also GuiDialogShell Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiDialogShell Object

4.20.3.9 ShowContextMenu Method


See Also GuiDialogShell Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiDialogShell Object

4.20.3.10 Visualize Method


See Also GuiDialogShell Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

2006 SAP AG

Objects
Syntax

365

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiDialogShell Object

4.20.4 Properties
4.20.4.1 AccLabelCollection Property
See Also GuiDialogShell Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiDialogShell Object

4.20.4.2 AccText Property


See Also GuiDialogShell Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String

2006 SAP AG

366

SAP GUI Scripting API 6.40


See Also

GuiDialogShell Object

4.20.4.3 AccTextOnRequest Property


See Also GuiDialogShell Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiDialogShell Object

4.20.4.4 AccTooltip Property


See Also GuiDialogShell Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiDialogShell Object

4.20.4.5 Changeable Property


See Also GuiDialogShell Object Description An object is changeable if it is neither disabled nor read-only.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

367

Public Property Changeable() As Boolean


See Also

GuiDialogShell Object

4.20.4.6 Children Property


See Also GuiDialogShell Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiDialogShell Object

4.20.4.7 ContainerType Property


See Also GuiDialogShell Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiDialogShell Object

2006 SAP AG

368

SAP GUI Scripting API 6.40

4.20.4.8 DefaultTooltip Property


See Also GuiDialogShell Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiDialogShell Object

4.20.4.9 Height Property


See Also GuiDialogShell Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiDialogShell Object

4.20.4.10 IconName Property


See Also GuiDialogShell Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property IconName() As String


See Also

369

GuiDialogShell Object

4.20.4.11 Id Property
See Also GuiDialogShell Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiDialogShell Object

4.20.4.12 IsSymbolFont Property


See Also GuiDialogShell Object Description

2006 SAP AG

370

SAP GUI Scripting API 6.40


The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiDialogShell Object

4.20.4.13 Left Property


See Also GuiDialogShell Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiDialogShell Object

4.20.4.14 Modified Property


See Also GuiDialogShell Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiDialogShell Object

2006 SAP AG

Objects 4.20.4.15 Name Property


See Also GuiDialogShell Object Description

371

The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiDialogShell Object

4.20.4.16 Parent Property


See Also GuiDialogShell Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiDialogShell Object

4.20.4.17 ParentFrame Property


See Also GuiDialogShell Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property

2006 SAP AG

372

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiDialogShell Object

4.20.4.18 ScreenLeft Property


See Also GuiDialogShell Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiDialogShell Object

4.20.4.19 ScreenTop Property


See Also GuiDialogShell Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiDialogShell Object

2006 SAP AG

Objects 4.20.4.20 Text Property


See Also GuiDialogShell Object Description

373

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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiDialogShell Object

4.20.4.21 Title Property


See Also GuiDialogShell Object Description Title of the dialog. Property type Read-only property Syntax (Visual Basic)

Public Property Title() As String


See Also

GuiDialogShell Object

4.20.4.22 Tooltip Property


See Also GuiDialogShell Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property

2006 SAP AG

374

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiDialogShell Object

4.20.4.23 Top Property


See Also GuiDialogShell Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiDialogShell Object

4.20.4.24 Type Property


See Also GuiDialogShell Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiDialogShell Object

2006 SAP AG

Objects 4.20.4.25 TypeAsNumber Property


See Also GuiDialogShell Object Description

375

While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiDialogShell Object

4.20.4.26 Width Property


See Also GuiDialogShell Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiDialogShell Object

4.21

GuiEAIViewer2D Object
See Also GuiEAIViewer2D Members Description The GuiEAIViewer2D control is used to view 2-dimensional graphic images in the SAP system. Presently Webviewer2D supports 22 available image types. The user can carry out redlining over the loaded image. The scripting wrapper for this control records all user actions during the redlining process and reproduces the same actions when the recorded script is replayed. GuiEAIViewer2D extends GuiShell. For a list of all members defined in this module, see GuiEAIViewer2D members.

2006 SAP AG

376

SAP GUI Scripting API 6.40


Object Model

Example

2006 SAP AG

Objects

377

See Also

GuiEAIViewer2D Members

4.21.1 Overview
See Also GuiEAIViewer2D Members Description The GuiEAIViewer2D control is used to view 2-dimensional graphic images in the SAP system. Presently Webviewer2D supports 22 available image types. The user can carry out redlining over the loaded image. The scripting wrapper for this control records all user actions during the redlining process and reproduces the same actions when the recorded script is replayed. GuiEAIViewer2D extends GuiShell. For a list of all members defined in this module, see GuiEAIViewer2D members. Object Model

2006 SAP AG

378

SAP GUI Scripting API 6.40

Example

2006 SAP AG

Objects

379

See Also

GuiEAIViewer2D Members

4.21.2 Members
See Also GuiEAIViewer2D Overview Public Methods annotationTextRequest DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it.

2006 SAP AG

380

SAP GUI Scripting API 6.40


The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Select an item from the controls context menu.

FindAllByName

FindAllByNameEx

FindById

FindByName

FindByNameEx

SelectContextMenuItem

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item SelectContextMenuItemByPo text. sition Select a menu item of a context menu using the text of the item and possible higher level menus. SelectContextMenuItemByTe xt This function can be used to set the focus onto an object. If a user SetFocus interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. ShowContextMenu Calling this method of a component will display a red frame around Visualize the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Public Properties AccDescription AccLabelCollection AccText AccTextOnRequest AccTooltip AnnotationEnabled Accessibility description of the shell. This description can be used for shells that do not have a title element. The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. The value of this property is set to 1 when redlining is started. The wrapper control starts recording user actions as soon as this property is set to value 1.

2006 SAP AG

Objects
During redlining, the selected redlining mode is stored in this property. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object.

381

AnnotationMode Changeable Children ContainerType CurrentContextMenu DefaultTooltip DragDropSupported Handle Height IconName Id

This property is TRUE, if the object is a container and therefore has the children property. This property is only set when a context menu is available at the shell object. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. This property is True if the shell allows drag and drop operations. The window handle of the control that is connected to the GuiShell. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. This property stores the redlining layer as BLOB (Binary large data object). During recording, the whole BLOB is copied into the generated script. The y position of the component in screen coordinates. The x position of the component in screen coordinates. Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value EAI2D. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates.

IsSymbolFont Left Modified Name

OcxEvents Parent ParentFrame RedliningStream

ScreenLeft ScreenTop SubType

Text

Tooltip Top

2006 SAP AG

382

SAP GUI Scripting API 6.40


The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

Type

TypeAsNumber

Width See Also

GuiEAIViewer2D Overview

4.21.3 Methods
4.21.3.1 annotationTextRequest Method
See Also GuiEAIViewer2D Object strText Syntax

Public Sub annotationTextRequest( _ ByVal strText As String _ )


Parameters strText See Also

GuiEAIViewer2D Object

4.21.3.2 DumpState Method


See Also GuiEAIViewer2D Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it.

2006 SAP AG

Objects
Syntax

383

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

2006 SAP AG

384

SAP GUI Scripting API 6.40

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiEAIViewer2D Object

4.21.3.3 FindAllByName Method


See Also GuiEAIViewer2D Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

2006 SAP AG

Objects
GuiEAIViewer2D Object

385

4.21.3.4 FindAllByNameEx Method


See Also GuiEAIViewer2D Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiEAIViewer2D Object

4.21.3.5 FindById Method


See Also GuiEAIViewer2D Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent

2006 SAP AG

386

SAP GUI Scripting API 6.40


Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiEAIViewer2D Object

4.21.3.6 FindByName Method


See Also GuiEAIViewer2D Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiEAIViewer2D Object

4.21.3.7 FindByNameEx Method


See Also GuiEAIViewer2D Object Name

2006 SAP AG

Objects

387

Type Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiEAIViewer2D Object

4.21.3.8 SelectContextMenuItem Method


See Also GuiEAIViewer2D Object FunctionCode Description Select an item from the controls context menu. Syntax

Public Sub SelectContextMenuItem( _ ByVal FunctionCode As String _ )


Parameters FunctionCode See Also

GuiEAIViewer2D Object

4.21.3.9 SelectContextMenuItemByPosition Method


See Also GuiEAIViewer2D Object PositionDesc

2006 SAP AG

388

SAP GUI Scripting API 6.40


Description This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item text. Syntax

Public Sub SelectContextMenuItemByPosition( _ ByVal PositionDesc As String _ )


Parameters PositionDesc Remarks The parameter is a string containing the path to the item. If the context menu item is on the top level menu, this is just the zero-base index of the item. Otherwise, the positions on the menu and respective submenus should be concatenated, separated by "|". See Also

GuiEAIViewer2D Object

4.21.3.10 SelectContextMenuItemByText Method


See Also GuiEAIViewer2D Object Text Description Select a menu item of a context menu using the text of the item and possible higher level menus. Syntax

Public Sub SelectContextMenuItemByText( _ ByVal Text As String _ )


Parameters Text See Also

GuiEAIViewer2D Object

4.21.3.11 SetFocus Method


See Also GuiEAIViewer2D Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever the interaction is with a new object. Interacting with an object through the scripting

2006 SAP AG

Objects

389

component does not change the focus. There are some cases in which the SAP application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiEAIViewer2D Object

4.21.3.12 ShowContextMenu Method


See Also GuiEAIViewer2D Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiEAIViewer2D Object

4.21.3.13 Visualize Method


See Also GuiEAIViewer2D Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters

2006 SAP AG

390

SAP GUI Scripting API 6.40


On InnerObject See Also

GuiEAIViewer2D Object

4.21.4 Properties
4.21.4.1 AccDescription Property
See Also GuiEAIViewer2D Object Description Accessibility description of the shell. This description can be used for shells that do not have a title element. Property type Read-only property Syntax (Visual Basic)

Public Property AccDescription() As String


See Also

GuiEAIViewer2D Object

4.21.4.2 AccLabelCollection Property


See Also GuiEAIViewer2D Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiEAIViewer2D Object

2006 SAP AG

Objects 4.21.4.3 AccText Property


See Also GuiEAIViewer2D Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

391

Public Property AccText() As String


See Also

GuiEAIViewer2D Object

4.21.4.4 AccTextOnRequest Property


See Also GuiEAIViewer2D Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiEAIViewer2D Object

4.21.4.5 AccTooltip Property


See Also GuiEAIViewer2D Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String

2006 SAP AG

392

SAP GUI Scripting API 6.40


See Also

GuiEAIViewer2D Object

4.21.4.6 AnnotationEnabled Property


See Also GuiEAIViewer2D Object Description The value of this property is set to 1 when redlining is started. The wrapper control starts recording user actions as soon as this property is set to value 1. Property type Read-write property Syntax (Visual Basic)

Public Property AnnotationEnabled() As Long


Example The following screen shot shows how to start redlining:

2006 SAP AG

Objects
See Also

393

GuiEAIViewer2D Object

4.21.4.7 AnnotationMode Property


See Also GuiEAIViewer2D Object Description During redlining, the selected redlining mode is stored in this property. Property type Read-write property Syntax (Visual Basic)

Public Property AnnotationMode() As Integer


See Also

GuiEAIViewer2D Object

4.21.4.8 Changeable Property


See Also GuiEAIViewer2D Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiEAIViewer2D Object

4.21.4.9 Children Property


See Also GuiEAIViewer2D Object Description This collection contains all direct children of the object.

2006 SAP AG

394

SAP GUI Scripting API 6.40


Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiEAIViewer2D Object

4.21.4.10 ContainerType Property


See Also GuiEAIViewer2D Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiEAIViewer2D Object

4.21.4.11 CurrentContextMenu Property


See Also GuiEAIViewer2D Object Description This property is only set when a context menu is available at the shell object. Property type Read-only property Syntax (Visual Basic)

Public Property CurrentContextMenu() As GuiContextMenu


See Also

GuiEAIViewer2D Object

2006 SAP AG

Objects 4.21.4.12 DefaultTooltip Property


See Also GuiEAIViewer2D Object Description

395

Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiEAIViewer2D Object

4.21.4.13 DragDropSupported Property


See Also GuiEAIViewer2D Object Description This property is True if the shell allows drag and drop operations. Property type Read-only property Syntax (Visual Basic)

Public Property DragDropSupported() As Boolean


See Also

GuiEAIViewer2D Object

4.21.4.14 Handle Property


See Also GuiEAIViewer2D Object Description The window handle of the control that is connected to the GuiShell. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

396

SAP GUI Scripting API 6.40 Public Property Handle() As Long


See Also

GuiEAIViewer2D Object

4.21.4.15 Height Property


See Also GuiEAIViewer2D Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiEAIViewer2D Object

4.21.4.16 IconName Property


See Also GuiEAIViewer2D Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiEAIViewer2D Object

2006 SAP AG

Objects 4.21.4.17 Id Property


See Also GuiEAIViewer2D Object Description

397

An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiEAIViewer2D Object

4.21.4.18 IsSymbolFont Property


See Also GuiEAIViewer2D Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean

2006 SAP AG

398

SAP GUI Scripting API 6.40


See Also

GuiEAIViewer2D Object

4.21.4.19 Left Property


See Also GuiEAIViewer2D Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiEAIViewer2D Object

4.21.4.20 Modified Property


See Also GuiEAIViewer2D Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiEAIViewer2D Object

4.21.4.21 Name Property


See Also GuiEAIViewer2D Object Description The name property is especially useful when working with simple scripts that only access dynpro fields.

2006 SAP AG

Objects

399

In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiEAIViewer2D Object

4.21.4.22 OcxEvents Property


See Also GuiEAIViewer2D Object Description Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. Property type Read-only property Syntax (Visual Basic)

Public Property OcxEvents() As GuiCollection


See Also

GuiEAIViewer2D Object

4.21.4.23 Parent Property


See Also GuiEAIViewer2D Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

2006 SAP AG

400

SAP GUI Scripting API 6.40


GuiEAIViewer2D Object

4.21.4.24 ParentFrame Property


See Also GuiEAIViewer2D Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiEAIViewer2D Object

4.21.4.25 RedliningStream Property


See Also GuiEAIViewer2D Object Description This property stores the redlining layer as BLOB (Binary large data object). During recording, the whole BLOB is copied into the generated script. Property type Read-write property Syntax (Visual Basic)

Public Property RedliningStream() As String


See Also

GuiEAIViewer2D Object

4.21.4.26 ScreenLeft Property


See Also GuiEAIViewer2D Object Description The y position of the component in screen coordinates. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

401

Public Property ScreenLeft() As Long


See Also

GuiEAIViewer2D Object

4.21.4.27 ScreenTop Property


See Also GuiEAIViewer2D Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiEAIViewer2D Object

4.21.4.28 SubType Property


See Also GuiEAIViewer2D Object Description Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value EAI2D. Property type Read-only property Syntax (Visual Basic)

Public Property SubType() As String


See Also

GuiEAIViewer2D Object

2006 SAP AG

402

SAP GUI Scripting API 6.40

4.21.4.29 Text Property


See Also GuiEAIViewer2D Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiEAIViewer2D Object

4.21.4.30 Tooltip Property


See Also GuiEAIViewer2D Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiEAIViewer2D Object

4.21.4.31 Top Property


See Also GuiEAIViewer2D Object Description Top coordinate of the element in screen coordinates. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

403

Public Property Top() As Long


See Also

GuiEAIViewer2D Object

4.21.4.32 Type Property


See Also GuiEAIViewer2D Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiEAIViewer2D Object

4.21.4.33 TypeAsNumber Property


See Also GuiEAIViewer2D Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiEAIViewer2D Object

2006 SAP AG

404

SAP GUI Scripting API 6.40

4.21.4.34 Width Property


See Also GuiEAIViewer2D Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiEAIViewer2D Object

4.22

GuiEAIViewer3D Object
See Also GuiEAIViewer3D Members For a list of all members defined in this module, see GuiEAIViewer3D members. Object Model

2006 SAP AG

Objects

405

See Also

GuiEAIViewer3D Members

4.22.1 Overview
See Also GuiEAIViewer3D Members For a list of all members defined in this module, see GuiEAIViewer3D members. Object Model

2006 SAP AG

406

SAP GUI Scripting API 6.40

See Also

GuiEAIViewer3D Members

4.22.2 Members
See Also GuiEAIViewer3D Overview Public Methods DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used.

FindAllByName

2006 SAP AG

Objects

407

FindAllByNameEx

FindById

FindByName

FindByNameEx

SelectContextMenuItem

The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Select an item from the controls context menu.

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item SelectContextMenuItemByPo text. sition Select a menu item of a context menu using the text of the item and possible higher level menus. SelectContextMenuItemByTe xt This function can be used to set the focus onto an object. If a user SetFocus interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. ShowContextMenu Calling this method of a component will display a red frame around Visualize the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Public Properties AccDescription AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children ContainerType CurrentContextMenu Accessibility description of the shell. This description can be used for shells that do not have a title element. The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. This property is only set when a context menu is available at the shell object.

2006 SAP AG

408

SAP GUI Scripting API 6.40


Tooltip text generated from the short text defined in the data dictionary for the given screen element type. This property is True if the shell allows drag and drop operations. The window handle of the control that is connected to the GuiShell. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

DefaultTooltip DragDropSupported Handle Height IconName Id

IsSymbolFont Left Modified Name

OcxEvents Parent ParentFrame ScreenLeft ScreenTop SubType Text

Tooltip Top Type

TypeAsNumber

Width See Also

GuiEAIViewer3D Overview

2006 SAP AG

Objects

409

4.22.3 Methods
4.22.3.1 DumpState Method
See Also GuiEAIViewer3D Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection:

2006 SAP AG

410

SAP GUI Scripting API 6.40 First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiEAIViewer3D Object

4.22.3.2 FindAllByName Method


See Also GuiEAIViewer3D Object Name Type Description

2006 SAP AG

Objects

411

The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiEAIViewer3D Object

4.22.3.3 FindAllByNameEx Method


See Also GuiEAIViewer3D Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiEAIViewer3D Object

2006 SAP AG

412

SAP GUI Scripting API 6.40

4.22.3.4 FindById Method


See Also GuiEAIViewer3D Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiEAIViewer3D Object

4.22.3.5 FindByName Method


See Also GuiEAIViewer3D Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _

2006 SAP AG

Objects ByVal Type As String _ ) As GuiComponent


Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

413

GuiEAIViewer3D Object

4.22.3.6 FindByNameEx Method


See Also GuiEAIViewer3D Object Name Type Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiEAIViewer3D Object

4.22.3.7 SelectContextMenuItem Method


See Also GuiEAIViewer3D Object FunctionCode Description Select an item from the controls context menu.

2006 SAP AG

414

SAP GUI Scripting API 6.40


Syntax

Public Sub SelectContextMenuItem( _ ByVal FunctionCode As String _ )


Parameters FunctionCode See Also

GuiEAIViewer3D Object

4.22.3.8 SelectContextMenuItemByPosition Method


See Also GuiEAIViewer3D Object PositionDesc Description This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item text. Syntax

Public Sub SelectContextMenuItemByPosition( _ ByVal PositionDesc As String _ )


Parameters PositionDesc Remarks The parameter is a string containing the path to the item. If the context menu item is on the top level menu, this is just the zero-base index of the item. Otherwise, the positions on the menu and respective submenus should be concatenated, separated by "|". See Also

GuiEAIViewer3D Object

4.22.3.9 SelectContextMenuItemByText Method


See Also GuiEAIViewer3D Object Text Description Select a menu item of a context menu using the text of the item and possible higher level menus. Syntax

2006 SAP AG

Objects Public Sub SelectContextMenuItemByText( _ ByVal Text As String _ )


Parameters Text See Also

415

GuiEAIViewer3D Object

4.22.3.10 SetFocus Method


See Also GuiEAIViewer3D Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiEAIViewer3D Object

4.22.3.11 ShowContextMenu Method


See Also GuiEAIViewer3D Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiEAIViewer3D Object

2006 SAP AG

416

SAP GUI Scripting API 6.40

4.22.3.12 Visualize Method


See Also GuiEAIViewer3D Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiEAIViewer3D Object

4.22.4 Properties
4.22.4.1 AccDescription Property
See Also GuiEAIViewer3D Object Description Accessibility description of the shell. This description can be used for shells that do not have a title element. Property type Read-only property Syntax (Visual Basic)

Public Property AccDescription() As String


See Also

GuiEAIViewer3D Object

2006 SAP AG

Objects 4.22.4.2 AccLabelCollection Property


See Also GuiEAIViewer3D Object Description

417

The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiEAIViewer3D Object

4.22.4.3 AccText Property


See Also GuiEAIViewer3D Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiEAIViewer3D Object

4.22.4.4 AccTextOnRequest Property


See Also GuiEAIViewer3D Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

418

SAP GUI Scripting API 6.40 Public Property AccTextOnRequest() As String


See Also

GuiEAIViewer3D Object

4.22.4.5 AccTooltip Property


See Also GuiEAIViewer3D Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiEAIViewer3D Object

4.22.4.6 Changeable Property


See Also GuiEAIViewer3D Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiEAIViewer3D Object

2006 SAP AG

Objects 4.22.4.7 Children Property


See Also GuiEAIViewer3D Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

419

Public Property Children() As GuiComponentCollection


See Also

GuiEAIViewer3D Object

4.22.4.8 ContainerType Property


See Also GuiEAIViewer3D Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiEAIViewer3D Object

4.22.4.9 CurrentContextMenu Property


See Also GuiEAIViewer3D Object Description This property is only set when a context menu is available at the shell object. Property type Read-only property Syntax (Visual Basic)

Public Property CurrentContextMenu() As GuiContextMenu

2006 SAP AG

420

SAP GUI Scripting API 6.40


See Also

GuiEAIViewer3D Object

4.22.4.10 DefaultTooltip Property


See Also GuiEAIViewer3D Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiEAIViewer3D Object

4.22.4.11 DragDropSupported Property


See Also GuiEAIViewer3D Object Description This property is True if the shell allows drag and drop operations. Property type Read-only property Syntax (Visual Basic)

Public Property DragDropSupported() As Boolean


See Also

GuiEAIViewer3D Object

4.22.4.12 Handle Property


See Also GuiEAIViewer3D Object Description The window handle of the control that is connected to the GuiShell.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

421

Public Property Handle() As Long


See Also

GuiEAIViewer3D Object

4.22.4.13 Height Property


See Also GuiEAIViewer3D Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiEAIViewer3D Object

4.22.4.14 IconName Property


See Also GuiEAIViewer3D Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiEAIViewer3D Object

2006 SAP AG

422

SAP GUI Scripting API 6.40

4.22.4.15 Id Property
See Also GuiEAIViewer3D Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiEAIViewer3D Object

4.22.4.16 IsSymbolFont Property


See Also GuiEAIViewer3D Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean

2006 SAP AG

Objects
See Also

423

GuiEAIViewer3D Object

4.22.4.17 Left Property


See Also GuiEAIViewer3D Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiEAIViewer3D Object

4.22.4.18 Modified Property


See Also GuiEAIViewer3D Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiEAIViewer3D Object

4.22.4.19 Name Property


See Also GuiEAIViewer3D Object Description The name property is especially useful when working with simple scripts that only access dynpro fields.

2006 SAP AG

424

SAP GUI Scripting API 6.40


In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiEAIViewer3D Object

4.22.4.20 OcxEvents Property


See Also GuiEAIViewer3D Object Description Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. Property type Read-only property Syntax (Visual Basic)

Public Property OcxEvents() As GuiCollection


See Also

GuiEAIViewer3D Object

4.22.4.21 Parent Property


See Also GuiEAIViewer3D Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

2006 SAP AG

Objects
GuiEAIViewer3D Object

425

4.22.4.22 ParentFrame Property


See Also GuiEAIViewer3D Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiEAIViewer3D Object

4.22.4.23 ScreenLeft Property


See Also GuiEAIViewer3D Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiEAIViewer3D Object

4.22.4.24 ScreenTop Property


See Also GuiEAIViewer3D Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

426

SAP GUI Scripting API 6.40 Public Property ScreenTop() As Long


See Also

GuiEAIViewer3D Object

4.22.4.25 SubType Property


See Also GuiEAIViewer3D Object Description Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView Property type Read-only property Syntax (Visual Basic)

Public Property SubType() As String


See Also

GuiEAIViewer3D Object

4.22.4.26 Text Property


See Also GuiEAIViewer3D Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiEAIViewer3D Object

2006 SAP AG

Objects 4.22.4.27 Tooltip Property


See Also GuiEAIViewer3D Object Description

427

The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiEAIViewer3D Object

4.22.4.28 Top Property


See Also GuiEAIViewer3D Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiEAIViewer3D Object

4.22.4.29 Type Property


See Also GuiEAIViewer3D Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

428

SAP GUI Scripting API 6.40 Public Property Type() As String


See Also

GuiEAIViewer3D Object

4.22.4.30 TypeAsNumber Property


See Also GuiEAIViewer3D Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiEAIViewer3D Object

4.22.4.31 Width Property


See Also GuiEAIViewer3D Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiEAIViewer3D Object

2006 SAP AG

Objects

429

4.23

GuiFrameWindow Object
See Also GuiFrameWindow Members 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 GuiVContainer. The type prefix is wnd, the name is wnd plus the window number in square brackets. For a list of all members defined in this module, see GuiFrameWindow members. Object Model

See Also

GuiFrameWindow Members

4.23.1 Overview
See Also GuiFrameWindow Members 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 GuiVContainer. The type prefix is wnd, the name is wnd plus the window number in square brackets.

2006 SAP AG

430

SAP GUI Scripting API 6.40


For a list of all members defined in this module, see GuiFrameWindow members. Object Model

See Also

GuiFrameWindow Members

4.23.2 Members
See Also GuiFrameWindow Overview Public Methods Close The function attempts to close the window. Trying to close the last main window of a session will not succeed immediately; the dialog Do you really want to log off? will be displayed first. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used.

FindAllByName

FindAllByNameEx

2006 SAP AG

Objects

431

FindById

FindByName

FindByNameEx

HardCopy

HardCopyToMemory Iconify

IsVKeyAllowed JumpBackward JumpForward Maximize Restore

Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. This function dumps a hardcopy of the window as a bitmap file to disk. The parameter is the name of the file. If the function succeeds, then the return value will be the fully qualified path of the file. If no path information is given, then the file will be written to the SapWorkDir. This function returns a hardcopy of the window as a safe array of bytes. This will set a window to the iconified state. It is not possible to iconify a specific window of a session; both the main window and all existing modals will be iconfied. This function returns True if the virtual key VKey is currently available. The VKeys are defined in the menu painter. Execute the Ctrl+Shift+Tab key on the window to jump backward one block. Execute the Ctrl+Tab key on the window to jump forward one block. This will maximize a window. It is not possible to maximize a modal window; it is always the main window which will be maximized. This will restore a window from its iconified state. It is not possible to restore a specific window of a session; both the main window and all existing modals will be restored. The virtual key VKey is executed on the window. The VKeys are defined in the menu painter. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. This method shows the message box modal to the GuiFrameWindow. The title and text parameters set the title and text of the message box. The return value will be one of the MESSAGE_RESULT_* values. Execute the Shift+Tab key on the window to jump backward one element. Execute the Tab key on the window to jump forward one element. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

SendVKey SetFocus

ShowMessageBox

TabBackward TabForward Visualize

Public Properties

2006 SAP AG

432

SAP GUI Scripting API 6.40


The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. When elementVisualizationMode is enabled, a hit test can be performed on SAP GUI by moving the cursor over the window. The hit event of the session is fired when a component was found at the mouse position. The systemFocus only supports dynpro elements. To receive information about the currently focussed ActiveX control you can access the guiFocus property. The window handle of the control that is connected to the GuiShell. This is the handle of the underlying window in Microsoft Windows. Height of the component in pixels. This property is True if the window is iconified. It is possible to execute script commands on an iconified window , but there may be undefined results, especially when controls are involved, as these may have invalid size settings. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. The systemFocus specifies the component that the SAP system is currently seeing as being focussed. This value is only valid for dynpro elements and might therefore differ from the focus as seen on the frontend.

AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children ContainerType DefaultTooltip

ElementVisualizationMode

GuiFocus

Handle Height Iconic

IconName Id

IsSymbolFont Left Modified Name

Parent ParentFrame ScreenLeft ScreenTop SystemFocus

2006 SAP AG

Objects

433

Text

Tooltip Top Type

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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels. This is the height of the working pane in character metric. This is the width of the working pane in character metric. The working pane is the area between the toolbars in the upper area of the window and the statusbar at the bottom of the window.

TypeAsNumber

Width WorkingPaneHeight WorkingPaneWidth

See Also

GuiFrameWindow Overview

4.23.3 Methods
4.23.3.1 Close Method
See Also GuiFrameWindow Object Description The function attempts to close the window. Trying to close the last main window of a session will not succeed immediately; the dialog Do you really want to log off? will be displayed first. Syntax

Public Sub Close()


See Also

GuiFrameWindow Object

4.23.3.2 FindAllByName Method


See Also GuiFrameWindow Object Name

2006 SAP AG

434

SAP GUI Scripting API 6.40


Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiFrameWindow Object

4.23.3.3 FindAllByNameEx Method


See Also GuiFrameWindow Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiFrameWindow Object

2006 SAP AG

Objects 4.23.3.4 FindById Method


See Also GuiFrameWindow Object Id Raise Description

435

Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiFrameWindow Object

4.23.3.5 FindByName Method


See Also GuiFrameWindow Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _

2006 SAP AG

436

SAP GUI Scripting API 6.40 ByVal Type As String _ ) As GuiComponent


Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiFrameWindow Object

4.23.3.6 FindByNameEx Method


See Also GuiFrameWindow Object Name Type Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiFrameWindow Object

4.23.3.7 HardCopy Method


See Also GuiFrameWindow Object Filename ImageType The following values are valid: 0: BMP

2006 SAP AG

Objects
1: JPG 2: PNG 3: GIF

437

BMP is the default format. Description This function dumps a hardcopy of the window as a bitmap file to disk. The parameter is the name of the file. If the function succeeds, then the return value will be the fully qualified path of the file. If no path information is given, then the file will be written to the SapWorkDir. Syntax

Public Function HardCopy( _ ByVal Filename As String, _ Optional ByVal ImageType As Long = 0 _ ) As String
Parameters Filename ImageType The following values are valid: 0: BMP 1: JPG 2: PNG 3: GIF

BMP is the default format. See Also

GuiFrameWindow Object

4.23.3.8 HardCopyToMemory Method


See Also GuiFrameWindow Object ImageType The following values are valid: 0: BMP 1: JPG 2: PNG 3: GIF

BMP is the default format. Description This function returns a hardcopy of the window as a safe array of bytes.

2006 SAP AG

438

SAP GUI Scripting API 6.40


Syntax

Public Function HardCopyToMemory( _ Optional ByVal ImageType As Long = 0 _ ) As Variant


Parameters ImageType The following values are valid: 0: BMP 1: JPG 2: PNG 3: GIF

BMP is the default format. See Also

GuiFrameWindow Object

4.23.3.9 Iconify Method


See Also GuiFrameWindow Object Description This will set a window to the iconified state. It is not possible to iconify a specific window of a session; both the main window and all existing modals will be iconfied. Syntax

Public Sub Iconify()


See Also

GuiFrameWindow Object

4.23.3.10 IsVKeyAllowed Method


See Also GuiFrameWindow Object VKey Description This function returns True if the virtual key VKey is currently available. The VKeys are defined in the menu painter. Syntax

2006 SAP AG

Objects Public Function IsVKeyAllowed( _ ByVal VKey As Integer _ ) As Boolean


Parameters VKey See Also

439

GuiFrameWindow Object

4.23.3.11 JumpBackward Method


See Also GuiFrameWindow Object Description Execute the Ctrl+Shift+Tab key on the window to jump backward one block. Syntax

Public Sub JumpBackward()


See Also

GuiFrameWindow Object

4.23.3.12 JumpForward Method


See Also GuiFrameWindow Object Description Execute the Ctrl+Tab key on the window to jump forward one block. Syntax

Public Sub JumpForward()


See Also

GuiFrameWindow Object

4.23.3.13 Maximize Method


See Also GuiFrameWindow Object Description

2006 SAP AG

440

SAP GUI Scripting API 6.40


This will maximize a window. It is not possible to maximize a modal window; it is always the main window which will be maximized. Syntax

Public Sub Maximize()


See Also

GuiFrameWindow Object

4.23.3.14 Restore Method


See Also GuiFrameWindow Object Description This will restore a window from its iconified state. It is not possible to restore a specific window of a session; both the main window and all existing modals will be restored. Syntax

Public Sub Restore()


See Also

GuiFrameWindow Object

4.23.3.15 SendVKey Method


See Also GuiFrameWindow Object VKey Description The virtual key VKey is executed on the window. The VKeys are defined in the menu painter. Syntax

Public Sub SendVKey( _ ByVal VKey As Integer _ )


Parameters VKey See Also

GuiFrameWindow Object

2006 SAP AG

Objects 4.23.3.16 SetFocus Method


See Also GuiFrameWindow Object Description

441

This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiFrameWindow Object

4.23.3.17 ShowMessageBox Method


See Also GuiFrameWindow Object Title Text MsgIcon The msgIcon parameter sets the icon to be used for the message box and should be set to one of the MESSAGE_TYPE_* constants. MsgType msgType sets the buttons available on the message box and should be set to one of the MESSAGE_OPTION* constants. Description This method shows the message box modal to the GuiFrameWindow. The title and text parameters set the title and text of the message box. The return value will be one of the MESSAGE_RESULT_* values. Syntax

Public Function ShowMessageBox( _ ByVal Title As String, _ ByVal Text As String, _ ByVal MsgIcon As Long, _ ByVal MsgType As Long _ ) As Long
Parameters Title Text

2006 SAP AG

442

SAP GUI Scripting API 6.40


MsgIcon The msgIcon parameter sets the icon to be used for the message box and should be set to one of the MESSAGE_TYPE_* constants. MsgType msgType sets the buttons available on the message box and should be set to one of the MESSAGE_OPTION* constants. See Also

GuiFrameWindow Object

4.23.3.18 TabBackward Method


See Also GuiFrameWindow Object Description Execute the Shift+Tab key on the window to jump backward one element. Syntax

Public Sub TabBackward()


See Also

GuiFrameWindow Object

4.23.3.19 TabForward Method


See Also GuiFrameWindow Object Description Execute the Tab key on the window to jump forward one element. Syntax

Public Sub TabForward()


See Also

GuiFrameWindow Object

4.23.3.20 Visualize Method


See Also GuiFrameWindow Object On InnerObject

2006 SAP AG

Objects

443

Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiFrameWindow Object

4.23.4 Properties
4.23.4.1 AccLabelCollection Property
See Also GuiFrameWindow Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiFrameWindow Object

4.23.4.2 AccText Property


See Also GuiFrameWindow Object Description An additional text for accessibility support. Property type

2006 SAP AG

444

SAP GUI Scripting API 6.40


Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiFrameWindow Object

4.23.4.3 AccTextOnRequest Property


See Also GuiFrameWindow Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiFrameWindow Object

4.23.4.4 AccTooltip Property


See Also GuiFrameWindow Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiFrameWindow Object

2006 SAP AG

Objects 4.23.4.5 Changeable Property


See Also GuiFrameWindow Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

445

Public Property Changeable() As Boolean


See Also

GuiFrameWindow Object

4.23.4.6 Children Property


See Also GuiFrameWindow Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiFrameWindow Object

4.23.4.7 ContainerType Property


See Also GuiFrameWindow Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean

2006 SAP AG

446

SAP GUI Scripting API 6.40


See Also

GuiFrameWindow Object

4.23.4.8 DefaultTooltip Property


See Also GuiFrameWindow Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiFrameWindow Object

4.23.4.9 ElementVisualizationMode Property


See Also GuiFrameWindow Object Description When elementVisualizationMode is enabled, a hit test can be performed on SAP GUI by moving the cursor over the window. The hit event of the session is fired when a component was found at the mouse position. Property type Read-write property Syntax (Visual Basic)

Public Property ElementVisualizationMode() As Boolean


See Also

GuiFrameWindow Object

2006 SAP AG

Objects 4.23.4.10 GuiFocus Property


See Also GuiFrameWindow Object Description

447

The systemFocus only supports dynpro elements. To receive information about the currently focussed ActiveX control you can access the guiFocus property. Property type Read-only property Syntax (Visual Basic)

Public Property GuiFocus() As GuiVComponent


See Also

GuiFrameWindow Object

4.23.4.11 Handle Property


See Also GuiFrameWindow Object Description The window handle of the control that is connected to the GuiShell. This is the handle of the underlying window in Microsoft Windows. Property type Read-only property Syntax (Visual Basic)

Public Property Handle() As Long


See Also

GuiFrameWindow Object

4.23.4.12 Height Property


See Also GuiFrameWindow Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

448

SAP GUI Scripting API 6.40 Public Property Height() As Long


See Also

GuiFrameWindow Object

4.23.4.13 Iconic Property


See Also GuiFrameWindow Object Description This property is True if the window is iconified. It is possible to execute script commands on an iconified window , but there may be undefined results, especially when controls are involved, as these may have invalid size settings. Property type Read-only property Syntax (Visual Basic)

Public Property Iconic() As Boolean


See Also

GuiFrameWindow Object

4.23.4.14 IconName Property


See Also GuiFrameWindow Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiFrameWindow Object

2006 SAP AG

Objects 4.23.4.15 Id Property


See Also GuiFrameWindow Object Description

449

An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiFrameWindow Object

4.23.4.16 IsSymbolFont Property


See Also GuiFrameWindow Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean

2006 SAP AG

450

SAP GUI Scripting API 6.40


See Also

GuiFrameWindow Object

4.23.4.17 Left Property


See Also GuiFrameWindow Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiFrameWindow Object

4.23.4.18 Modified Property


See Also GuiFrameWindow Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiFrameWindow Object

4.23.4.19 Name Property


See Also GuiFrameWindow Object Description The name property is especially useful when working with simple scripts that only access dynpro fields.

2006 SAP AG

Objects

451

In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiFrameWindow Object

4.23.4.20 Parent Property


See Also GuiFrameWindow Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiFrameWindow Object

4.23.4.21 ParentFrame Property


See Also GuiFrameWindow Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiFrameWindow Object

2006 SAP AG

452

SAP GUI Scripting API 6.40

4.23.4.22 ScreenLeft Property


See Also GuiFrameWindow Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiFrameWindow Object

4.23.4.23 ScreenTop Property


See Also GuiFrameWindow Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiFrameWindow Object

4.23.4.24 SystemFocus Property


See Also GuiFrameWindow Object Description The systemFocus specifies the component that the SAP system is currently seeing as being focussed. This value is only valid for dynpro elements and might therefore differ from the focus as seen on the frontend. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property SystemFocus() As GuiVComponent


See Also

453

GuiFrameWindow Object

4.23.4.25 Text Property


See Also GuiFrameWindow Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiFrameWindow Object

4.23.4.26 Tooltip Property


See Also GuiFrameWindow Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiFrameWindow Object

2006 SAP AG

454

SAP GUI Scripting API 6.40

4.23.4.27 Top Property


See Also GuiFrameWindow Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiFrameWindow Object

4.23.4.28 Type Property


See Also GuiFrameWindow Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiFrameWindow Object

4.23.4.29 TypeAsNumber Property


See Also GuiFrameWindow Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property TypeAsNumber() As Long


See Also

455

GuiFrameWindow Object

4.23.4.30 Width Property


See Also GuiFrameWindow Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiFrameWindow Object

4.23.4.31 WorkingPaneHeight Property


See Also GuiFrameWindow Object Description This is the height of the working pane in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property WorkingPaneHeight() As Long


See Also

GuiFrameWindow Object

2006 SAP AG

456

SAP GUI Scripting API 6.40

4.23.4.32 WorkingPaneWidth Property


See Also GuiFrameWindow Object Description This is the width of the working pane in character metric. The working pane is the area between the toolbars in the upper area of the window and the statusbar at the bottom of the window. Property type Read-only property Syntax (Visual Basic)

Public Property WorkingPaneWidth() As Long


See Also

GuiFrameWindow Object

4.24

GuiGOSShell Object
See Also GuiGOSShell Members Description 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]. For a list of all members defined in this module, see GuiGOSShell members. Object Model

2006 SAP AG

Objects

457

Example Transaction me22:

The GOS shell is a child of the titlebar and will contain another shell, in this example a toolbar control. See Also

GuiGOSShell Members

4.24.1 Overview
See Also GuiGOSShell Members Description 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]. For a list of all members defined in this module, see GuiGOSShell members. Object Model

2006 SAP AG

458

SAP GUI Scripting API 6.40

Example Transaction me22:

The GOS shell is a child of the titlebar and will contain another shell, in this example a toolbar control. See Also

GuiGOSShell Members

4.24.2 Members
See Also GuiGOSShell Overview Public Methods

2006 SAP AG

Objects

459

DumpState

FindAllByName

FindAllByNameEx

FindById

FindByName

FindByNameEx

SetFocus

ShowContextMenu Visualize

This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object.

2006 SAP AG

460

SAP GUI Scripting API 6.40


This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

ContainerType DefaultTooltip Height IconName Id

IsSymbolFont Left Modified Name

Parent ParentFrame ScreenLeft ScreenTop Text

Tooltip Top Type

TypeAsNumber

Width See Also

GuiGOSShell Overview

2006 SAP AG

Objects

461

4.24.3 Methods
4.24.3.1 DumpState Method
See Also GuiGOSShell Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection:

2006 SAP AG

462

SAP GUI Scripting API 6.40 First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiGOSShell Object

4.24.3.2 FindAllByName Method


See Also GuiGOSShell Object Name Type Description

2006 SAP AG

Objects

463

The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiGOSShell Object

4.24.3.3 FindAllByNameEx Method


See Also GuiGOSShell Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiGOSShell Object

2006 SAP AG

464

SAP GUI Scripting API 6.40

4.24.3.4 FindById Method


See Also GuiGOSShell Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiGOSShell Object

4.24.3.5 FindByName Method


See Also GuiGOSShell Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _

2006 SAP AG

Objects ByVal Type As String _ ) As GuiComponent


Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

465

GuiGOSShell Object

4.24.3.6 FindByNameEx Method


See Also GuiGOSShell Object Name Type Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiGOSShell Object

4.24.3.7 SetFocus Method


See Also GuiGOSShell Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object.

2006 SAP AG

466

SAP GUI Scripting API 6.40


Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiGOSShell Object

4.24.3.8 ShowContextMenu Method


See Also GuiGOSShell Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiGOSShell Object

4.24.3.9 Visualize Method


See Also GuiGOSShell Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On

2006 SAP AG

Objects
InnerObject See Also

467

GuiGOSShell Object

4.24.4 Properties
4.24.4.1 AccLabelCollection Property
See Also GuiGOSShell Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiGOSShell Object

4.24.4.2 AccText Property


See Also GuiGOSShell Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiGOSShell Object

2006 SAP AG

468

SAP GUI Scripting API 6.40

4.24.4.3 AccTextOnRequest Property


See Also GuiGOSShell Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiGOSShell Object

4.24.4.4 AccTooltip Property


See Also GuiGOSShell Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiGOSShell Object

4.24.4.5 Changeable Property


See Also GuiGOSShell Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean

2006 SAP AG

Objects
See Also

469

GuiGOSShell Object

4.24.4.6 Children Property


See Also GuiGOSShell Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiGOSShell Object

4.24.4.7 ContainerType Property


See Also GuiGOSShell Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiGOSShell Object

4.24.4.8 DefaultTooltip Property


See Also GuiGOSShell Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type.

2006 SAP AG

470

SAP GUI Scripting API 6.40


Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiGOSShell Object

4.24.4.9 Height Property


See Also GuiGOSShell Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiGOSShell Object

4.24.4.10 IconName Property


See Also GuiGOSShell Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiGOSShell Object

2006 SAP AG

Objects 4.24.4.11 Id Property


See Also GuiGOSShell Object Description

471

An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiGOSShell Object

4.24.4.12 IsSymbolFont Property


See Also GuiGOSShell Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean

2006 SAP AG

472

SAP GUI Scripting API 6.40


See Also

GuiGOSShell Object

4.24.4.13 Left Property


See Also GuiGOSShell Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiGOSShell Object

4.24.4.14 Modified Property


See Also GuiGOSShell Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiGOSShell Object

4.24.4.15 Name Property


See Also GuiGOSShell Object Description The name property is especially useful when working with simple scripts that only access dynpro fields.

2006 SAP AG

Objects

473

In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiGOSShell Object

4.24.4.16 Parent Property


See Also GuiGOSShell Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiGOSShell Object

4.24.4.17 ParentFrame Property


See Also GuiGOSShell Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiGOSShell Object

2006 SAP AG

474

SAP GUI Scripting API 6.40

4.24.4.18 ScreenLeft Property


See Also GuiGOSShell Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiGOSShell Object

4.24.4.19 ScreenTop Property


See Also GuiGOSShell Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiGOSShell Object

4.24.4.20 Text Property


See Also GuiGOSShell Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Text() As String


See Also

475

GuiGOSShell Object

4.24.4.21 Tooltip Property


See Also GuiGOSShell Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiGOSShell Object

4.24.4.22 Top Property


See Also GuiGOSShell Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiGOSShell Object

2006 SAP AG

476

SAP GUI Scripting API 6.40

4.24.4.23 Type Property


See Also GuiGOSShell Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiGOSShell Object

4.24.4.24 TypeAsNumber Property


See Also GuiGOSShell Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiGOSShell Object

4.24.4.25 Width Property


See Also GuiGOSShell Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Width() As Long


See Also

477

GuiGOSShell Object

4.25

GuiGraphAdapt Object
See Also GuiGraphAdapt Members Description For the graphic adapter control only basic members from GuiShell are available. Recording and playback is not possible. For a list of all members defined in this module, see GuiGraphAdapt members. Object Model

See Also

GuiGraphAdapt Members

2006 SAP AG

478

SAP GUI Scripting API 6.40

4.25.1 Overview
See Also GuiGraphAdapt Members Description For the graphic adapter control only basic members from GuiShell are available. Recording and playback is not possible. For a list of all members defined in this module, see GuiGraphAdapt members. Object Model

See Also

GuiGraphAdapt Members

4.25.2 Members
See Also GuiGraphAdapt Overview Public Methods

2006 SAP AG

Objects

479

DumpState

FindAllByName

FindAllByNameEx

FindById

FindByName

FindByNameEx

SelectContextMenuItem

This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Select an item from the controls context menu.

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item SelectContextMenuItemByPo text. sition Select a menu item of a context menu using the text of the item and possible higher level menus. SelectContextMenuItemByTe xt This function can be used to set the focus onto an object. If a user SetFocus interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. ShowContextMenu Calling this method of a component will display a red frame around Visualize the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Public Properties AccDescription Accessibility description of the shell. This description can be used for shells that do not have a title element.

2006 SAP AG

480

SAP GUI Scripting API 6.40


The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. This property is only set when a context menu is available at the shell object. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. This property is True if the shell allows drag and drop operations. The window handle of the control that is connected to the GuiShell. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates.

AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children ContainerType CurrentContextMenu DefaultTooltip DragDropSupported Handle Height IconName Id

IsSymbolFont Left Modified Name

OcxEvents Parent ParentFrame ScreenLeft ScreenTop SubType Text

Tooltip Top

2006 SAP AG

Objects

481

Type

TypeAsNumber

Width See Also

The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

GuiGraphAdapt Overview

4.25.3 Methods
4.25.3.1 DumpState Method
See Also GuiGraphAdapt Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used:

2006 SAP AG

482

SAP GUI Scripting API 6.40 GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

2006 SAP AG

Objects

483

GuiGraphAdapt Object

4.25.3.2 FindAllByName Method


See Also GuiGraphAdapt Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiGraphAdapt Object

4.25.3.3 FindAllByNameEx Method


See Also GuiGraphAdapt Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection

2006 SAP AG

484

SAP GUI Scripting API 6.40


Parameters Name Type See Also

GuiGraphAdapt Object

4.25.3.4 FindById Method


See Also GuiGraphAdapt Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiGraphAdapt Object

4.25.3.5 FindByName Method


See Also GuiGraphAdapt Object Name Type

2006 SAP AG

Objects
Description

485

Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiGraphAdapt Object

4.25.3.6 FindByNameEx Method


See Also GuiGraphAdapt Object Name Type Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiGraphAdapt Object

2006 SAP AG

486

SAP GUI Scripting API 6.40

4.25.3.7 SelectContextMenuItem Method


See Also GuiGraphAdapt Object FunctionCode Description Select an item from the controls context menu. Syntax

Public Sub SelectContextMenuItem( _ ByVal FunctionCode As String _ )


Parameters FunctionCode See Also

GuiGraphAdapt Object

4.25.3.8 SelectContextMenuItemByPosition Method


See Also GuiGraphAdapt Object PositionDesc Description This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item text. Syntax

Public Sub SelectContextMenuItemByPosition( _ ByVal PositionDesc As String _ )


Parameters PositionDesc Remarks The parameter is a string containing the path to the item. If the context menu item is on the top level menu, this is just the zero-base index of the item. Otherwise, the positions on the menu and respective submenus should be concatenated, separated by "|". See Also

GuiGraphAdapt Object

2006 SAP AG

Objects 4.25.3.9 SelectContextMenuItemByText Method


See Also GuiGraphAdapt Object Text Description

487

Select a menu item of a context menu using the text of the item and possible higher level menus. Syntax

Public Sub SelectContextMenuItemByText( _ ByVal Text As String _ )


Parameters Text See Also

GuiGraphAdapt Object

4.25.3.10 SetFocus Method


See Also GuiGraphAdapt Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiGraphAdapt Object

4.25.3.11 ShowContextMenu Method


See Also GuiGraphAdapt Object Description Shows the context menu of the control.

2006 SAP AG

488

SAP GUI Scripting API 6.40


Syntax

Public Sub ShowContextMenu()


See Also

GuiGraphAdapt Object

4.25.3.12 Visualize Method


See Also GuiGraphAdapt Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiGraphAdapt Object

4.25.4 Properties
4.25.4.1 AccDescription Property
See Also GuiGraphAdapt Object Description Accessibility description of the shell. This description can be used for shells that do not have a title element. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

489

Public Property AccDescription() As String


See Also

GuiGraphAdapt Object

4.25.4.2 AccLabelCollection Property


See Also GuiGraphAdapt Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiGraphAdapt Object

4.25.4.3 AccText Property


See Also GuiGraphAdapt Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiGraphAdapt Object

2006 SAP AG

490

SAP GUI Scripting API 6.40

4.25.4.4 AccTextOnRequest Property


See Also GuiGraphAdapt Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiGraphAdapt Object

4.25.4.5 AccTooltip Property


See Also GuiGraphAdapt Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiGraphAdapt Object

4.25.4.6 Changeable Property


See Also GuiGraphAdapt Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean

2006 SAP AG

Objects
See Also

491

GuiGraphAdapt Object

4.25.4.7 Children Property


See Also GuiGraphAdapt Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiGraphAdapt Object

4.25.4.8 ContainerType Property


See Also GuiGraphAdapt Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiGraphAdapt Object

4.25.4.9 CurrentContextMenu Property


See Also GuiGraphAdapt Object Description This property is only set when a context menu is available at the shell object.

2006 SAP AG

492

SAP GUI Scripting API 6.40


Property type Read-only property Syntax (Visual Basic)

Public Property CurrentContextMenu() As GuiContextMenu


See Also

GuiGraphAdapt Object

4.25.4.10 DefaultTooltip Property


See Also GuiGraphAdapt Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiGraphAdapt Object

4.25.4.11 DragDropSupported Property


See Also GuiGraphAdapt Object Description This property is True if the shell allows drag and drop operations. Property type Read-only property Syntax (Visual Basic)

Public Property DragDropSupported() As Boolean


See Also

GuiGraphAdapt Object

2006 SAP AG

Objects 4.25.4.12 Handle Property


See Also GuiGraphAdapt Object Description The window handle of the control that is connected to the GuiShell. Property type Read-only property Syntax (Visual Basic)

493

Public Property Handle() As Long


See Also

GuiGraphAdapt Object

4.25.4.13 Height Property


See Also GuiGraphAdapt Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiGraphAdapt Object

4.25.4.14 IconName Property


See Also GuiGraphAdapt Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

494

SAP GUI Scripting API 6.40 Public Property IconName() As String


See Also

GuiGraphAdapt Object

4.25.4.15 Id Property
See Also GuiGraphAdapt Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiGraphAdapt Object

4.25.4.16 IsSymbolFont Property


See Also GuiGraphAdapt Object Description

2006 SAP AG

Objects
The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

495

Public Property IsSymbolFont() As Boolean


See Also

GuiGraphAdapt Object

4.25.4.17 Left Property


See Also GuiGraphAdapt Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiGraphAdapt Object

4.25.4.18 Modified Property


See Also GuiGraphAdapt Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiGraphAdapt Object

2006 SAP AG

496

SAP GUI Scripting API 6.40

4.25.4.19 Name Property


See Also GuiGraphAdapt Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiGraphAdapt Object

4.25.4.20 OcxEvents Property


See Also GuiGraphAdapt Object Description Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. Property type Read-only property Syntax (Visual Basic)

Public Property OcxEvents() As GuiCollection


See Also

GuiGraphAdapt Object

4.25.4.21 Parent Property


See Also GuiGraphAdapt Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

497

Public Property Parent() As GuiComponent


See Also

GuiGraphAdapt Object

4.25.4.22 ParentFrame Property


See Also GuiGraphAdapt Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiGraphAdapt Object

4.25.4.23 ScreenLeft Property


See Also GuiGraphAdapt Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiGraphAdapt Object

2006 SAP AG

498

SAP GUI Scripting API 6.40

4.25.4.24 ScreenTop Property


See Also GuiGraphAdapt Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiGraphAdapt Object

4.25.4.25 SubType Property


See Also GuiGraphAdapt Object Description Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView Property type Read-only property Syntax (Visual Basic)

Public Property SubType() As String


See Also

GuiGraphAdapt Object

4.25.4.26 Text Property


See Also GuiGraphAdapt Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property

2006 SAP AG

Objects
Syntax (Visual Basic)

499

Public Property Text() As String


See Also

GuiGraphAdapt Object

4.25.4.27 Tooltip Property


See Also GuiGraphAdapt Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiGraphAdapt Object

4.25.4.28 Top Property


See Also GuiGraphAdapt Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiGraphAdapt Object

2006 SAP AG

500

SAP GUI Scripting API 6.40

4.25.4.29 Type Property


See Also GuiGraphAdapt Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiGraphAdapt Object

4.25.4.30 TypeAsNumber Property


See Also GuiGraphAdapt Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiGraphAdapt Object

4.25.4.31 Width Property


See Also GuiGraphAdapt Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Width() As Long


See Also

501

GuiGraphAdapt Object

4.26

GuiGridView Object
See Also GuiGridView Members Description The grid view is similar to the dynpro table control, but significantly more powerful. GuiGridView extends GuiShell. For a list of all members defined in this module, see GuiGridView members. Object Model

Example

2006 SAP AG

502

SAP GUI Scripting API 6.40

See Also

GuiGridView Members

4.26.1 Overview
See Also GuiGridView Members Description The grid view is similar to the dynpro table control, but significantly more powerful. GuiGridView extends GuiShell. For a list of all members defined in this module, see GuiGridView members. Object Model

2006 SAP AG

Objects

503

Example

See Also

GuiGridView Members

2006 SAP AG

504

SAP GUI Scripting API 6.40

4.26.2 Members
See Also GuiGridView Overview Public Methods ClearSelection Click ClickCurrentCell ContextMenu CurrentCellMoved Calling clearSelection removes all row, column and cell selections. This function emulates a mouse click on a given cell if the parameters are valid and raises an exception otherwise. This function emulates a mouse click on the current cell. Calling contextMenu emulates the context menu request. This function notifies the server that a different cell has been made the current cell. It must be called whenever the current cell is changed. The parameter rows is a comma separated string of indices or index ranges, for example 3,5-8,14,15. The entries must be ordered and not overlap, otherwise an exception is raised. This function removes the specified column from the collection of the selected columns. This function emulates a mouse double click on a given cell if the parameters are valid and raises an exception otherwise. This function emulates a mouse double click on the current cell. This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The parameter rows is a comma separated string of indices or index ranges, for example 3,5-8,14,15. For any single index a copy of the row will be inserted at the given index. If a range of indexes is duplicated then all the new lines are inserted as one block, before the old lines. The entries must be ordered and not overlap, otherwise an exception is raised. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False.

DeleteRows

DeselectColumn DoubleClick DoubleClickCurrentCell DumpState

DuplicateRows

FindAllByName

FindAllByNameEx

FindById

2006 SAP AG

Objects

505

FindByName

FindByNameEx

GetCellChangeable GetCellCheckBoxChecked GetCellColor GetCellHeight GetCellIcon

Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. This function returns True if the specified cell is changeable. Returns True if the checkbox at the specified position is checked. Throws an exception if there is no checkbox in the specified cell. Returns an identifier for the color of the cell. This can be used to retrieve the color information using GetColorInfo. Return the height of the cell in pixels. 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 number or character. Returns the left position of the cell in client coordinates. Returns the maximum length of the cell in number of bytes. Returns the state of the cell. Possible values are: Normal Error Warning Info

GetCellLeft GetCellMaxLength GetCellState

GetCellTooltip GetCellTop GetCellType

Returns the tooltip of the cell. Returns the top position of the cell in client coordinates. This function returns the type of the specified cell. Possible values are: Normal Button Checkbox ValueList RadioButton This function returns the value of the specified cell. Returns the width of the cell in pixels. Returns the description for the color of the cell. Returns the data type of the column according to the 'built-in datatypes' of the XML schema standard. Returns the position of the column as shown on the screen, starting from 1. Returns the sort type of the column. Possible values are: None Ascending Descending

GetCellValue GetCellWidth GetColorInfo GetColumnDataType GetColumnPosition GetColumnSortType

GetColumnTitles

This function returns a collection of strings that are used to display the title of a column. The control chooses the appropriate title according to the width of the column.

2006 SAP AG

506

SAP GUI Scripting API 6.40


The tooltip of a column contains a text which is designed to help the user understands the meaning of the column. Returns the total type of the column. Possible values are: None Total Subtotal GetDisplayedColumnTitle This function returns the title of the column that is currently displayed. This text is one of the values of the collection returned from the function getColumnTitles. Returns the level of the row. Returns the description for the symbol in the cell. Returns True if the button is currently checked (pressed). GetToolbarButtonChecked Indicates if the button can be pressed. GetToolbarButtonEnabled GetToolbarButtonIcon GetToolbarButtonId GetToolbarButtonText GetToolbarButtonTooltip GetToolbarButtonType Returns the name of the icon of the specified toolbar button. Returns the ID of the specified toolbar button, as defined in the ABAP data dictionary. Returns the text of the specified toolbar button. Returns the tooltip of the specified toolbar button. Returns the type of the specified toolbar button. Possible values are: "Button", "ButtonAndMenu", "Menu", "Separator", "Group", "CheckBox" Returns the position of the toolbar button that has the focus. If no button in the toolbar has the focus, the method returns -1. Returns True if the cell has a value help. The parameter rows is a comma separated text of indices or index ranges, for example 3,5-8,14,15. For any single index, a new row will be added at the given index, moving the old row one line down. If a range of indexes is inserted then all the new lines are inserted as one block, before any of the old lines. The entries must be ordered and not overlap, otherwise, an exception is raised. Returns True if the cell is a link. Returns True if the text in the cell is displayed in the SAP symbol font. Returns True if the cell contains a total expander button. Returns True if a filter was applied to the column. Returns True if the column is marked as a key column. Returns true if the row containing an expander is currently expanded. 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. Otherwise, an exception is raised. If row and column identify a valid editable cell containing a checkbox, then the value of the cell is changed. Otherwise, an exception is raised. The rows with an index greater than or equal to fromRow up to an index less than or equal to toRow are moved to the position of destRow . Passing invalid index values as parameters raises an exception.

GetColumnTooltip GetColumnTotalType

GetRowTotalLevel GetSymbolInfo

GetToolbarFocusButton HasCellF4Help InsertRows

IsCellHotspot IsCellSymbol IsCellTotalExpander IsColumnFiltered IsColumnKey IsTotalRowExpanded ModifyCell

ModifyCheckBox

MoveRows

2006 SAP AG

Objects

507

PressButton

PressButtonCurrentCell PressColumnHeader

PressEnter PressF1 PressF4 PressToolbarButton PressToolbarContextButton PressTotalRow

This function emulates pressing a button placed in a given cell. It will raise an exception if the cell does not contain a button, or does not even exist. This function emulates pressing a button placed in the current cell. It will raise an exception if the cell does not contain a button. This function emulates a mouse click on the header of the column if the parameter identifies a valid column and raises an exception otherwise. This emulates pressing the Enter key. This emulates pressing the F1 key while the focus is on the grid view. This emulates pressing the F4 key. This function emulates clicking a button in the grid views toolbar. This emulates opening the context menu of the grid views toolbar.

Pressing the total row button expands or condenses the grouped rows. If the selected cell is not a total row cell an exception is raised.
This function differs from pressTotalRow only in that it tries to press the expansion button on the current cell. This function selects the whole grid content (i.e. all rows and all columns). This function adds the specified column to the collection of the selected columns. Select an item from the controls context menu.

PressTotalRowCurrentCell SelectAll SelectColumn SelectContextMenuItem

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item SelectContextMenuItemByPo text. sition Select a menu item of a context menu using the text of the item and possible higher level menus. SelectContextMenuItemByTe xt This function notifies the server that the selection has changed. SelectionChanged This function emulates the selection of an item from the context SelectToolbarMenuItem menu of the grid views toolbar. The parameter should be the function code of the item. The width of a column can be set using this function. The width is SetColumnWidth given in characters. For proportional fonts this refers to the width of an average character. Depending on the contents of the cell more or less characters may fit in the column. If the parameter is invalid an exception is raised. If row and column identify a valid cell, this cell becomes the current SetCurrentCell cell. Otherwise, an exception is raised. This function can be used to set the focus onto an object. If a user SetFocus interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. ShowContextMenu Notifies the server of multiple changes in cells. Typically this method TriggerModified should be called after multiple calls to ModifyCell.

2006 SAP AG

508

SAP GUI Scripting API 6.40


Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

Visualize

Public Properties AccDescription AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children ColumnCount ColumnOrder Accessibility description of the shell. This description can be used for shells that do not have a title element. The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property represents the number of columns in the control. This collection contains all the column identifiers in the order in which they are currently displayed. Passing an invalid column identifier to this property will raise an exception. This property is TRUE, if the object is a container and therefore has the children property. The string identifying a column is the field name defined in the SAP data dictionary. In the example above the identifiers are named CARRID, CONNID, FLDATE, PRICE etc. The row index of the current cell ranges from 0 to the number of rows less 1, with -1 being the index of the title row. This property is only set when a context menu is available at the shell object. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. This property is True if the shell allows drag and drop operations. This property represents the first visible column of the scrollable area of the grid view. Fixed columns are ignored. Setting the property to an invalid column identifier will raise an exception. This is the index of the first visible row in the grid. Setting this property to an invalid row index will raise an exception. This property represents the number of columns that are excluded from horizontal scrolling. The window handle of the control that is connected to the GuiShell. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system.

ContainerType CurrentCellColumn

CurrentCellRow CurrentContextMenu DefaultTooltip DragDropSupported FirstVisibleColumn

FirstVisibleRow FrozenColumnCount Handle Height IconName Id

IsSymbolFont Left Modified

2006 SAP AG

Objects

509

Name

OcxEvents Parent ParentFrame RowCount ScreenLeft ScreenTop SelectedCells

The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. This property represents the number of rows in the control. The y position of the component in screen coordinates. The x position of the component in screen coordinates. The collection of selected cells contains strings, each of which has the format <index of the row>,<column identifier>, such as 0, CARRID. Trying to set this property to an invalid value will raise an exception. The selected columns are available as a collection of strings like the currentCellColumn string. Setting this property can raise an exception, if the new collection contains an invalid column identifier. 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 an invalid string or a string containing invalid row indices will raise an exception. Possible values are: RowsAndColumns: Only rows and columns can be selected. Individual rectangular areas of cells are not allowed. ListboxSingle: Only one single row can be selected. ListboxMultiple: One or more rows can be selected. Free: Any kind of selection can be made. Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value GridView. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. This property represents title of the grid control. The number of toolbar buttons including separators. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Retrieves the number of visible rows of the grid.

SelectedColumns

SelectedRows

SelectionMode

SubType

Text

Title ToolbarButtonCount Tooltip Top Type

TypeAsNumber

VisibleRowCount

2006 SAP AG

510

SAP GUI Scripting API 6.40


Width of the component in pixels.

Width See Also

GuiGridView Overview

4.26.3 Methods
4.26.3.1 ClearSelection Method
See Also GuiGridView Object Description Calling clearSelection removes all row, column and cell selections. Syntax

Public Sub ClearSelection()


See Also

GuiGridView Object

4.26.3.2 Click Method


See Also GuiGridView Object Row Column Description This function emulates a mouse click on a given cell if the parameters are valid and raises an exception otherwise. Syntax

Public Sub Click( _ ByVal Row As Long, _ ByVal Column As String _ )


Parameters Row Column See Also

2006 SAP AG

Objects
GuiGridView Object

511

4.26.3.3 ClickCurrentCell Method


See Also GuiGridView Object Description This function emulates a mouse click on the current cell. Syntax

Public Sub ClickCurrentCell()


See Also

GuiGridView Object

4.26.3.4 ContextMenu Method


See Also GuiGridView Object Description Calling contextMenu emulates the context menu request. Syntax

Public Sub ContextMenu()


See Also

GuiGridView Object

4.26.3.5 CurrentCellMoved Method


See Also GuiGridView Object Description This function notifies the server that a different cell has been made the current cell. It must be called whenever the current cell is changed. Syntax

Public Sub CurrentCellMoved()


See Also

GuiGridView Object

2006 SAP AG

512

SAP GUI Scripting API 6.40

4.26.3.6 DeleteRows Method


See Also GuiGridView Object Rows Description The parameter rows is a comma separated string of indices or index ranges, for example 3,5-8,14,15 . The entries must be ordered and not overlap, otherwise an exception is raised. Syntax

Public Sub DeleteRows( _ ByVal Rows As String _ )


Parameters Rows See Also

GuiGridView Object

4.26.3.7 DeselectColumn Method


See Also GuiGridView Object Column Description This function removes the specified column from the collection of the selected columns. Syntax

Public Sub DeselectColumn( _ ByVal Column As String _ )


Parameters Column See Also

GuiGridView Object

2006 SAP AG

Objects 4.26.3.8 DoubleClick Method


See Also GuiGridView Object Row Column Description

513

This function emulates a mouse double click on a given cell if the parameters are valid and raises an exception otherwise. Syntax

Public Sub DoubleClick( _ ByVal Row As Long, _ ByVal Column As String _ )


Parameters Row Column See Also

GuiGridView Object

4.26.3.9 DoubleClickCurrentCell Method


See Also GuiGridView Object Description This function emulates a mouse double click on the current cell. Syntax

Public Sub DoubleClickCurrentCell()


See Also

GuiGridView Object

4.26.3.10 DumpState Method


See Also GuiGridView Object InnerObject

2006 SAP AG

514

SAP GUI Scripting API 6.40


Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks The GridView accepts the following values as innerObject: "Toolbar": The returned GuiCollection contains information about the grids toolbar. Cell(row,column): The values of row and column must identify a cell of the grid (e.g. Cell(2, PRICE)). The returned GuiCollection contains information about the referenced cell.

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry:

2006 SAP AG

Objects OpCode GPR Name ItemCount

515

Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiGridView Object

4.26.3.11 DuplicateRows Method


See Also GuiGridView Object Rows Description The parameter rows is a comma separated string of indices or index ranges, for example 3,5-8,14,15 . For any single index a copy of the row will be inserted at the given index. If a range of indexes is duplicated then all the new lines are inserted as one block, before the old lines. The entries must be ordered and not overlap, otherwise an exception is raised.

2006 SAP AG

516

SAP GUI Scripting API 6.40


Syntax

Public Sub DuplicateRows( _ ByVal Rows As String _ )


Parameters Rows Example 0 1 Value A Value B

If rows is 0,1 then the resulting table would be: 0 1 2 3

Value Value Value Value

A A B 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 See Also

GuiGridView Object

4.26.3.12 FindAllByName Method


See Also GuiGridView Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters

2006 SAP AG

Objects
Name Type See Also

517

GuiGridView Object

4.26.3.13 FindAllByNameEx Method


See Also GuiGridView Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiGridView Object

4.26.3.14 FindById Method


See Also GuiGridView Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

2006 SAP AG

518

SAP GUI Scripting API 6.40 Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiGridView Object

4.26.3.15 FindByName Method


See Also GuiGridView Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiGridView Object

2006 SAP AG

Objects 4.26.3.16 FindByNameEx Method


See Also GuiGridView Object Name Type Description

519

This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiGridView Object

4.26.3.17 GetCellChangeable Method


See Also GuiGridView Object Row Column Description This function returns True if the specified cell is changeable. Syntax

Public Function GetCellChangeable( _ ByVal Row As Long, _ ByVal Column As String _ ) As Boolean
Parameters Row Column See Also

2006 SAP AG

520

SAP GUI Scripting API 6.40

GuiGridView Object

4.26.3.18 GetCellCheckBoxChecked Method


See Also GuiGridView Object Row Column Description Returns True if the checkbox at the specified position is checked. Throws an exception if there is no checkbox in the specified cell. Syntax

Public Function GetCellCheckBoxChecked( _ ByVal Row As Long, _ ByVal Column As String _ ) As Boolean
Parameters Row Column See Also

GuiGridView Object

4.26.3.19 GetCellColor Method


See Also GuiGridView Object Row Column Description Returns an identifier for the color of the cell. This can be used to retrieve the color information using GetColorInfo. Syntax

Public Function GetCellColor( _ ByVal Row As Long, _ ByVal Column As String _ ) As Long

2006 SAP AG

Objects
Parameters Row Column See Also

521

GuiGridView Object

4.26.3.20 GetCellHeight Method


See Also GuiGridView Object Row Column Description Return the height of the cell in pixels. Syntax

Public Function GetCellHeight( _ ByVal Row As Long, _ ByVal Column As String _ ) As Long
Parameters Row Column See Also

GuiGridView Object

4.26.3.21 GetCellIcon Method


See Also GuiGridView Object Row Column Description 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 number or character. Syntax

Public Function GetCellIcon( _

2006 SAP AG

522

SAP GUI Scripting API 6.40 ByVal Row As Long, _ ByVal Column As String _ ) As String
Parameters Row Column See Also

GuiGridView Object

4.26.3.22 GetCellLeft Method


See Also GuiGridView Object Row Column Description Returns the left position of the cell in client coordinates. Syntax

Public Function GetCellLeft( _ ByVal Row As Long, _ ByVal Column As String _ ) As Long
Parameters Row Column See Also

GuiGridView Object

4.26.3.23 GetCellMaxLength Method


See Also GuiGridView Object Row Column Description

2006 SAP AG

Objects
Returns the maximum length of the cell in number of bytes. Syntax

523

Public Function GetCellMaxLength( _ ByVal Row As Long, _ ByVal Column As String _ ) As Long
Parameters Row Column See Also

GuiGridView Object

4.26.3.24 GetCellState Method


See Also GuiGridView Object Row Column Description Returns the state of the cell. Possible values are: Normal Error Warning Info Syntax

Public Function GetCellState( _ ByVal Row As Long, _ ByVal Column As String _ ) As String
Parameters Row Column See Also

GuiGridView Object

2006 SAP AG

524

SAP GUI Scripting API 6.40

4.26.3.25 GetCellTooltip Method


See Also GuiGridView Object Row Column Description Returns the tooltip of the cell. Syntax

Public Function GetCellTooltip( _ ByVal Row As Long, _ ByVal Column As String _ ) As String
Parameters Row Column See Also

GuiGridView Object

4.26.3.26 GetCellTop Method


See Also GuiGridView Object Row Column Description Returns the top position of the cell in client coordinates. Syntax

Public Function GetCellTop( _ ByVal Row As Long, _ ByVal Column As String _ ) As Long
Parameters Row Column See Also

2006 SAP AG

Objects

525

GuiGridView Object

4.26.3.27 GetCellType Method


See Also GuiGridView Object Row Column Description This function returns the type of the specified cell. Possible values are: Normal Button Checkbox ValueList RadioButton Syntax

Public Function GetCellType( _ ByVal Row As Long, _ ByVal Column As String _ ) As String
Parameters Row Column See Also

GuiGridView Object

4.26.3.28 GetCellValue Method


See Also GuiGridView Object Row Column Description This function returns the value of the specified cell. Syntax

Public Function GetCellValue( _

2006 SAP AG

526

SAP GUI Scripting API 6.40 ByVal Row As Long, _ ByVal Column As String _ ) As String
Parameters Row Column See Also

GuiGridView Object

4.26.3.29 GetCellWidth Method


See Also GuiGridView Object Row Column Description Returns the width of the cell in pixels. Syntax

Public Function GetCellWidth( _ ByVal Row As Long, _ ByVal Column As String _ ) As Long
Parameters Row Column See Also

GuiGridView Object

4.26.3.30 GetColorInfo Method


See Also GuiGridView Object Color Identifier returned by GetCellColor Description Returns the description for the color of the cell. Syntax

2006 SAP AG

Objects Public Function GetColorInfo( _ ByVal Color As Long _ ) As String


Parameters Color Identifier returned by GetCellColor Remarks This function will only return a value when the accessibility mode of SAP GUI is enabled. See Also

527

GuiGridView Object

4.26.3.31 GetColumnDataType Method


See Also GuiGridView Object Column Description Returns the data type of the column according to the 'built-in datatypes' of the XML schema standard. Syntax

Public Function GetColumnDataType( _ ByVal Column As String _ ) As String


Parameters Column See Also

GuiGridView Object

4.26.3.32 GetColumnPosition Method


See Also GuiGridView Object Column Description Returns the position of the column as shown on the screen, starting from 1. Syntax

2006 SAP AG

528

SAP GUI Scripting API 6.40 Public Function GetColumnPosition( _ ByVal Column As String _ ) As Long
Parameters Column See Also

GuiGridView Object

4.26.3.33 GetColumnSortType Method


See Also GuiGridView Object Column Description Returns the sort type of the column. Possible values are: None Ascending Descending Syntax

Public Function GetColumnSortType( _ ByVal Column As String _ ) As String


Parameters Column See Also

GuiGridView Object

4.26.3.34 GetColumnTitles Method


See Also GuiGridView Object Column Description This function returns a collection of strings that are used to display the title of a column. The control chooses the appropriate title according to the width of the column. Syntax

2006 SAP AG

Objects Public Function GetColumnTitles( _ ByVal Column As String _ ) As Object


Parameters Column See Also

529

GuiGridView Object

4.26.3.35 GetColumnTooltip Method


See Also GuiGridView Object Column Description The tooltip of a column contains a text which is designed to help the user understands the meaning of the column. Syntax

Public Function GetColumnTooltip( _ ByVal Column As String _ ) As String


Parameters Column See Also

GuiGridView Object

4.26.3.36 GetColumnTotalType Method


See Also GuiGridView Object Column Description Returns the total type of the column. Possible values are: None Total Subtotal Syntax

2006 SAP AG

530

SAP GUI Scripting API 6.40 Public Function GetColumnTotalType( _ ByVal Column As String _ ) As String
Parameters Column See Also

GuiGridView Object

4.26.3.37 GetDisplayedColumnTitle Method


See Also GuiGridView Object Column Description This function returns the title of the column that is currently displayed. This text is one of the values of the collection returned from the function getColumnTitles. Syntax

Public Function GetDisplayedColumnTitle( _ ByVal Column As String _ ) As String


Parameters Column See Also

GuiGridView Object

4.26.3.38 GetRowTotalLevel Method


See Also GuiGridView Object Row Description Returns the level of the row. Syntax

Public Function GetRowTotalLevel( _ ByVal Row As Long _

2006 SAP AG

Objects ) As Long
Parameters Row Example In this example the level is visualized by the number of dots in the sum/total column.

531

See Also

GuiGridView Object

4.26.3.39 GetSymbolInfo Method


See Also GuiGridView Object Symbol Value of the cell. Description Returns the description for the symbol in the cell. Syntax

Public Function GetSymbolInfo( _ ByVal Symbol As String _ ) As String


Parameters Symbol Value of the cell. Remarks This function will only return a value when the accessibility mode of SAP GUI is enabled. See Also

2006 SAP AG

532

SAP GUI Scripting API 6.40


GuiGridView Object

4.26.3.40 GetToolbarButtonChecked Method


See Also GuiGridView Object ButtonPos Description Returns True if the button is currently checked (pressed). Syntax

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


Parameters ButtonPos See Also

GuiGridView Object

4.26.3.41 GetToolbarButtonEnabled Method


See Also GuiGridView Object ButtonPos Description Indicates if the button can be pressed. Syntax

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


Parameters ButtonPos See Also

GuiGridView Object

2006 SAP AG

Objects 4.26.3.42 GetToolbarButtonIcon Method


See Also GuiGridView Object ButtonPos Description Returns the name of the icon of the specified toolbar button. Syntax

533

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


Parameters ButtonPos See Also

GuiGridView Object

4.26.3.43 GetToolbarButtonId Method


See Also GuiGridView Object ButtonPos Description Returns the ID of the specified toolbar button, as defined in the ABAP data dictionary. Syntax

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


Parameters ButtonPos See Also

GuiGridView Object

2006 SAP AG

534

SAP GUI Scripting API 6.40

4.26.3.44 GetToolbarButtonText Method


See Also GuiGridView Object ButtonPos Description Returns the text of the specified toolbar button. Syntax

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


Parameters ButtonPos See Also

GuiGridView Object

4.26.3.45 GetToolbarButtonTooltip Method


See Also GuiGridView Object ButtonPos Description Returns the tooltip of the specified toolbar button. Syntax

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


Parameters ButtonPos See Also

GuiGridView Object

2006 SAP AG

Objects 4.26.3.46 GetToolbarButtonType Method


See Also GuiGridView Object ButtonPos Description Returns the type of the specified toolbar button. Possible values are: "Button", "ButtonAndMenu", "Menu", "Separator", "Group", "CheckBox" Syntax

535

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


Parameters ButtonPos See Also

GuiGridView Object

4.26.3.47 GetToolbarFocusButton Method


See Also GuiGridView Object Description Returns the position of the toolbar button that has the focus. If no button in the toolbar has the focus, the method returns -1. Syntax

Public Function GetToolbarFocusButton() As Long


See Also

GuiGridView Object

4.26.3.48 HasCellF4Help Method


See Also GuiGridView Object Row Column Description

2006 SAP AG

536

SAP GUI Scripting API 6.40


Returns True if the cell has a value help. Syntax

Public Function HasCellF4Help( _ ByVal Row As Long, _ ByVal Column As String _ ) As Boolean
Parameters Row Column Example

See Also

GuiGridView Object

4.26.3.49 InsertRows Method


See Also GuiGridView Object Rows Description The parameter rows is a comma separated text of indices or index ranges, for example 3,5-8,14,15. For any single index, a new row will be added at the given index, moving the old row one line down. If a range of indexes is inserted then all the new lines are inserted as one block, before any of the old lines. The entries must be ordered and not overlap, otherwise, an exception is raised. Syntax

Public Sub InsertRows( _ ByVal Rows As String _ )


Parameters Rows Example 0 1 Value A Value B

If rows is 0,1, then the resulting table would be: 0 1 Value A

2006 SAP AG

Objects
2 3 Value B

537

If, on the other hand, rows is 0-1, then the resulting table is: 0 1 2 3 See Also Value A Value B

GuiGridView Object

4.26.3.50 IsCellHotspot Method


See Also GuiGridView Object Row Column Description Returns True if the cell is a link. Syntax

Public Function IsCellHotspot( _ ByVal Row As Long, _ ByVal Column As String _ ) As Boolean
Parameters Row Column Example

See Also

GuiGridView Object

2006 SAP AG

538

SAP GUI Scripting API 6.40

4.26.3.51 IsCellSymbol Method


See Also GuiGridView Object Row Column Description Returns True if the text in the cell is displayed in the SAP symbol font. Syntax

Public Function IsCellSymbol( _ ByVal Row As Long, _ ByVal Column As String _ ) As Boolean
Parameters Row Column Example

See Also

GuiGridView Object

4.26.3.52 IsCellTotalExpander Method


See Also GuiGridView Object Row Column Description Returns True if the cell contains a total expander button. Syntax

Public Function IsCellTotalExpander( _ ByVal Row As Long, _ ByVal Column As String _ ) As Boolean
Parameters

2006 SAP AG

Objects
Row Column Example

539

See Also

GuiGridView Object

4.26.3.53 IsColumnFiltered Method


See Also GuiGridView Object Column Description Returns True if a filter was applied to the column. Syntax

Public Function IsColumnFiltered( _ ByVal Column As String _ ) As Boolean


Parameters Column Example

See Also

GuiGridView Object

2006 SAP AG

540

SAP GUI Scripting API 6.40

4.26.3.54 IsColumnKey Method


See Also GuiGridView Object Column Description Returns True if the column is marked as a key column. Syntax

Public Function IsColumnKey( _ ByVal Column As String _ ) As Boolean


Parameters Column See Also

GuiGridView Object

4.26.3.55 IsTotalRowExpanded Method


See Also GuiGridView Object Row Description Returns true if the row containing an expander is currently expanded. Syntax

Public Function IsTotalRowExpanded( _ ByVal Row As Long _ ) As Boolean


Parameters Row Example Expanded:

Collapsed:

2006 SAP AG

Objects

541

See Also

GuiGridView Object

4.26.3.56 ModifyCell Method


See Also GuiGridView Object Row Column Value Description 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. Otherwise, an exception is raised. Syntax

Public Sub ModifyCell( _ ByVal Row As Long, _ ByVal Column As String, _ ByVal Value As String _ )
Parameters Row Column Value See Also

GuiGridView Object

4.26.3.57 ModifyCheckBox Method


See Also GuiGridView Object Row Column Checked

2006 SAP AG

542

SAP GUI Scripting API 6.40

Description If row and column identify a valid editable cell containing a checkbox, then the value of the cell is changed. Otherwise, an exception is raised. Syntax

Public Sub ModifyCheckBox( _ ByVal Row As Long, _ ByVal Column As String, _ ByVal Checked As Boolean _ )
Parameters Row Column Checked See Also

GuiGridView Object

4.26.3.58 MoveRows Method


See Also GuiGridView Object FromRow ToRow DestRow Description The rows with an index greater than or equal to fromRow up to an index less than or equal to toRow are moved to the position of destRow . Passing invalid index values as parameters raises an exception. Syntax

Public Sub MoveRows( _ ByVal FromRow As Long, _ ByVal ToRow As Long, _ ByVal DestRow As Long _ )
Parameters FromRow ToRow DestRow

2006 SAP AG

Objects
See Also

543

GuiGridView Object

4.26.3.59 PressButton Method


See Also GuiGridView Object Row Column Description This function emulates pressing a button placed in a given cell. It will raise an exception if the cell does not contain a button, or does not even exist. Syntax

Public Sub PressButton( _ ByVal Row As Long, _ ByVal Column As String _ )


Parameters Row Column See Also

GuiGridView Object

4.26.3.60 PressButtonCurrentCell Method


See Also GuiGridView Object Description This function emulates pressing a button placed in the current cell. It will raise an exception if the cell does not contain a button. Syntax

Public Sub PressButtonCurrentCell()


See Also

GuiGridView Object

2006 SAP AG

544

SAP GUI Scripting API 6.40

4.26.3.61 PressColumnHeader Method


See Also GuiGridView Object Column Description This function emulates a mouse click on the header of the column if the parameter identifies a valid column and raises an exception otherwise. Syntax

Public Sub PressColumnHeader( _ ByVal Column As String _ )


Parameters Column See Also

GuiGridView Object

4.26.3.62 PressEnter Method


See Also GuiGridView Object Description This emulates pressing the Enter key. Syntax

Public Sub PressEnter()


See Also

GuiGridView Object

4.26.3.63 PressF1 Method


See Also GuiGridView Object Description This emulates pressing the F1 key while the focus is on the grid view. Syntax

Public Sub PressF1()

2006 SAP AG

Objects
See Also

545

GuiGridView Object

4.26.3.64 PressF4 Method


See Also GuiGridView Object Description This emulates pressing the F4 key. Syntax

Public Sub PressF4()


See Also

GuiGridView Object

4.26.3.65 PressToolbarButton Method


See Also GuiGridView Object Id Description This function emulates clicking a button in the grid views toolbar. Syntax

Public Sub PressToolbarButton( _ ByVal Id As String _ )


Parameters Id See Also

GuiGridView Object

4.26.3.66 PressToolbarContextButton Method


See Also GuiGridView Object Id

2006 SAP AG

546

SAP GUI Scripting API 6.40


Description This emulates opening the context menu of the grid views toolbar. Syntax

Public Sub PressToolbarContextButton( _ ByVal Id As String _ )


Parameters Id See Also

GuiGridView Object

4.26.3.67 PressTotalRow Method


See Also GuiGridView Object Row Column Description

Pressing the total row button expands or condenses the grouped rows. If the selected cell is not a total row cell an exception is raised.
Syntax

Public Sub PressTotalRow( _ ByVal Row As Long, _ ByVal Column As String _ )


Parameters Row Column Example

2006 SAP AG

Objects

547

See Also

GuiGridView Object

4.26.3.68 PressTotalRowCurrentCell Method


See Also GuiGridView Object Description This function differs from pressTotalRow only in that it tries to press the expansion button on the current cell. Syntax

Public Sub PressTotalRowCurrentCell()


See Also

GuiGridView Object

4.26.3.69 SelectAll Method


See Also GuiGridView Object Description This function selects the whole grid content (i.e. all rows and all columns). Syntax

Public Sub SelectAll()

2006 SAP AG

548

SAP GUI Scripting API 6.40


See Also

GuiGridView Object

4.26.3.70 SelectColumn Method


See Also GuiGridView Object Column Description This function adds the specified column to the collection of the selected columns. Syntax

Public Sub SelectColumn( _ ByVal Column As String _ )


Parameters Column See Also

GuiGridView Object

4.26.3.71 SelectContextMenuItem Method


See Also GuiGridView Object FunctionCode Description Select an item from the controls context menu. Syntax

Public Sub SelectContextMenuItem( _ ByVal FunctionCode As String _ )


Parameters FunctionCode See Also

GuiGridView Object

2006 SAP AG

Objects 4.26.3.72 SelectContextMenuItemByPosition Method


See Also GuiGridView Object PositionDesc Description

549

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item text. Syntax

Public Sub SelectContextMenuItemByPosition( _ ByVal PositionDesc As String _ )


Parameters PositionDesc Remarks The parameter is a string containing the path to the item. If the context menu item is on the top level menu, this is just the zero-base index of the item. Otherwise, the positions on the menu and respective submenus should be concatenated, separated by "|". See Also

GuiGridView Object

4.26.3.73 SelectContextMenuItemByText Method


See Also GuiGridView Object Text Description Select a menu item of a context menu using the text of the item and possible higher level menus. Syntax

Public Sub SelectContextMenuItemByText( _ ByVal Text As String _ )


Parameters Text See Also

GuiGridView Object

2006 SAP AG

550

SAP GUI Scripting API 6.40

4.26.3.74 SelectionChanged Method


See Also GuiGridView Object Description This function notifies the server that the selection has changed. Syntax

Public Sub SelectionChanged()


See Also

GuiGridView Object

4.26.3.75 SelectToolbarMenuItem Method


See Also GuiGridView Object Id Description This function emulates the selection of an item from the context menu of the grid views toolbar. The parameter should be the function code of the item. Syntax

Public Sub SelectToolbarMenuItem( _ ByVal Id As String _ )


Parameters Id See Also

GuiGridView Object

4.26.3.76 SetColumnWidth Method


See Also GuiGridView Object Column Width Description The width of a column can be set using this function. The width is given in characters. For proportional fonts this refers to the width of an average character. Depending on the contents of the cell more or

2006 SAP AG

Objects
less characters may fit in the column. If the parameter is invalid an exception is raised. Syntax

551

Public Sub SetColumnWidth( _ ByVal Column As String, _ ByVal Width As Long _ )


Parameters Column Width See Also

GuiGridView Object

4.26.3.77 SetCurrentCell Method


See Also GuiGridView Object Row Column Description If row and column identify a valid cell, this cell becomes the current cell. Otherwise, an exception is raised. Syntax

Public Sub SetCurrentCell( _ ByVal Row As Long, _ ByVal Column As String _ )


Parameters Row Column See Also

GuiGridView Object

4.26.3.78 SetFocus Method


See Also GuiGridView Object Description

2006 SAP AG

552

SAP GUI Scripting API 6.40


This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiGridView Object

4.26.3.79 ShowContextMenu Method


See Also GuiGridView Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiGridView Object

4.26.3.80 TriggerModified Method


See Also GuiGridView Object Description Notifies the server of multiple changes in cells. Typically this method should be called after multiple calls to ModifyCell. Syntax

Public Sub TriggerModified()


See Also

GuiGridView Object

2006 SAP AG

Objects 4.26.3.81 Visualize Method


See Also GuiGridView Object On InnerObject Description

553

Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiGridView Object

4.26.4 Properties
4.26.4.1 AccDescription Property
See Also GuiGridView Object Description Accessibility description of the shell. This description can be used for shells that do not have a title element. Property type Read-only property Syntax (Visual Basic)

Public Property AccDescription() As String


See Also

GuiGridView Object

2006 SAP AG

554

SAP GUI Scripting API 6.40

4.26.4.2 AccLabelCollection Property


See Also GuiGridView Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiGridView Object

4.26.4.3 AccText Property


See Also GuiGridView Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiGridView Object

4.26.4.4 AccTextOnRequest Property


See Also GuiGridView Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property AccTextOnRequest() As String


See Also

555

GuiGridView Object

4.26.4.5 AccTooltip Property


See Also GuiGridView Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiGridView Object

4.26.4.6 Changeable Property


See Also GuiGridView Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiGridView Object

2006 SAP AG

556

SAP GUI Scripting API 6.40

4.26.4.7 Children Property


See Also GuiGridView Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiGridView Object

4.26.4.8 ColumnCount Property


See Also GuiGridView Object Description This property represents the number of columns in the control. Property type Read-only property Syntax (Visual Basic)

Public Property ColumnCount() As Long


See Also

GuiGridView Object

4.26.4.9 ColumnOrder Property


See Also GuiGridView Object Description This collection contains all the column identifiers in the order in which they are currently displayed. Passing an invalid column identifier to this property will raise an exception. Property type Read-write property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property ColumnOrder() As Object


See Also

557

GuiGridView Object

4.26.4.10 ContainerType Property


See Also GuiGridView Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiGridView Object

4.26.4.11 CurrentCellColumn Property


See Also GuiGridView Object Description The string identifying a column is the field name defined in the SAP data dictionary. In the example above the identifiers are named CARRID, CONNID, FLDATE, PRICE etc. Property type Read-write property Syntax (Visual Basic)

Public Property CurrentCellColumn() As String


See Also

GuiGridView Object

2006 SAP AG

558

SAP GUI Scripting API 6.40

4.26.4.12 CurrentCellRow Property


See Also GuiGridView Object Description The row index of the current cell ranges from 0 to the number of rows less 1, with -1 being the index of the title row. Property type Read-write property Syntax (Visual Basic)

Public Property CurrentCellRow() As Long


See Also

GuiGridView Object

4.26.4.13 CurrentContextMenu Property


See Also GuiGridView Object Description This property is only set when a context menu is available at the shell object. Property type Read-only property Syntax (Visual Basic)

Public Property CurrentContextMenu() As GuiContextMenu


See Also

GuiGridView Object

4.26.4.14 DefaultTooltip Property


See Also GuiGridView Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property DefaultTooltip() As String


See Also

559

GuiGridView Object

4.26.4.15 DragDropSupported Property


See Also GuiGridView Object Description This property is True if the shell allows drag and drop operations. Property type Read-only property Syntax (Visual Basic)

Public Property DragDropSupported() As Boolean


See Also

GuiGridView Object

4.26.4.16 FirstVisibleColumn Property


See Also GuiGridView Object Description This property represents the first visible column of the scrollable area of the grid view. Fixed columns are ignored. Setting the property to an invalid column identifier will raise an exception. Property type Read-write property Syntax (Visual Basic)

Public Property FirstVisibleColumn() As String


See Also

GuiGridView Object

2006 SAP AG

560

SAP GUI Scripting API 6.40

4.26.4.17 FirstVisibleRow Property


See Also GuiGridView Object Description This is the index of the first visible row in the grid. Setting this property to an invalid row index will raise an exception. Property type Read-write property Syntax (Visual Basic)

Public Property FirstVisibleRow() As Long


See Also

GuiGridView Object

4.26.4.18 FrozenColumnCount Property


See Also GuiGridView Object Description This property represents the number of columns that are excluded from horizontal scrolling. Property type Read-only property Syntax (Visual Basic)

Public Property FrozenColumnCount() As Long


See Also

GuiGridView Object

4.26.4.19 Handle Property


See Also GuiGridView Object Description The window handle of the control that is connected to the GuiShell. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Handle() As Long


See Also

561

GuiGridView Object

4.26.4.20 Height Property


See Also GuiGridView Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiGridView Object

4.26.4.21 IconName Property


See Also GuiGridView Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiGridView Object

2006 SAP AG

562

SAP GUI Scripting API 6.40

4.26.4.22 Id Property
See Also GuiGridView Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiGridView Object

4.26.4.23 IsSymbolFont Property


See Also GuiGridView Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean

2006 SAP AG

Objects
See Also

563

GuiGridView Object

4.26.4.24 Left Property


See Also GuiGridView Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiGridView Object

4.26.4.25 Modified Property


See Also GuiGridView Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiGridView Object

4.26.4.26 Name Property


See Also GuiGridView Object Description The name property is especially useful when working with simple scripts that only access dynpro fields.

2006 SAP AG

564

SAP GUI Scripting API 6.40


In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiGridView Object

4.26.4.27 OcxEvents Property


See Also GuiGridView Object Description Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. Property type Read-only property Syntax (Visual Basic)

Public Property OcxEvents() As GuiCollection


See Also

GuiGridView Object

4.26.4.28 Parent Property


See Also GuiGridView Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

2006 SAP AG

Objects
GuiGridView Object

565

4.26.4.29 ParentFrame Property


See Also GuiGridView Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiGridView Object

4.26.4.30 RowCount Property


See Also GuiGridView Object Description This property represents the number of rows in the control. Property type Read-only property Syntax (Visual Basic)

Public Property RowCount() As Long


See Also

GuiGridView Object

4.26.4.31 ScreenLeft Property


See Also GuiGridView Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

566

SAP GUI Scripting API 6.40 Public Property ScreenLeft() As Long


See Also

GuiGridView Object

4.26.4.32 ScreenTop Property


See Also GuiGridView Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiGridView Object

4.26.4.33 SelectedCells Property


See Also GuiGridView Object Description The collection of selected cells contains strings, each of which has the format <index of the row>,< column identifier>, such as 0,CARRID. Trying to set this property to an invalid value will raise an exception. Property type Read-write property Syntax (Visual Basic)

Public Property SelectedCells() As Object


See Also

GuiGridView Object

2006 SAP AG

Objects 4.26.4.34 SelectedColumns Property


See Also GuiGridView Object Description

567

The selected columns are available as a collection of strings like the currentCellColumn string. Setting this property can raise an exception, if the new collection contains an invalid column identifier. Property type Read-write property Syntax (Visual Basic)

Public Property SelectedColumns() As Object


See Also

GuiGridView Object

4.26.4.35 SelectedRows Property


See Also GuiGridView Object Description 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 an invalid string or a string containing invalid row indices will raise an exception. Property type Read-write property Syntax (Visual Basic)

Public Property SelectedRows() As String


See Also

GuiGridView Object

4.26.4.36 SelectionMode Property


See Also GuiGridView Object Description Possible values are: RowsAndColumns: Only rows and columns can be selected. Individual rectangular areas of cells are not allowed. ListboxSingle: Only one single row can be selected. ListboxMultiple: One or more rows can be selected.

2006 SAP AG

568

SAP GUI Scripting API 6.40


Free: Any kind of selection can be made. Property type Read-only property Syntax (Visual Basic)

Public Property SelectionMode() As String


See Also

GuiGridView Object

4.26.4.37 SubType Property


See Also GuiGridView Object Description Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value GridView. Property type Read-only property Syntax (Visual Basic)

Public Property SubType() As String


See Also

GuiGridView Object

4.26.4.38 Text Property


See Also GuiGridView Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

2006 SAP AG

Objects
GuiGridView Object

569

4.26.4.39 Title Property


See Also GuiGridView Object Description This property represents title of the grid control. Property type Read-only property Syntax (Visual Basic)

Public Property Title() As String


See Also

GuiGridView Object

4.26.4.40 ToolbarButtonCount Property


See Also GuiGridView Object Description The number of toolbar buttons including separators. Property type Read-only property Syntax (Visual Basic)

Public Property ToolbarButtonCount() As Long


See Also

GuiGridView Object

4.26.4.41 Tooltip Property


See Also GuiGridView Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property

2006 SAP AG

570

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiGridView Object

4.26.4.42 Top Property


See Also GuiGridView Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiGridView Object

4.26.4.43 Type Property


See Also GuiGridView Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiGridView Object

2006 SAP AG

Objects 4.26.4.44 TypeAsNumber Property


See Also GuiGridView Object Description

571

While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiGridView Object

4.26.4.45 VisibleRowCount Property


See Also GuiGridView Object Description Retrieves the number of visible rows of the grid. Property type Read-only property Syntax (Visual Basic)

Public Property VisibleRowCount() As Long


See Also

GuiGridView Object

4.26.4.46 Width Property


See Also GuiGridView Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

572

SAP GUI Scripting API 6.40 Public Property Width() As Long


See Also

GuiGridView Object

4.27

GuiHTMLViewer Object
See Also GuiHTMLViewer Members Description The GuiHTMLViewer is used to display an HTML document inside SAP GUI. GuiHTMLViewer extends GuiShell. For a list of all members defined in this module, see GuiHTMLViewer members. Object Model

See Also

GuiHTMLViewer Members

2006 SAP AG

Objects

573

4.27.1 Overview
See Also GuiHTMLViewer Members Description The GuiHTMLViewer is used to display an HTML document inside SAP GUI. GuiHTMLViewer extends GuiShell. For a list of all members defined in this module, see GuiHTMLViewer members. Object Model

See Also

GuiHTMLViewer Members

4.27.2 Members
See Also GuiHTMLViewer Overview Public Methods ContextMenu Calling contextMenu emulates the context menu request. Note that this function applies only to context menus provided by the backend, not to the local context menu, which is generated by the HTML control.

2006 SAP AG

574

SAP GUI Scripting API 6.40


This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. This function submits an HTML form to the backend. Select an item from the controls context menu.

DumpState

FindAllByName

FindAllByNameEx

FindById

FindByName

FindByNameEx

SapEvent SelectContextMenuItem

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item SelectContextMenuItemByPo text. sition Select a menu item of a context menu using the text of the item and possible higher level menus. SelectContextMenuItemByTe xt This function can be used to set the focus onto an object. If a user SetFocus interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. ShowContextMenu Calling this method of a component will display a red frame around Visualize the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Public Properties

2006 SAP AG

Objects

575

AccDescription AccLabelCollection AccText AccTextOnRequest AccTooltip BrowserHandle Changeable Children ContainerType CurrentContextMenu DefaultTooltip DocumentComplete DragDropSupported Handle Height IconName Id

Accessibility description of the shell. This description can be used for shells that do not have a title element. The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support.

An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. This property is only set when a context menu is available at the shell object. Tooltip text generated from the short text defined in the data dictionary for the given screen element type.

This property is True if the shell allows drag and drop operations. The window handle of the control that is connected to the GuiShell. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value HTMLViewer.

IsSymbolFont Left Modified Name

OcxEvents Parent ParentFrame ScreenLeft ScreenTop SubType

2006 SAP AG

576

SAP GUI Scripting API 6.40


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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

Text

Tooltip Top Type

TypeAsNumber

Width See Also

GuiHTMLViewer Overview

4.27.3 Methods
4.27.3.1 ContextMenu Method
See Also GuiHTMLViewer Object Description Calling contextMenu emulates the context menu request. Note that this function applies only to context menus provided by the backend, not to the local context menu, which is generated by the HTML control. Syntax

Public Sub ContextMenu()


See Also

GuiHTMLViewer Object

4.27.3.2 DumpState Method


See Also GuiHTMLViewer Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the

2006 SAP AG

Objects

577

GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry:

2006 SAP AG

578

SAP GUI Scripting API 6.40 OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiHTMLViewer Object

4.27.3.3 FindAllByName Method


See Also GuiHTMLViewer Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name

2006 SAP AG

Objects
Type See Also

579

GuiHTMLViewer Object

4.27.3.4 FindAllByNameEx Method


See Also GuiHTMLViewer Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiHTMLViewer Object

4.27.3.5 FindById Method


See Also GuiHTMLViewer Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _

2006 SAP AG

580

SAP GUI Scripting API 6.40 ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiHTMLViewer Object

4.27.3.6 FindByName Method


See Also GuiHTMLViewer Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiHTMLViewer Object

2006 SAP AG

Objects 4.27.3.7 FindByNameEx Method


See Also GuiHTMLViewer Object Name Type Description

581

This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiHTMLViewer Object

4.27.3.8 SapEvent Method


See Also GuiHTMLViewer Object FrameName This is the name of the frame in which the HTML form that has been submitted lives. PostData Contains the form data when a submit is made using the POST method. Url This is the URL which is submitted to the backend. The protocol name for the URL string is sapevent:. This is followed by the name of the event as defined in the Action Property of the HTML form which is called. Description This function submits an HTML form to the backend. Syntax

Public Sub SapEvent( _ ByVal FrameName As String, _ ByVal PostData As String, _ ByVal Url As String _ )
Parameters FrameName

2006 SAP AG

582

SAP GUI Scripting API 6.40


This is the name of the frame in which the HTML form that has been submitted lives. PostData Contains the form data when a submit is made using the POST method. Url This is the URL which is submitted to the backend. The protocol name for the URL string is sapevent: . This is followed by the name of the event as defined in the Action Property of the HTML form which is called. Remarks If the form is to be submitted using the GET method, the data is appended to the event name in the usual http URL fashion, for example: sapEvent("Frame1","","sapevent:SUBMIT_FORM_AS_GET_METHOD?FirstName=John& LastName=Smith"); In this case, postData is always an empty string. If the form is to be submitted using the POST method, the data is transported in the postData parameter: sapEvent("Frame1","FirstName=John&LastName=Smith","sapevent: SUBMIT_FORM_AS_POST_METHOD");

See Also

GuiHTMLViewer Object

4.27.3.9 SelectContextMenuItem Method


See Also GuiHTMLViewer Object FunctionCode Description Select an item from the controls context menu. Syntax

Public Sub SelectContextMenuItem( _ ByVal FunctionCode As String _ )


Parameters FunctionCode See Also

GuiHTMLViewer Object

2006 SAP AG

Objects 4.27.3.10 SelectContextMenuItemByPosition Method


See Also GuiHTMLViewer Object PositionDesc Description

583

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item text. Syntax

Public Sub SelectContextMenuItemByPosition( _ ByVal PositionDesc As String _ )


Parameters PositionDesc Remarks The parameter is a string containing the path to the item. If the context menu item is on the top level menu, this is just the zero-base index of the item. Otherwise, the positions on the menu and respective submenus should be concatenated, separated by "|". See Also

GuiHTMLViewer Object

4.27.3.11 SelectContextMenuItemByText Method


See Also GuiHTMLViewer Object Text Description Select a menu item of a context menu using the text of the item and possible higher level menus. Syntax

Public Sub SelectContextMenuItemByText( _ ByVal Text As String _ )


Parameters Text See Also

GuiHTMLViewer Object

2006 SAP AG

584

SAP GUI Scripting API 6.40

4.27.3.12 SetFocus Method


See Also GuiHTMLViewer Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiHTMLViewer Object

4.27.3.13 ShowContextMenu Method


See Also GuiHTMLViewer Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiHTMLViewer Object

4.27.3.14 Visualize Method


See Also GuiHTMLViewer Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

2006 SAP AG

Objects
Syntax

585

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiHTMLViewer Object

4.27.4 Properties
4.27.4.1 AccDescription Property
See Also GuiHTMLViewer Object Description Accessibility description of the shell. This description can be used for shells that do not have a title element. Property type Read-only property Syntax (Visual Basic)

Public Property AccDescription() As String


See Also

GuiHTMLViewer Object

4.27.4.2 AccLabelCollection Property


See Also GuiHTMLViewer Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection

2006 SAP AG

586

SAP GUI Scripting API 6.40


See Also

GuiHTMLViewer Object

4.27.4.3 AccText Property


See Also GuiHTMLViewer Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiHTMLViewer Object

4.27.4.4 AccTextOnRequest Property


See Also GuiHTMLViewer Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiHTMLViewer Object

4.27.4.5 AccTooltip Property


See Also GuiHTMLViewer Object Description An additional tooltip text for accessibility support.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

587

Public Property AccTooltip() As String


See Also

GuiHTMLViewer Object

4.27.4.6 BrowserHandle Property


See Also GuiHTMLViewer Object Property type Read-only property Syntax (Visual Basic)

Public Property BrowserHandle() As Object


See Also

GuiHTMLViewer Object

4.27.4.7 Changeable Property


See Also GuiHTMLViewer Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiHTMLViewer Object

2006 SAP AG

588

SAP GUI Scripting API 6.40

4.27.4.8 Children Property


See Also GuiHTMLViewer Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

Public Property Children() As GuiComponentCollection


See Also

GuiHTMLViewer Object

4.27.4.9 ContainerType Property


See Also GuiHTMLViewer Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiHTMLViewer Object

4.27.4.10 CurrentContextMenu Property


See Also GuiHTMLViewer Object Description This property is only set when a context menu is available at the shell object. Property type Read-only property Syntax (Visual Basic)

Public Property CurrentContextMenu() As GuiContextMenu

2006 SAP AG

Objects
See Also

589

GuiHTMLViewer Object

4.27.4.11 DefaultTooltip Property


See Also GuiHTMLViewer Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiHTMLViewer Object

4.27.4.12 DocumentComplete Property


See Also GuiHTMLViewer Object Property type Read-only property Syntax (Visual Basic)

Public Property DocumentComplete() As Long


See Also

GuiHTMLViewer Object

4.27.4.13 DragDropSupported Property


See Also GuiHTMLViewer Object Description This property is True if the shell allows drag and drop operations. Property type Read-only property

2006 SAP AG

590

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property DragDropSupported() As Boolean


See Also

GuiHTMLViewer Object

4.27.4.14 Handle Property


See Also GuiHTMLViewer Object Description The window handle of the control that is connected to the GuiShell. Property type Read-only property Syntax (Visual Basic)

Public Property Handle() As Long


See Also

GuiHTMLViewer Object

4.27.4.15 Height Property


See Also GuiHTMLViewer Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiHTMLViewer Object

2006 SAP AG

Objects 4.27.4.16 IconName Property


See Also GuiHTMLViewer Object Description

591

If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiHTMLViewer Object

4.27.4.17 Id Property
See Also GuiHTMLViewer Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well.

2006 SAP AG

592

SAP GUI Scripting API 6.40


See Also

GuiHTMLViewer Object

4.27.4.18 IsSymbolFont Property


See Also GuiHTMLViewer Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiHTMLViewer Object

4.27.4.19 Left Property


See Also GuiHTMLViewer Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiHTMLViewer Object

4.27.4.20 Modified Property


See Also GuiHTMLViewer Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

593

Public Property Modified() As Boolean


See Also

GuiHTMLViewer Object

4.27.4.21 Name Property


See Also GuiHTMLViewer Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiHTMLViewer Object

4.27.4.22 OcxEvents Property


See Also GuiHTMLViewer Object Description Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. Property type Read-only property Syntax (Visual Basic)

Public Property OcxEvents() As GuiCollection


See Also

GuiHTMLViewer Object

2006 SAP AG

594

SAP GUI Scripting API 6.40

4.27.4.23 Parent Property


See Also GuiHTMLViewer Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiHTMLViewer Object

4.27.4.24 ParentFrame Property


See Also GuiHTMLViewer Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiHTMLViewer Object

4.27.4.25 ScreenLeft Property


See Also GuiHTMLViewer Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property ScreenLeft() As Long


See Also

595

GuiHTMLViewer Object

4.27.4.26 ScreenTop Property


See Also GuiHTMLViewer Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiHTMLViewer Object

4.27.4.27 SubType Property


See Also GuiHTMLViewer Object Description Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView This property has the constant value HTMLViewer. Property type Read-only property Syntax (Visual Basic)

Public Property SubType() As String


See Also

GuiHTMLViewer Object

2006 SAP AG

596

SAP GUI Scripting API 6.40

4.27.4.28 Text Property


See Also GuiHTMLViewer Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiHTMLViewer Object

4.27.4.29 Tooltip Property


See Also GuiHTMLViewer Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiHTMLViewer Object

4.27.4.30 Top Property


See Also GuiHTMLViewer Object Description Top coordinate of the element in screen coordinates. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

597

Public Property Top() As Long


See Also

GuiHTMLViewer Object

4.27.4.31 Type Property


See Also GuiHTMLViewer Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiHTMLViewer Object

4.27.4.32 TypeAsNumber Property


See Also GuiHTMLViewer Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiHTMLViewer Object

2006 SAP AG

598

SAP GUI Scripting API 6.40

4.27.4.33 Width Property


See Also GuiHTMLViewer Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiHTMLViewer Object

4.28

GuiLabel Object
See Also GuiLabel Members Description GuiLabel extends GuiVComponent. The type prefix is lbl, the name is the fieldname taken from the SAP data dictionary. For a list of all members defined in this module, see GuiLabel members. Object Model

See Also

GuiLabel Members

4.28.1 Overview
See Also GuiLabel Members Description GuiLabel extends GuiVComponent. The type prefix is lbl, the name is the fieldname taken from the SAP

2006 SAP AG

Objects
data dictionary. For a list of all members defined in this module, see GuiLabel members. Object Model

599

See Also

GuiLabel Members

4.28.2 Members
See Also GuiLabel Overview Public Methods DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. This method returns information that is compiled on the server to enhance the ABAP lists with accessibility information. See GuiLabel:: GetListProperty for a description of available attributes. This method returns information that is compiled on the server to enhance the ABAP lists with accessibility information. See GuiLabel:: GetListProperty for a description of available attributes. In contrast to the method GetListProperty, GetListPropertyNonRec will only return information that is set for the specific element, and ignore list properties set for parent elements. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control.

GetListProperty

GetListPropertyNonRec

SetFocus

ShowContextMenu

2006 SAP AG

600

SAP GUI Scripting API 6.40


Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

Visualize

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip CaretPosition The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. Position of the text caret in the input field. Setting the caret position within a label is possible even though it is not visualized as a caret by SAP GUI. However, the position is transmitted to the server, so ABAP application logic may depend on this position. An object is changeable if it is neither disabled nor read-only. Height of the dynpro element in character metric. Left coordinate of the dynpro element in character metric. Top coordinate of the dynpro element in character metric. Width of the dynpro element in character metric. This number defines the index of the list color of this element. This property is True if the Intensified flag is set in screen painter for this dynpro element. This property is True if the inverse color style is set in screen painter for the element. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. This property contains the text as it is displayed on the screen, including preceding or trailing blanks. These blanks are stripped from the text property. Height of the component in pixels. This property is True if the Highlighted flag is set in the screen painter for the dynpro element. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Dynpro elements such as labels may be configured to cause a round trip when they are clicked. In that case the mouse cursor changes to the hand shape. This is called a hot spot. This property is True if the component has the 'assign left' flag. This property is set if the label has been assigned as the left label of another control. This property is True if the element is on an ABAP list, not a dynpro screen. This property is True if the component has the 'assign right' flag. This property is set if the label has been assigned as the right label of another control.

Changeable CharHeight CharLeft CharTop CharWidth ColorIndex ColorIntensified ColorInverse ContainerType DefaultTooltip DisplayedText

Height Highlighted IconName Id

IsHotspot

IsLeftLabel

IsListElement IsRightLabel

2006 SAP AG

Objects

601

IsSymbolFont Left MaxLength

The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates Maximum length of the input field in number of characters. The maximum text length of a label is counted in code units. On nonUnicode clients these are equivalent to bytes. An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. This property is True if the component is an input field that only accepts numeric characters. This flag is True if the label may only contain numbers. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. This property is only available in ABAP list screens. It returns the text of the while line containing the current component. The y position of the component in screen coordinates. The x position of the component in screen coordinates. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

Modified Name

Numerical

Parent ParentFrame RowText ScreenLeft ScreenTop Text

Tooltip Top Type

TypeAsNumber

Width See Also

GuiLabel Overview

2006 SAP AG

602

SAP GUI Scripting API 6.40

4.28.3 Methods
4.28.3.1 DumpState Method
See Also GuiLabel Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection:

2006 SAP AG

Objects First entry: OpCode GPR Name ItemCount

603

Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiLabel Object

4.28.3.2 GetListProperty Method


See Also GuiLabel Object Property Description This method returns information that is compiled on the server to enhance the ABAP lists with accessibility information. See GuiLabel::GetListProperty for a description of available attributes.

2006 SAP AG

604

SAP GUI Scripting API 6.40


Syntax

Public Function GetListProperty( _ ByVal Property As String _ ) As String


Parameters Property Remarks Attributes of containers in general ContainerType o "L": Entire list o "T": A table o "G": A group inside a table o "S" : A subgroup (inside a group) o "R": A line in the body of a table o "B": A text box o "E": A tree o "F": Simple "free" text outside any box ContainerTitle: Title of a table (if provided) or of a text box ContainerInputFields: Used iff a table or a tree has input fields (incl. checkboxes): Number of input fields

Attributes of containers of type "L" (Entire list) ListTablesTotal: Number of tables on the list ListTextBoxesTotal: Number of text boxes on the list ListTreesTotal: Number of trees on the list ListErrorMessage: Used iff the structure recognition detected a (severe) error. ListInputType o "N": list contains no input fields o "C": list contains check boxes o "E": list contains edit fields o "A": list contains edit fields and check boxes

Attributes of containers of type "T" (Table), "G" (Group) and "S" (Subgroup) RowsTotal: Number of logical rows in the table body. If this is an attribute of a (sub-)group, number of logical rows until the next (sub-)group starts. The numbers do NOT include summation lines and inserted lines. RowsSummation: Number of rows with color COL_SUMMING INTENSIFIED ON (if there are any). RowsSubSummation: Number of rows with color COL_SUMMING INTENSIFIED OFF (if there are any). RowsInserted: Number of inserted rows (if there are any).

Attributes of containers of type "T" (Table) TableNo: Number of the table if there is more than one table on the list ColumnsTotal: Number of logical columns SuperColumnsTotal: Used iff the table has a hierarchical header

2006 SAP AG

Objects
TableHierarchical: Used iff the table is hierarchical-sequential o "A": ALV-like 2-level hierarchical-seq. o "2": 2-level hierarchical-seq. o "3": 3-level hierarchical-seq. TableGroupsTotal: Used iff the table is hierarchical-seq.: Number of groups (not counting subgroups)

605

Columns2LevelALV: Used iff TableHierarchical is "A": Number of columns in the group header HeaderRows2LevelALV: Used iff TableHierarchical is "A": Number of lines in the group header TableHierarchicalHeader: Used iff the table has a hierarchical header TableMultipleRows: Used iff the table is a multiple-line table: Number of physical lines per logical line

Attributes of containers of type "G" (Group) and "S" (Subgroup) GroupNo: Number of current group if container is of type "G". SubGroupNo: Number of current subgroup if container is of type "S". SubgroupsTotal: Number of subgroups if table is 3-level hierarchical-sequential and container is of type "G" GroupHeaderRows: Number of physical lines in the group header GroupHeaderValues: Number of label-value pairs in the group header if the table is 2- or 3- level hierarchical-sequential.

Attributes of containers of type "R" (Row) RowType: Used iff the row has a special type o "S": Color COL_SUMMING INTENSIFIED ON o "U": Color COL_SUMMING INTENSIFIED OFF o "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 iff > 1 (multiple-line tables). Lines with totals may or may not be multiple lines. RowInputFields: Number of input fields in the current line (if any).

Attributes of fields in tables FieldHeader: The text of the column header (unavailable if the field itself is in the header, or the field is the label of a label-value pair in a hierarchical-sequential table, or the field is in an inserted line and does not belong to any column). FieldSuperHeader: Text of the supercolumn if the field is in the lower line of a hierarchical header or in the table body (and belongs to a column). ColumnNo: The number of the logical column (if the field belongs to a column). LabelType: Used iff the field is in the header or is a label of a label-value pair in a hierarchical-seq. table. o "N": normal header field (lowest level in hierar.-seq. tables) o "H": header field in a supercolumn (upper line of a hierarchical header) o "A": group header field (COL_GROUPING INTENSIFIED ON) in table whereTableHierarchical is "A" o "G": group header field (COL_GROUPING INTENSIFIED ON) in 2-level hierarchical-sequential table o "S": subgroup header field (COL_HEADING INTENSIFIED ON) in 3-level hierarchical-sequential table

2006 SAP AG

606

SAP GUI Scripting API 6.40


o "T": title-field COL_NORMAL INTENSIFIED ON ColumnType: Used if the field is a column header of a special column. o "C": column contains checkboxes o "S": column contains symbols and/or icons SubordinateColumns: Number of subordinate columns if the field is in the upper line of a hierarchical header. FieldMultipleRows: Used iff the field is in a table header and word wrapping was done: Number of physical lines of the "logical field". FieldWithEllipsis: The field is directly followed by SYM_ELLIPSIS, i.e. "...".

Attributes of fields in tables, trees or title lines of text boxes FieldPhysRowNo: If we are in the body of a multiple-line table or in a multiple-line node of a tree or word wrapping is used in the table header: Current physical line number within the logical line.

Attributes of text boxes TextBoxNo: Number of the text box if there is more than one text box on the list

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

See Also

GuiLabel Object

4.28.3.3 GetListPropertyNonRec Method


See Also GuiLabel Object Property Description This method returns information that is compiled on the server to enhance the ABAP lists with accessibility information. See GuiLabel::GetListProperty for a description of available attributes. In contrast to the method GetListProperty, GetListPropertyNonRec will only return information that is set for the specific element, and ignore list properties set for parent elements. Syntax

2006 SAP AG

Objects Public Function GetListPropertyNonRec( _ ByVal Property As String _ ) As String


Parameters Property See Also

607

GuiLabel Object

4.28.3.4 SetFocus Method


See Also GuiLabel Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiLabel Object

4.28.3.5 ShowContextMenu Method


See Also GuiLabel Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiLabel Object

2006 SAP AG

608

SAP GUI Scripting API 6.40

4.28.3.6 Visualize Method


See Also GuiLabel Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiLabel Object

4.28.4 Properties
4.28.4.1 AccLabelCollection Property
See Also GuiLabel Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiLabel Object

2006 SAP AG

Objects 4.28.4.2 AccText Property


See Also GuiLabel Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

609

Public Property AccText() As String


See Also

GuiLabel Object

4.28.4.3 AccTextOnRequest Property


See Also GuiLabel Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiLabel Object

4.28.4.4 AccTooltip Property


See Also GuiLabel Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String

2006 SAP AG

610

SAP GUI Scripting API 6.40


See Also

GuiLabel Object

4.28.4.5 CaretPosition Property


See Also GuiLabel Object Description Position of the text caret in the input field. Setting the caret position within a label is possible even though it is not visualized as a caret by SAP GUI. However, the position is transmitted to the server, so ABAP application logic may depend on this position. Property type Read-write property Syntax (Visual Basic)

Public Property CaretPosition() As Long


See Also

GuiLabel Object

4.28.4.6 Changeable Property


See Also GuiLabel Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiLabel Object

4.28.4.7 CharHeight Property


See Also GuiLabel Object Description

2006 SAP AG

Objects
Height of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

611

Public Property CharHeight() As Long


See Also

GuiLabel Object

4.28.4.8 CharLeft Property


See Also GuiLabel Object Description Left coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharLeft() As Long


See Also

GuiLabel Object

4.28.4.9 CharTop Property


See Also GuiLabel Object Description Top coordinate of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharTop() As Long


See Also

GuiLabel Object

2006 SAP AG

612

SAP GUI Scripting API 6.40

4.28.4.10 CharWidth Property


See Also GuiLabel Object Description Width of the dynpro element in character metric. Property type Read-only property Syntax (Visual Basic)

Public Property CharWidth() As Long


See Also

GuiLabel Object

4.28.4.11 ColorIndex Property


See Also GuiLabel Object Description This number defines the index of the list color of this element. Property type Read-only property Syntax (Visual Basic)

Public Property ColorIndex() As Long


See Also

GuiLabel Object

4.28.4.12 ColorIntensified Property


See Also GuiLabel Object Description This property is True if the Intensified flag is set in screen painter for this dynpro element. Property type Read-only property Syntax (Visual Basic)

Public Property ColorIntensified() As Boolean

2006 SAP AG

Objects
See Also

613

GuiLabel Object

4.28.4.13 ColorInverse Property


See Also GuiLabel Object Description This property is True if the inverse color style is set in screen painter for the element. Property type Read-only property Syntax (Visual Basic)

Public Property ColorInverse() As Boolean


See Also

GuiLabel Object

4.28.4.14 ContainerType Property


See Also GuiLabel Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiLabel Object

4.28.4.15 DefaultTooltip Property


See Also GuiLabel Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type.

2006 SAP AG

614

SAP GUI Scripting API 6.40


Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiLabel Object

4.28.4.16 DisplayedText Property


See Also GuiLabel Object Description This property contains the text as it is displayed on the screen, including preceding or trailing blanks. These blanks are stripped from the text property. Property type Read-only property Syntax (Visual Basic)

Public Property DisplayedText() As String


See Also

GuiLabel Object

4.28.4.17 Height Property


See Also GuiLabel Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiLabel Object

2006 SAP AG

Objects 4.28.4.18 Highlighted Property


See Also GuiLabel Object Description This property is True if the Highlighted flag is set in the screen painter for the dynpro element. Property type Read-only property Syntax (Visual Basic)

615

Public Property Highlighted() As Boolean


Example

This is an example of both a highlighted GuiLabel on the left and a highlighted GuiTextField on the right. The highlighted property is defined in the data dictionary. See Also

GuiLabel Object

4.28.4.19 IconName Property


See Also GuiLabel Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

2006 SAP AG

616

SAP GUI Scripting API 6.40


GuiLabel Object

4.28.4.20 Id Property
See Also GuiLabel Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiLabel Object

4.28.4.21 IsHotspot Property


See Also GuiLabel Object Description Dynpro elements such as labels may be configured to cause a round trip when they are clicked. In that case the mouse cursor changes to the hand shape. This is called a hot spot. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

617

Public Property IsHotspot() As Boolean


See Also

GuiLabel Object

4.28.4.22 IsLeftLabel Property


See Also GuiLabel Object Description This property is True if the component has the 'assign left' flag. This property is set if the label has been assigned as the left label of another control. Property type Read-only property Syntax (Visual Basic)

Public Property IsLeftLabel() As Boolean


See Also

GuiLabel Object

4.28.4.23 IsListElement Property


See Also GuiLabel Object Description This property is True if the element is on an ABAP list, not a dynpro screen. Property type Read-only property Syntax (Visual Basic)

Public Property IsListElement() As Boolean


See Also

GuiLabel Object

2006 SAP AG

618

SAP GUI Scripting API 6.40

4.28.4.24 IsRightLabel Property


See Also GuiLabel Object Description This property is True if the component has the 'assign right' flag. This property is set if the label has been assigned as the right label of another control. Property type Read-only property Syntax (Visual Basic)

Public Property IsRightLabel() As Boolean


See Also

GuiLabel Object

4.28.4.25 IsSymbolFont Property


See Also GuiLabel Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiLabel Object

4.28.4.26 Left Property


See Also GuiLabel Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Left() As Long


See Also

619

GuiLabel Object

4.28.4.27 MaxLength Property


See Also GuiLabel Object Description Maximum length of the input field in number of characters. The maximum text length of a label is counted in code units. On non-Unicode clients these are equivalent to bytes. Property type Read-only property Syntax (Visual Basic)

Public Property MaxLength() As Long


See Also

GuiLabel Object

4.28.4.28 Modified Property


See Also GuiLabel Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiLabel Object

2006 SAP AG

620

SAP GUI Scripting API 6.40

4.28.4.29 Name Property


See Also GuiLabel Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiLabel Object

4.28.4.30 Numerical Property


See Also GuiLabel Object Description This property is True if the component is an input field that only accepts numeric characters. This flag is True if the label may only contain numbers. Property type Read-only property Syntax (Visual Basic)

Public Property Numerical() As Boolean


See Also

GuiLabel Object

4.28.4.31 Parent Property


See Also GuiLabel Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

621

Public Property Parent() As GuiComponent


See Also

GuiLabel Object

4.28.4.32 ParentFrame Property


See Also GuiLabel Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiLabel Object

4.28.4.33 RowText Property


See Also GuiLabel Object Description This property is only available in ABAP list screens. It returns the text of the while line containing the current component. Property type Read-only property Syntax (Visual Basic)

Public Property RowText() As String


See Also

GuiLabel Object

2006 SAP AG

622

SAP GUI Scripting API 6.40

4.28.4.34 ScreenLeft Property


See Also GuiLabel Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiLabel Object

4.28.4.35 ScreenTop Property


See Also GuiLabel Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiLabel Object

4.28.4.36 Text Property


See Also GuiLabel Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Text() As String


See Also

623

GuiLabel Object

4.28.4.37 Tooltip Property


See Also GuiLabel Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiLabel Object

4.28.4.38 Top Property


See Also GuiLabel Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiLabel Object

2006 SAP AG

624

SAP GUI Scripting API 6.40

4.28.4.39 Type Property


See Also GuiLabel Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiLabel Object

4.28.4.40 TypeAsNumber Property


See Also GuiLabel Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiLabel Object

4.28.4.41 Width Property


See Also GuiLabel Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Width() As Long


See Also

625

GuiLabel Object

4.29

GuiMainWindow Object
See Also GuiMainWindow Members Description This window represents the main window of a SAP GUI session.

GuiMainWindow extends GuiFrameWindow. For a list of all members defined in this module, see GuiMainWindow members. Object Model

2006 SAP AG

626

SAP GUI Scripting API 6.40

See Also

GuiMainWindow Members

4.29.1 Overview
See Also GuiMainWindow Members Description This window represents the main window of a SAP GUI session.

2006 SAP AG

Objects

627

GuiMainWindow extends GuiFrameWindow. For a list of all members defined in this module, see GuiMainWindow members. Object Model

2006 SAP AG

628

SAP GUI Scripting API 6.40


See Also

GuiMainWindow Members

4.29.2 Members
See Also GuiMainWindow Overview Public Methods Close FindAllByName Close the main window. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Create a hardcopy of the main window. Create a screenshot of SAP GUI and return it in a memory block to the caller. Collapse the main window to the minimized state. The method returns True if the given virtual key can be executed on the current screen. Execute the Ctrl+Shift+Tab key on the window to jump backward one block. Execute the Ctrl+Tab key on the window to jump forward one block. Maximize the main window. The ResizeWorkingPane function will resize the window so that the available working area has the given width and height in character metric. The ResizeWorkingPaneEx function will resize the window so that the available working area has the given width and height in pixels. Restore the main window. Send a virtual key to the system.

FindAllByNameEx

FindById

FindByName

FindByNameEx

HardCopy HardCopyToMemory Iconify IsVKeyAllowed JumpBackward JumpForward Maximize ResizeWorkingPane

ResizeWorkingPaneEx Restore SendVKey

2006 SAP AG

Objects

629

SetFocus

ShowMessageBox

TabBackward TabForward Visualize

This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. This method displays a message box. It may be used in scripting environments where there is no built-in function to display a message box, such as JScript. In Visual Basic Script the Windows Script Host supports the MsgBox function. Execute the Shift+Tab key on the window to jump backward one element. Execute the Tab key on the window to jump forward one element. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip ButtonbarVisible The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. This property it True if the application toolbar, the lower toolbar within SAP GUI, is visible. Setting this property to False will hide the application toolbar. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type.

Changeable Children ContainerType DefaultTooltip

ElementVisualizationMode GuiFocus The GuiFocus is the element within SAP GUI that currently has the focus. This may not be the same element as the one pointed to by SystemFocus. GuiFocus can be any element within SAP GUI, including elements that do not exist in the server model, such as toolbar buttons or the command field. Handle Height Iconic IconName Id The window handle of the control that is connected to the GuiShell. Height of the component in pixels. This property is True if the main window is currently minimized. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font.

IsSymbolFont

2006 SAP AG

630

SAP GUI Scripting API 6.40


Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates.

Left Modified Name

Parent ParentFrame ScreenLeft ScreenTop StatusbarVisible SystemFocus

Text

TitlebarVisible ToolbarVisible

Tooltip Top Type

SystemFocus is the element within SAP GUI that has the focus from the server application's perspective. This may only be an element which exists in the server model, such as dynpro or list elements. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. This property it True if the title bar is visible. Setting this property to False will hide the title bar. This property it True if the systen toolbar, the upper toolbar within SAP GUI, is visible. Setting this property to False will hide the system toolbar. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

TypeAsNumber

Width WorkingPaneHeight WorkingPaneWidth See Also

GuiMainWindow Overview

2006 SAP AG

Objects

631

4.29.3 Methods
4.29.3.1 Close Method
See Also GuiMainWindow Object Description Close the main window. Syntax

Public Sub Close()


See Also

GuiMainWindow Object

4.29.3.2 FindAllByName Method


See Also GuiMainWindow Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiMainWindow Object

2006 SAP AG

632

SAP GUI Scripting API 6.40

4.29.3.3 FindAllByNameEx Method


See Also GuiMainWindow Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiMainWindow Object

4.29.3.4 FindById Method


See Also GuiMainWindow Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise

2006 SAP AG

Objects
Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

633

GuiMainWindow Object

4.29.3.5 FindByName Method


See Also GuiMainWindow Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiMainWindow Object

4.29.3.6 FindByNameEx Method


See Also GuiMainWindow Object Name Type

2006 SAP AG

634

SAP GUI Scripting API 6.40


Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiMainWindow Object

4.29.3.7 HardCopy Method


See Also GuiMainWindow Object Filename Name of the file to which the hard copy should be written. ImageType Description Create a hardcopy of the main window. Syntax

Public Function HardCopy( _ ByVal Filename As String, _ Optional ByVal ImageType As Long = 0 _ ) As String
Parameters Filename Name of the file to which the hard copy should be written. ImageType Remarks Currently only BMP is supported as output format. See Also

GuiMainWindow Object

2006 SAP AG

Objects 4.29.3.8 HardCopyToMemory Method


See Also GuiMainWindow Object ImageType Description Create a screenshot of SAP GUI and return it in a memory block to the caller. Syntax

635

Public Function HardCopyToMemory( _ Optional ByVal ImageType As Long = 0 _ ) As Variant


Parameters ImageType Remarks This method may be more efficient for users who do not want a file to be created on the local filesystem. Example [Hardcopy to Memory (Visual Basic)] Create a screenshot, return it as a memory block and write it to file in the script.

If Not Set Set End If If Not Set End If If Not Set End If

IsObject(application) Then SapGuiAuto = GetObject("SAPGUI") application = SapGuiAuto.GetScriptingEngine IsObject(connection) Then connection = application.Children(0) IsObject(session) Then session = connection.Children(0)

Image = session.findById("wnd[0]").HardCopyToMemory() Const adTypeBinary = 1 Const adSaveCreateOverWrite = 2 Dim BinaryStream Set BinaryStream = CreateObject("ADODB.Stream") BinaryStream.Type = adTypeBinary BinaryStream.Open BinaryStream.Write Image BinaryStream.SaveToFile "C:\screenshot.bmp", adSaveCreateOverWrite MsgBox "Done"
See Also

GuiMainWindow Object

2006 SAP AG

636

SAP GUI Scripting API 6.40

4.29.3.9 Iconify Method


See Also GuiMainWindow Object Description Collapse the main window to the minimized state. Syntax

Public Sub Iconify()


See Also

GuiMainWindow Object

4.29.3.10 IsVKeyAllowed Method


See Also GuiMainWindow Object VKey Description The method returns True if the given virtual key can be executed on the current screen. Syntax

Public Function IsVKeyAllowed( _ ByVal VKey As Integer _ ) As Boolean


Parameters VKey Example If F8 can be pressed on a given screen to execute a report, then the method IsVKeyAllowed(8) will return True. See Also

GuiMainWindow Object

4.29.3.11 JumpBackward Method


See Also GuiMainWindow Object Description Execute the Ctrl+Shift+Tab key on the window to jump backward one block. Syntax

2006 SAP AG

Objects Public Sub JumpBackward()


See Also

637

GuiMainWindow Object

4.29.3.12 JumpForward Method


See Also GuiMainWindow Object Description Execute the Ctrl+Tab key on the window to jump forward one block. Syntax

Public Sub JumpForward()


See Also

GuiMainWindow Object

4.29.3.13 Maximize Method


See Also GuiMainWindow Object Description Maximize the main window. Syntax

Public Sub Maximize()


See Also

GuiMainWindow Object

4.29.3.14 ResizeWorkingPane Method


See Also GuiMainWindow Object Width Height ThrowOnFail The throwOnFail parameter has been added for use in the SAP GUI for Java because some window managers may not support a program driven resize of a window.

2006 SAP AG

638

SAP GUI Scripting API 6.40


Description The ResizeWorkingPane function will resize the window so that the available working area has the given width and height in character metric. Syntax

Public Sub ResizeWorkingPane( _ ByVal Width As Long, _ ByVal Height As Long, _ ByVal ThrowOnFail As Boolean _ )
Parameters Width Height ThrowOnFail The throwOnFail parameter has been added for use in the SAP GUI for Java because some window managers may not support a program driven resize of a window. Remarks A script may fail during playback if the size of the window differs from the size during recording. This becomes obvious when you compare the two screen shots below:

If the user selected Two-Line List while recording a script and this line is not available during playback because the size of the window has been decreased, then the selection will fail.

2006 SAP AG

Objects

639

This is because only the visible lines of the list are available on the client. Scrolling always requires a new set of data to be read from the server. This may not be the case for other elements of the user interface. For example, a line of the Grid View which will be discussed later is accessible even if it is not currently visible on the client. See Also

GuiMainWindow Object

4.29.3.15 ResizeWorkingPaneEx Method


See Also GuiMainWindow Object Width Height ThrowOnFail Description The ResizeWorkingPaneEx function will resize the window so that the available working area has the given width and height in pixels. Syntax

Public Sub ResizeWorkingPaneEx( _ ByVal Width As Long, _ ByVal Height As Long, _ ByVal ThrowOnFail As Boolean _ )
Parameters Width Height ThrowOnFail

2006 SAP AG

640

SAP GUI Scripting API 6.40


Remarks This method is only used during recording if the DWORD registry key ResizeWorkingPaneEx in patch HKCU\Software\SAP\SAPGUI Front\SAP Frontend Server\Scripting exists and has the value 1. See Also

GuiMainWindow Object

4.29.3.16 Restore Method


See Also GuiMainWindow Object Description Restore the main window. Syntax

Public Sub Restore()


See Also

GuiMainWindow Object

4.29.3.17 SendVKey Method


See Also GuiMainWindow Object VKey Description Send a virtual key to the system. Syntax

Public Sub SendVKey( _ ByVal VKey As Integer _ )


Parameters VKey Remarks Possible values for the VKey parameter can be found in the table GUI_FKEY. VKey Keyboard Combination 00 Enter 01 F1 02 F2 03 F3 04 F4 05 F5

2006 SAP AG

Objects
06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 70 71 72 73 74 75 76 77 78 79 F6 F7 F8 F9 F10 Ctrl+S F12 Shift+F1 Shift+F2 Shift+F3 Shift+F4 Shift+F5 Shift+F6 Shift+F7 Shift+F8 Shift+F9 Shift+Ctrl+0 Shift+F11 Shift+F12 Ctrl+F1 Ctrl+F2 Ctrl+F3 Ctrl+F4 Ctrl+F5 Ctrl+F6 Ctrl+F7 Ctrl+F8 Ctrl+F9 Ctrl+F10 Ctrl+F11 Ctrl+F12 Ctrl+Shift+F1 Ctrl+Shift+F2 Ctrl+Shift+F3 Ctrl+Shift+F4 Ctrl+Shift+F5 Ctrl+Shift+F6 Ctrl+Shift+F7 Ctrl+Shift+F8 Ctrl+Shift+F9 Ctrl+Shift+F10 Ctrl+Shift+F11 Ctrl+Shift+F12 Ctrl+E Ctrl+F Ctrl+/ Ctrl+\ Ctrl+N Ctrl+O Ctrl+X Ctrl+C Ctrl+V Ctrl+Z

641

2006 SAP AG

642

SAP GUI Scripting API 6.40


80 81 82 83 84 85 86 See Also Ctrl+PageUp PageUp PageDown Ctrl+PageDown Ctrl+G Ctrl+R Ctrl+P

GuiMainWindow Object

4.29.3.18 SetFocus Method


See Also GuiMainWindow Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiMainWindow Object

4.29.3.19 ShowMessageBox Method


See Also GuiMainWindow Object Title Title of the message box. Text Text message in the message box. MsgIcon Value from the GuiMessageBoxType enumeration. MsgType Value from the GuiMessageBoxOption enumeration. Description This method displays a message box. It may be used in scripting environments where there is no builtin function to display a message box, such as JScript. In Visual Basic Script the Windows Script Host supports the MsgBox function.

2006 SAP AG

Objects
Syntax

643

Public Function ShowMessageBox( _ ByVal Title As String, _ ByVal Text As String, _ ByVal MsgIcon As Long, _ ByVal MsgType As Long _ ) As Long
Parameters Title Title of the message box. Text Text message in the message box. MsgIcon Value from the GuiMessageBoxType enumeration. MsgType Value from the GuiMessageBoxOption enumeration. See Also

GuiMainWindow Object

4.29.3.20 TabBackward Method


See Also GuiMainWindow Object Description Execute the Shift+Tab key on the window to jump backward one element. Syntax

Public Sub TabBackward()


See Also

GuiMainWindow Object

4.29.3.21 TabForward Method


See Also GuiMainWindow Object Description Execute the Tab key on the window to jump forward one element. Syntax

Public Sub TabForward()


See Also

2006 SAP AG

644

SAP GUI Scripting API 6.40

GuiMainWindow Object

4.29.3.22 Visualize Method


See Also GuiMainWindow Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiMainWindow Object

4.29.4 Properties
4.29.4.1 AccLabelCollection Property
See Also GuiMainWindow Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

2006 SAP AG

Objects

645

GuiMainWindow Object

4.29.4.2 AccText Property


See Also GuiMainWindow Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiMainWindow Object

4.29.4.3 AccTextOnRequest Property


See Also GuiMainWindow Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTextOnRequest() As String


See Also

GuiMainWindow Object

4.29.4.4 AccTooltip Property


See Also GuiMainWindow Object Description An additional tooltip text for accessibility support. Property type Read-only property

2006 SAP AG

646

SAP GUI Scripting API 6.40


Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiMainWindow Object

4.29.4.5 ButtonbarVisible Property


See Also GuiMainWindow Object Description This property it True if the application toolbar, the lower toolbar within SAP GUI, is visible. Setting this property to False will hide the application toolbar. Property type Read-write property Syntax (Visual Basic)

Public Property ButtonbarVisible() As Boolean


See Also

GuiMainWindow Object

4.29.4.6 Changeable Property


See Also GuiMainWindow Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiMainWindow Object

2006 SAP AG

Objects 4.29.4.7 Children Property


See Also GuiMainWindow Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

647

Public Property Children() As GuiComponentCollection


See Also

GuiMainWindow Object

4.29.4.8 ContainerType Property


See Also GuiMainWindow Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiMainWindow Object

4.29.4.9 DefaultTooltip Property


See Also GuiMainWindow Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

648

SAP GUI Scripting API 6.40 Public Property DefaultTooltip() As String


See Also

GuiMainWindow Object

4.29.4.10 ElementVisualizationMode Property


See Also GuiMainWindow Object Property type Read-write property Syntax (Visual Basic)

Public Property ElementVisualizationMode() As Boolean


See Also

GuiMainWindow Object

4.29.4.11 GuiFocus Property


See Also GuiMainWindow Object Description The GuiFocus is the element within SAP GUI that currently has the focus. This may not be the same element as the one pointed to by SystemFocus. GuiFocus can be any element within SAP GUI, including elements that do not exist in the server model, such as toolbar buttons or the command field. Property type Read-only property Syntax (Visual Basic)

Public Property GuiFocus() As GuiVComponent


See Also

GuiMainWindow Object

2006 SAP AG

Objects 4.29.4.12 Handle Property


See Also GuiMainWindow Object Description The window handle of the control that is connected to the GuiShell. Property type Read-only property Syntax (Visual Basic)

649

Public Property Handle() As Long


See Also

GuiMainWindow Object

4.29.4.13 Height Property


See Also GuiMainWindow Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiMainWindow Object

4.29.4.14 Iconic Property


See Also GuiMainWindow Object Description This property is True if the main window is currently minimized. Property type Read-only property Syntax (Visual Basic)

Public Property Iconic() As Boolean

2006 SAP AG

650

SAP GUI Scripting API 6.40


See Also

GuiMainWindow Object

4.29.4.15 IconName Property


See Also GuiMainWindow Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiMainWindow Object

4.29.4.16 Id Property
See Also GuiMainWindow Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field

2006 SAP AG

Objects

651

name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiMainWindow Object

4.29.4.17 IsSymbolFont Property


See Also GuiMainWindow Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean


See Also

GuiMainWindow Object

4.29.4.18 Left Property


See Also GuiMainWindow Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiMainWindow Object

2006 SAP AG

652

SAP GUI Scripting API 6.40

4.29.4.19 Modified Property


See Also GuiMainWindow Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiMainWindow Object

4.29.4.20 Name Property


See Also GuiMainWindow Object Description The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiMainWindow Object

4.29.4.21 Parent Property


See Also GuiMainWindow Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property

2006 SAP AG

Objects
Syntax (Visual Basic)

653

Public Property Parent() As GuiComponent


See Also

GuiMainWindow Object

4.29.4.22 ParentFrame Property


See Also GuiMainWindow Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiMainWindow Object

4.29.4.23 ScreenLeft Property


See Also GuiMainWindow Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiMainWindow Object

2006 SAP AG

654

SAP GUI Scripting API 6.40

4.29.4.24 ScreenTop Property


See Also GuiMainWindow Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiMainWindow Object

4.29.4.25 StatusbarVisible Property


See Also GuiMainWindow Object Property type Read-write property Syntax (Visual Basic)

Public Property StatusbarVisible() As Boolean


See Also

GuiMainWindow Object

4.29.4.26 SystemFocus Property


See Also GuiMainWindow Object Description SystemFocus is the element within SAP GUI that has the focus from the server application's perspective. This may only be an element which exists in the server model, such as dynpro or list elements. Property type Read-only property Syntax (Visual Basic)

Public Property SystemFocus() As GuiVComponent

2006 SAP AG

Objects
Remarks

655

It is possible for the SystemFocus to be on a dynpro element, while at the same time the GuiFocus is on the command field or a toolbar button, for example. See Also

GuiMainWindow Object

4.29.4.27 Text Property


See Also GuiMainWindow Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiMainWindow Object

4.29.4.28 TitlebarVisible Property


See Also GuiMainWindow Object Description This property it True if the title bar is visible. Setting this property to False will hide the title bar. Property type Read-write property Syntax (Visual Basic)

Public Property TitlebarVisible() As Boolean


Remarks The title bar is only available in New Visual Design, not in Classic Design. See Also

GuiMainWindow Object

2006 SAP AG

656

SAP GUI Scripting API 6.40

4.29.4.29 ToolbarVisible Property


See Also GuiMainWindow Object Description This property it True if the systen toolbar, the upper toolbar within SAP GUI, is visible. Setting this property to False will hide the system toolbar. Property type Read-write property Syntax (Visual Basic)

Public Property ToolbarVisible() As Boolean


See Also

GuiMainWindow Object

4.29.4.30 Tooltip Property


See Also GuiMainWindow Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiMainWindow Object

4.29.4.31 Top Property


See Also GuiMainWindow Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Top() As Long


See Also

657

GuiMainWindow Object

4.29.4.32 Type Property


See Also GuiMainWindow Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiMainWindow Object

4.29.4.33 TypeAsNumber Property


See Also GuiMainWindow Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiMainWindow Object

2006 SAP AG

658

SAP GUI Scripting API 6.40

4.29.4.34 Width Property


See Also GuiMainWindow Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiMainWindow Object

4.29.4.35 WorkingPaneHeight Property


See Also GuiMainWindow Object Property type Read-only property Syntax (Visual Basic)

Public Property WorkingPaneHeight() As Long


See Also

GuiMainWindow Object

4.29.4.36 WorkingPaneWidth Property


See Also GuiMainWindow Object Property type Read-only property Syntax (Visual Basic)

Public Property WorkingPaneWidth() As Long


See Also

GuiMainWindow Object

2006 SAP AG

Objects

659

4.30

GuiMap Object
See Also GuiMap Members Description For the map control only basic members from GuiShell are available. Recording and playback is not possible. For a list of all members defined in this module, see GuiMap members. Object Model

See Also

GuiMap Members

4.30.1 Overview
See Also GuiMap Members Description For the map control only basic members from GuiShell are available. Recording and playback is not possible. For a list of all members defined in this module, see GuiMap members.

2006 SAP AG

660

SAP GUI Scripting API 6.40


Object Model

See Also

GuiMap Members

4.30.2 Members
See Also GuiMap Overview Public Methods DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it.

2006 SAP AG

Objects

661

FindAllByName

FindAllByNameEx

FindById

FindByName

FindByNameEx

SelectContextMenuItem

The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Select an item from the controls context menu.

This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item SelectContextMenuItemByPo text. sition Select a menu item of a context menu using the text of the item and possible higher level menus. SelectContextMenuItemByTe xt This function can be used to set the focus onto an object. If a user SetFocus interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. ShowContextMenu Calling this method of a component will display a red frame around Visualize the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Public Properties AccDescription AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children Accessibility description of the shell. This description can be used for shells that do not have a title element. The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object.

2006 SAP AG

662

SAP GUI Scripting API 6.40


This property is TRUE, if the object is a container and therefore has the children property. This property is only set when a context menu is available at the shell object. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. This property is True if the shell allows drag and drop operations. The window handle of the control that is connected to the GuiShell. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

ContainerType CurrentContextMenu DefaultTooltip DragDropSupported Handle Height IconName Id

IsSymbolFont Left Modified Name

OcxEvents Parent ParentFrame ScreenLeft ScreenTop SubType Text

Tooltip Top Type

TypeAsNumber

Width See Also

2006 SAP AG

Objects

663

GuiMap Overview

4.30.3 Methods
4.30.3.1 DumpState Method
See Also GuiMap Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42

2006 SAP AG

664

SAP GUI Scripting API 6.40 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiMap Object

4.30.3.2 FindAllByName Method


See Also GuiMap Object Name

2006 SAP AG

Objects
Type Description

665

The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiMap Object

4.30.3.3 FindAllByNameEx Method


See Also GuiMap Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiMap Object

2006 SAP AG

666

SAP GUI Scripting API 6.40

4.30.3.4 FindById Method


See Also GuiMap Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiMap Object

4.30.3.5 FindByName Method


See Also GuiMap Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _

2006 SAP AG

Objects ByVal Type As String _ ) As GuiComponent


Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

667

GuiMap Object

4.30.3.6 FindByNameEx Method


See Also GuiMap Object Name Type Description This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiMap Object

4.30.3.7 SelectContextMenuItem Method


See Also GuiMap Object FunctionCode Description Select an item from the controls context menu.

2006 SAP AG

668

SAP GUI Scripting API 6.40


Syntax

Public Sub SelectContextMenuItem( _ ByVal FunctionCode As String _ )


Parameters FunctionCode See Also

GuiMap Object

4.30.3.8 SelectContextMenuItemByPosition Method


See Also GuiMap Object PositionDesc Description This method allows you to select a context menu item using the position of the item. It is therefore independent of the menu item text. Syntax

Public Sub SelectContextMenuItemByPosition( _ ByVal PositionDesc As String _ )


Parameters PositionDesc Remarks The parameter is a string containing the path to the item. If the context menu item is on the top level menu, this is just the zero-base index of the item. Otherwise, the positions on the menu and respective submenus should be concatenated, separated by "|". See Also

GuiMap Object

4.30.3.9 SelectContextMenuItemByText Method


See Also GuiMap Object Text Description Select a menu item of a context menu using the text of the item and possible higher level menus. Syntax

2006 SAP AG

Objects Public Sub SelectContextMenuItemByText( _ ByVal Text As String _ )


Parameters Text See Also

669

GuiMap Object

4.30.3.10 SetFocus Method


See Also GuiMap Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus has already been set on the respective entry. See Also

GuiMap Object

4.30.3.11 ShowContextMenu Method


See Also GuiMap Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiMap Object

2006 SAP AG

670

SAP GUI Scripting API 6.40

4.30.3.12 Visualize Method


See Also GuiMap Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiMap Object

4.30.4 Properties
4.30.4.1 AccDescription Property
See Also GuiMap Object Description Accessibility description of the shell. This description can be used for shells that do not have a title element. Property type Read-only property Syntax (Visual Basic)

Public Property AccDescription() As String


See Also

GuiMap Object

2006 SAP AG

Objects 4.30.4.2 AccLabelCollection Property


See Also GuiMap Object Description

671

The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiMap Object

4.30.4.3 AccText Property


See Also GuiMap Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiMap Object

4.30.4.4 AccTextOnRequest Property


See Also GuiMap Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

672

SAP GUI Scripting API 6.40 Public Property AccTextOnRequest() As String


See Also

GuiMap Object

4.30.4.5 AccTooltip Property


See Also GuiMap Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiMap Object

4.30.4.6 Changeable Property


See Also GuiMap Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiMap Object

2006 SAP AG

Objects 4.30.4.7 Children Property


See Also GuiMap Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

673

Public Property Children() As GuiComponentCollection


See Also

GuiMap Object

4.30.4.8 ContainerType Property


See Also GuiMap Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiMap Object

4.30.4.9 CurrentContextMenu Property


See Also GuiMap Object Description This property is only set when a context menu is available at the shell object. Property type Read-only property Syntax (Visual Basic)

Public Property CurrentContextMenu() As GuiContextMenu

2006 SAP AG

674

SAP GUI Scripting API 6.40


See Also

GuiMap Object

4.30.4.10 DefaultTooltip Property


See Also GuiMap Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

Public Property DefaultTooltip() As String


See Also

GuiMap Object

4.30.4.11 DragDropSupported Property


See Also GuiMap Object Description This property is True if the shell allows drag and drop operations. Property type Read-only property Syntax (Visual Basic)

Public Property DragDropSupported() As Boolean


See Also

GuiMap Object

4.30.4.12 Handle Property


See Also GuiMap Object Description The window handle of the control that is connected to the GuiShell.

2006 SAP AG

Objects
Property type Read-only property Syntax (Visual Basic)

675

Public Property Handle() As Long


See Also

GuiMap Object

4.30.4.13 Height Property


See Also GuiMap Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiMap Object

4.30.4.14 IconName Property


See Also GuiMap Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiMap Object

2006 SAP AG

676

SAP GUI Scripting API 6.40

4.30.4.15 Id Property
See Also GuiMap Object Description An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiMap Object

4.30.4.16 IsSymbolFont Property


See Also GuiMap Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean

2006 SAP AG

Objects
See Also

677

GuiMap Object

4.30.4.17 Left Property


See Also GuiMap Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiMap Object

4.30.4.18 Modified Property


See Also GuiMap Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiMap Object

4.30.4.19 Name Property


See Also GuiMap Object Description The name property is especially useful when working with simple scripts that only access dynpro fields.

2006 SAP AG

678

SAP GUI Scripting API 6.40


In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiMap Object

4.30.4.20 OcxEvents Property


See Also GuiMap Object Description Returns a collection containing the event ids of the ActiveX control. These are the events that the control may send to the server. Property type Read-only property Syntax (Visual Basic)

Public Property OcxEvents() As GuiCollection


See Also

GuiMap Object

4.30.4.21 Parent Property


See Also GuiMap Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

2006 SAP AG

Objects
GuiMap Object

679

4.30.4.22 ParentFrame Property


See Also GuiMap Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiMap Object

4.30.4.23 ScreenLeft Property


See Also GuiMap Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiMap Object

4.30.4.24 ScreenTop Property


See Also GuiMap Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

680

SAP GUI Scripting API 6.40 Public Property ScreenTop() As Long


See Also

GuiMap Object

4.30.4.25 SubType Property


See Also GuiMap Object Description Additional type information to identify the control represented by the shell, for example Picture, TextEdit, GridView Property type Read-only property Syntax (Visual Basic)

Public Property SubType() As String


See Also

GuiMap Object

4.30.4.26 Text Property


See Also GuiMap Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

Public Property Text() As String


See Also

GuiMap Object

2006 SAP AG

Objects 4.30.4.27 Tooltip Property


See Also GuiMap Object Description

681

The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiMap Object

4.30.4.28 Top Property


See Also GuiMap Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiMap Object

4.30.4.29 Type Property


See Also GuiMap Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

682

SAP GUI Scripting API 6.40 Public Property Type() As String


See Also

GuiMap Object

4.30.4.30 TypeAsNumber Property


See Also GuiMap Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiMap Object

4.30.4.31 Width Property


See Also GuiMap Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Width() As Long


See Also

GuiMap Object

2006 SAP AG

Objects

683

4.31

GuiMenu Object
See Also GuiMenu Members Description 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]. For a list of all members defined in this module, see GuiMenu members. Object Model

See Also

GuiMenu Members

4.31.1 Overview
See Also GuiMenu Members Description 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]. For a list of all members defined in this module, see GuiMenu members. Object Model

2006 SAP AG

684

SAP GUI Scripting API 6.40

See Also

GuiMenu Members

4.31.2 Members
See Also GuiMenu Overview Public Methods DumpState This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used.

FindAllByName

FindAllByNameEx

2006 SAP AG

Objects

685

FindById

FindByName

FindByNameEx

Select SetFocus

Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Select the menu. This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Shows the context menu of the control. Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.

ShowContextMenu Visualize

Public Properties AccLabelCollection AccText AccTextOnRequest AccTooltip Changeable Children ContainerType DefaultTooltip Height IconName Id The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. An additional text for accessibility support. An additional text for accessibility support. An additional tooltip text for accessibility support. An object is changeable if it is neither disabled nor read-only. This collection contains all direct children of the object. This property is TRUE, if the object is a container and therefore has the children property. Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Height of the component in pixels. If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. The property is TRUE if the component's text is visualized in the SAP symbol font. Left position of the element in screen coordinates An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system.

IsSymbolFont Left Modified

2006 SAP AG

686

SAP GUI Scripting API 6.40


The name property is especially useful when working with simple scripts that only access dynpro fields. In that case 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. The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. The y position of the component in screen coordinates. The x position of the component in screen coordinates. 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Top coordinate of the element in screen coordinates. The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Width of the component in pixels.

Name

Parent ParentFrame ScreenLeft ScreenTop Text

Tooltip Top Type

TypeAsNumber

Width See Also

GuiMenu Overview

4.31.3 Methods
4.31.3.1 DumpState Method
See Also GuiMenu Object InnerObject Description This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerObject parameter are specified as part of the class description for those components that support it. Syntax

2006 SAP AG

Objects Public Function DumpState( _ ByVal InnerObject As String _ ) As GuiCollection


Parameters InnerObject Remarks

687

The DumpState method returns a hierarchy of collections of type GuiCollection, which is three levels deep. The top (first) level collection contains a second level collection for every property that is to be dumped. The second level collection contains the complete information for one property. There is a third level collection for every sub-expression that might be required to access inner objects. Finally, the third level collection contains the OpCode, the property or method name, the parameter values and depending on the OpCode the return value to be checked.

The following OpCodes are used: GPR: Get property and compare return value. MR: Execute method and compare return value. GP: Get property and execute the next entry in the second level collection on the result. M: Execute the method and then execute the next entry in the second level collection on the result.

For example the calls control.ItemCount = 42 control.GetItemValue(3, 2) = 'MyText' control.GetItem('2','3').Property1.MethodY('XYZ').Text = 'ABC' result in three entries of the top level collection: First entry: OpCode GPR Name ItemCount Parameter1/ Parameter2 Parameter3 Property-Value 42

Second entry: OpCode Name Parameter1 Parameter2 Parameter3/ PropertyValue 2 MyText

MR

GetItemValue

2006 SAP AG

688

SAP GUI Scripting API 6.40

Third entry: OpCode M GP M GPR Name GetItem Property1 MethodY Text XYZ ABC Parameter1 2 Parameter2 Parameter3 3

As you can see in this example, for calls that contain return values (MR, GPR) the last value in the third level collection is the return value.

See Also

GuiMenu Object

4.31.3.2 FindAllByName Method


See Also GuiMenu Object Name Type Description The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiMenu Object

2006 SAP AG

Objects 4.31.3.3 FindAllByNameEx Method


See Also GuiMenu Object Name Type Description

689

The methods findByName and findByNameEx return only the first object with matching name and type. There may however be several matching objects, which will be returned as members of a collection when findAllByName or findAllByNameEx are used. Syntax

Public Function FindAllByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponentCollection
Parameters Name Type See Also

GuiMenu Object

4.31.3.4 FindById Method


See Also GuiMenu Object Id Raise Description Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found thefunction raises an exception unless the optional parameter raise is set to False. Syntax

Public Function FindById( _ ByVal Id As String, _ Optional ByVal Raise As Variant _ ) As GuiComponent
Parameters Id Raise

2006 SAP AG

690

SAP GUI Scripting API 6.40


Example Unless there are several sessions or connections in use, the following calls are equivalent: Set Comp = UserArea.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE") Set Comp = UserArea.findById("txtHEADER-FBFOOTLINE") See Also

GuiMenu Object

4.31.3.5 FindByName Method


See Also GuiMenu Object Name Type Description Unlike findById, this function does not guarantee a unique result. It will simply return the first descendant matching both the name and type parameters.This is a more natural description of the object than the complex id, but it only makes sense on dynpro objects as most other objects do not have a meaningfulname. If no descendant with matching name and type can be found, the function raises an exception. Syntax

Public Function FindByName( _ ByVal Name As String, _ ByVal Type As String _ ) As GuiComponent
Parameters Name Type Example Set Comp = UserArea.findByName("HEADER-FBFOOTLINE", "GuiTextField") See Also

GuiMenu Object

4.31.3.6 FindByNameEx Method


See Also GuiMenu Object Name Type

2006 SAP AG

Objects
Description

691

This function has been introduced for performance reasons. The parameter type is not a string as in findByName but rather a number taken from GuiComponent.typeAsNumber. Syntax

Public Function FindByNameEx( _ ByVal Name As String, _ ByVal Type As Long _ ) As GuiComponent
Parameters Name Type See Also

GuiMenu Object

4.31.3.7 Select Method


See Also GuiMenu Object Description Select the menu. Syntax

Public Sub Select()


See Also

GuiMenu Object

4.31.3.8 SetFocus Method


See Also GuiMenu Object Description This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever 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 application explicitly checks for the focus and behaves differently depending on the focussed object. Syntax

Public Sub SetFocus()


Example Pressing this button to display the details of an entry in the table control will only succeed if the focus

2006 SAP AG

692

SAP GUI Scripting API 6.40


has already been set on the respective entry. See Also

GuiMenu Object

4.31.3.9 ShowContextMenu Method


See Also GuiMenu Object Description Shows the context menu of the control. Syntax

Public Sub ShowContextMenu()


See Also

GuiMenu Object

4.31.3.10 Visualize Method


See Also GuiMenu Object On InnerObject Description Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method. Syntax

Public Function Visualize( _ ByVal On As Boolean, _ Optional ByVal InnerObject As Variant _ ) As Boolean
Parameters On InnerObject See Also

GuiMenu Object

2006 SAP AG

Objects

693

4.31.4 Properties
4.31.4.1 AccLabelCollection Property
See Also GuiMenu Object Description The collection contains objects of type GuiLabel that were assigned to this control in the ABAP Screen Painter. Property type Read-only property Syntax (Visual Basic)

Public Property AccLabelCollection() As GuiComponentCollection


See Also

GuiMenu Object

4.31.4.2 AccText Property


See Also GuiMenu Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccText() As String


See Also

GuiMenu Object

4.31.4.3 AccTextOnRequest Property


See Also GuiMenu Object Description An additional text for accessibility support. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

694

SAP GUI Scripting API 6.40 Public Property AccTextOnRequest() As String


See Also

GuiMenu Object

4.31.4.4 AccTooltip Property


See Also GuiMenu Object Description An additional tooltip text for accessibility support. Property type Read-only property Syntax (Visual Basic)

Public Property AccTooltip() As String


See Also

GuiMenu Object

4.31.4.5 Changeable Property


See Also GuiMenu Object Description An object is changeable if it is neither disabled nor read-only. Property type Read-only property Syntax (Visual Basic)

Public Property Changeable() As Boolean


See Also

GuiMenu Object

2006 SAP AG

Objects 4.31.4.6 Children Property


See Also GuiMenu Object Description This collection contains all direct children of the object. Property type Read-only property Syntax (Visual Basic)

695

Public Property Children() As GuiComponentCollection


See Also

GuiMenu Object

4.31.4.7 ContainerType Property


See Also GuiMenu Object Description This property is TRUE, if the object is a container and therefore has the children property. Property type Read-only property Syntax (Visual Basic)

Public Property ContainerType() As Boolean


See Also

GuiMenu Object

4.31.4.8 DefaultTooltip Property


See Also GuiMenu Object Description Tooltip text generated from the short text defined in the data dictionary for the given screen element type. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

696

SAP GUI Scripting API 6.40 Public Property DefaultTooltip() As String


See Also

GuiMenu Object

4.31.4.9 Height Property


See Also GuiMenu Object Description Height of the component in pixels. Property type Read-only property Syntax (Visual Basic)

Public Property Height() As Long


See Also

GuiMenu Object

4.31.4.10 IconName Property


See Also GuiMenu Object Description If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string. Property type Read-only property Syntax (Visual Basic)

Public Property IconName() As String


See Also

GuiMenu Object

2006 SAP AG

Objects 4.31.4.11 Id Property


See Also GuiMenu Object Description

697

An object id is a unique textual identifier for the object. It is built in a URL-like formatting, starting at the GuiApplication object and drilling down to the respective object. Property type Read-only property Syntax (Visual Basic)

Public Property Id() As String


Remarks Using fully qualified ids has one significant drawback: the index of both the connection and session become part of the id. If the id given above is used to search for the text field the search will only be successful if the session to which the text field belongs is again the first session of the first connection. This problem can be circumvented using relative ids. A relative id does not start with /. Instead it begins with the type prefix of the child of the object on which the search is started. Therefore it is usually preferable to truncate the first part of the id up to the session index and work with a relative id, such as wnd[0]/usr/ctxtRS38M-PROGRAMM. This relative id is still unique with respect to a given session, but it is independent of the number of sessions or connections currently open. Example The id of the text field in transaction se38 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS38M-PROGRAMM. It is created through first taking the type specific prefix for the given component, which in this case is 'ctxt'. The name of the field is then appended, if one exists. For dynpro fields the name is the field name defined in screen painter, in this case 'RS38M-PROGRAM'. In many cases, especially if there is no name available for an object, an index has to be appended for uniqueness. Finally, the id of the parent object is added as a prefix, separated by the '/' character. Objects of type GuiShell do not have a name. So whenever there are several objects of this type on the same level in the hierarchy, a one-dimensional index is appended for uniqueness. On the other hand, list and step-loop screens are set up in a two-dimensional grid, so the index string added to the id will have two components as well. See Also

GuiMenu Object

4.31.4.12 IsSymbolFont Property


See Also GuiMenu Object Description The property is TRUE if the component's text is visualized in the SAP symbol font. Property type Read-only property Syntax (Visual Basic)

Public Property IsSymbolFont() As Boolean

2006 SAP AG

698

SAP GUI Scripting API 6.40


See Also

GuiMenu Object

4.31.4.13 Left Property


See Also GuiMenu Object Description Left position of the element in screen coordinates Property type Read-only property Syntax (Visual Basic)

Public Property Left() As Long


See Also

GuiMenu Object

4.31.4.14 Modified Property


See Also GuiMenu Object Description An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system. Property type Read-only property Syntax (Visual Basic)

Public Property Modified() As Boolean


See Also

GuiMenu Object

4.31.4.15 Name Property


See Also GuiMenu Object Description The name property is especially useful when working with simple scripts that only access dynpro fields.

2006 SAP AG

Objects

699

In that case 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. Property type Read-only property Syntax (Visual Basic)

Public Property Name() As String


See Also

GuiMenu Object

4.31.4.16 Parent Property


See Also GuiMenu Object Description The parent of an object is one level higher in the runtime hierarchy. An object is always in the children collection of its parent. Property type Read-only property Syntax (Visual Basic)

Public Property Parent() As GuiComponent


See Also

GuiMenu Object

4.31.4.17 ParentFrame Property


See Also GuiMenu Object Description If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL. Property type Read-only property Syntax (Visual Basic)

Public Property ParentFrame() As GuiComponent


See Also

GuiMenu Object

2006 SAP AG

700

SAP GUI Scripting API 6.40

4.31.4.18 ScreenLeft Property


See Also GuiMenu Object Description The y position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenLeft() As Long


See Also

GuiMenu Object

4.31.4.19 ScreenTop Property


See Also GuiMenu Object Description The x position of the component in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property ScreenTop() As Long


See Also

GuiMenu Object

4.31.4.20 Text Property


See Also GuiMenu Object Description 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 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 cant change it, whereas you can only set the text property of a password field, but not read it. Property type Read-write property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Text() As String


See Also

701

GuiMenu Object

4.31.4.21 Tooltip Property


See Also GuiMenu Object Description The tooltip contains a text which is designed to help a user understand the meaning of a given text field or button. Property type Read-only property Syntax (Visual Basic)

Public Property Tooltip() As String


See Also

GuiMenu Object

4.31.4.22 Top Property


See Also GuiMenu Object Description Top coordinate of the element in screen coordinates. Property type Read-only property Syntax (Visual Basic)

Public Property Top() As Long


See Also

GuiMenu Object

2006 SAP AG

702

SAP GUI Scripting API 6.40

4.31.4.23 Type Property


See Also GuiMenu Object Description The type information of GuiComponent can be used to determine which properties and methods an object supports. The value of the type string is the name of the type taken from this documentation. Property type Read-only property Syntax (Visual Basic)

Public Property Type() As String


See Also

GuiMenu Object

4.31.4.24 TypeAsNumber Property


See Also GuiMenu Object Description While the type property is a string value, the typeAsNumber property is a long value that can alternatively be used to identify an object's type . It was added for better performance in methods such as FindByIdEx. Possible values for this property are taken from the GuiComponentType enumeration. Property type Read-only property Syntax (Visual Basic)

Public Property TypeAsNumber() As Long


See Also

GuiMenu Object

4.31.4.25 Width Property


See Also GuiMenu Object Description Width of the component in pixels. Property type Read-only property Syntax (Visual Basic)

2006 SAP AG

Objects Public Property Width() As Long


See Also

703

GuiMenu Object

4.32

GuiMenubar Object
See Also GuiMenubar Members Description Only the main window has a menubar. The children of the menubar are menus. GuiMenubar extends GuiVContainer. The type prefix and name are mbar. For a list of all members defined in this module, see GuiMenubar members. Object Model

See Also

GuiMenubar Members

2006 SAP AG

704

SAP GUI Scripting API 6.40

4.32.1 Overview
See Also GuiMenubar Members Description Only the main window has a menubar. The children of the menubar are menus. GuiMenubar extends GuiVContainer. The type prefix and name are mbar. For a list of all members defined in this module, see GuiMenubar members. Object Model

See Also

GuiMenubar Members

4.32.2 Members
See Also GuiMenubar Overview Public Methods

2006 SAP AG

Objects

705

DumpState

FindAllByName

FindAllByNameEx

FindById

FindByName

FindByNameEx

SetFocus

ShowContextMenu Visualize

This function dumps the state of the object. The parameter innerObject may be used to specify for which internal object the data should be dumped. Only the most complex components, such as the GuiCtrlGridView, support this parameter. All other components always dump their full state. All components that support this parameter have in common that they return general information about the controls state if the parameter innerObject contains an empty string.The format of the returned collection is described in the chapter DumpState Collection Format of the appendix. The available values for the innerO