Functionality of SAP Objects

All SAP screen element types have properties, functions, and events. To view a screen element's functionality, you need to get the element from the SAP application itself, or find the relevant functionality view in the assembly.

To view the functionality of SAP screen element on the Functionality tab:

1. Select the captured SAP screen element in the Screen Elements tree.
2. Click the Physical Objects > Functionality tab.

This tab shows a functionality view of the selected screen element. For more information, see Using the Functionality Tab.

To view the functionality of SAP screen elements in the assembly:

In this case you do not need to capture the SAP object first.

3. In the Project tab, select References > Library References > ScreenPluginSAPgui in the tree.

The Assembly Info tab is opened by default with the information about the library (dll):

4. Select the Functionality tab and then open the Type drop-down list:

You can select any SAP screen element type from Type drop-down list to view the corresponding window with the Properties and Functions and Events tables.

The table below includes selected common (base) functions and properties followed by functions and properties for specific types.

properties, functions, and events

Description

Common Properties

Bounding Rectangle

The rectangle outlines the area where the cursor is currently hovering, which is captured as the screen element.

Changeable

Indicates whether a screen element is changeable if it is neither disabled nor read-only.

Container Type

This property is True if the object is a container and therefore has no children property.

Exists

Indicates whether a screen element exists.

Focused

Indicates whether the screen element is in focus.

Height

Gets the height of a SAP object.

Modified

Indicates the modified state of the screen element's state as changed by the user, before this change is sent to the SAP system.

Name

SAP element name.

Process Id

The unique process ID.

SAP GUI Handle

The SAP interface handle.

SAP GUI Id

Gets a unique textual identifier for the SAP object. This is achieved through a URL-like formatting, starting at the GUIApplication object and drilling down to the respective object. For example, Id of the text field in transaction se32 is /app/con[0]/ses[0]/wnd[0]/usr/ctxtRS32M-PROGRAMM

Screen Left

Gets the left screen coordinate of a SAP object.

Text

The value of this property very much depends on the type of the object. This is straight forward 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 can't change it, whereas you can only set the text property of a password field, but not read it.

Type as Number

Gets a long value that can alternatively be used to identify an objects type. For example, 31 is Text Field. These values can be taken from the type library in sapfewse.ocx.

Width

Gets the width of a SAP object.

Window Handle

The window handle of the SAP object.

Screen Top

Gets the top screen coordinate of a SAP object

Common Functions

Set Focus

Gives focus to the SAP element.

Show Context Menu

Opens the context menu of a SAP object.

Visualize

Displays a red frame around a SAP object if the parameter is True. The frame will be removed if the parameter is False.

SAP GUI Button Functions

Press

Emulates manually pressing a button. Pressing a button always causes server communication to occur, rendering all references to elements below the window level invalid.

SAP GUI Check Box Properties

Checked

Sets the checked state of a checkbox.

SAP GUI Tree and SAP GUI Column Tree Functions

Set Selected Item

Sets the selected item.

Get All Nodes

Returns a collection of all nodes.

Expand All Nodes

Expands all nodes.

Collapse All Nodes

Collapses all the nodes.

Double Click Item

Simulates a double-click on the specified item.

GUI Combo Box and GUI Component Properties

Selected Item

Gets or sets the selected item in combo box

GUI Frame Window Properties

Class Name

Indicates the class name of window. For example, SAP_FRONTEND_SESSION.

GUI Frame Window Functions

Start Record Script

Starts recording a script of actions in the SAP session to the specified file by its name (do not provide path). Path for recorded file is: C:\Users\{current user}\AppData\Roaming\SAP\SAPGUI\. It is an undocumented function by SAP. To be used by advanced users only.

Run Script Control

Points to undocumented internal functions. Recommended for advanced users in special cases for testing purposes.

GUI Frame Window Events

Session Activated

Event is fired when SAP session is activated.

Session Change

Event is fired when SAP session changes.

Session Hit

The event is only raised when elementVisualizationMode is set to True, which turns on the hit test mode of SAP GUI. If on this mode a SAP GUI component is identified, the event is raised. The parameters of this event are:

The Id of the component that was hit.

A description of an inner object of the component if an inner object was hit.

Session Focus Changed

The event is fired when the focus state of the current SAP session is modified.

Session Context Menu

The event is fired when SAP GUI is about to display a context menu. There are currently the following limitations documented at SAP:

Only context menus of controls of type GuiShell are supported.

The event is not fired for "cashed" context menus, which are not retrieved from the server when being opened.

Session Destroy

This event is raised before a session is destroyed.

Session Error

Event is fired if a runtime error occurs during the execution of a script in the current session.

GUI Grid View Properties

Columns Count

Returns the number of columns in the grid.

Rows Count

Returns the number of rows in the grid.

GUI Grid View Functions

Set Cell Text

Sets cell text at the specified row and column (1 based index).

Get Cell Text

Gets cell text at the specified row and column (1 based index).

Get Rows

Gets the number of rows.

Get Rows with Filter

Returns the collection of rows, which matches specified text in the cell.

Clear Selection

Removes all row, column, and cell selections.

Click

Emulates a mouse click on a given cell.

Double Click

Emulates a double-click on a given cell.

Press Button

Emulates pressing a button placed in a given cell, and raises an exception if the cell does not contain a button, or does not exist.

Press Column Header

Emulates a click on the header of the column if the parameter identifies a valid column, and raises an exception otherwise.

Press Enter

Emulates pressing the Enter key.

Press F1

Emulates pressing the F1 key.

Press F4

Emulates pressing the F4 key.

Select All

Selects the whole grid content (all rows and all columns).

Select Column

Adds the specified column to the collection of the selected columns.

Set Current Cell

Set specified cell as current cell.

Deselect Column

Removes the specified column from the collection of the selected columns.

Get Cell State

Returns the type of the specified cell. Possible values are: "Normal", "Button", "Checkbox", "ValueList".

Get Selected Rows

Returns the numbers of the selected rows (1 based index).

GUI Label Properties

Caret Position

Gets the position of caret on a label that can't be seen in application. It is possible to change its position and invoke functions based on the caret position.

GUI Text Field Properties

Caret Position

Gets the position of the caret within a text field, that may be checked by the ABAP application to determine which word the caret is in. Among other things, this may be useful for context-sensitive help.

Is Numerical

This property is True if only numbers and special characters may be written into the text field.

Is Password

Indicates whether a text field uses hidden text for passwords.

GUI Tab Strip Functions

Get Selected Tab

Gets the active tab by tab name in the application.

Set Selected Tab

Sets the active tab by tab name in the application.

GUI Table Functions

Get Cell Text

Gets the cell text by row and column coordinates (index = 1).

Set Cell Text

Sets the cell text by row and column coordinates (index = 1).

Double Click Cell

Double-clicks the cell using row and column coordinates.

Scroll Up / Scroll Down

Scrolls up or down specified number of pages.

GUI Radio Button Properties

Selected

Gets or sets the selected state of the radio button.