SAPGuiWindow Object
Description
A window or dialog box containing objects in an SAP GUI for Windows application.
Operations
The sections below list the built-in methods and properties that you can use as operations for the SAPGuiWindow object.
Note: You can also view a list and descriptions of the SAPGuiWindow description properties, for use in object repository descriptions, programmatic descriptions, checkpoint and output value steps, and as argument values for the GetTOProperty and GetROProperty methods.
Methods
Activate | Activates the SAP window. |
CaptureBitmap | Saves a screen capture of the object as a .png or .bmp image using the specified file name. |
Check | Checks whether the actual value of an item matches the expected value. |
CheckProperty | Checks whether the actual value of the specified object property matches the specified expected value within the specified timeout. |
ChildObjects | Returns the collection of child objects contained within the object. |
GetAllROProperties | Returns the collection of properties and current values from the object in the application. |
Close | Closes the window or dialog box in an SAP GUI for Windows application. |
GetROProperty | Returns the current value of the description property from the object in the application. |
GetTOProperties | Returns the collection of properties and values used to identify the object. |
GetTOProperty | Returns the value of the specified description property from the test object description. |
Highlight | Highlights the object in the application. |
HorizontalScrollbarPosition | Sets the position of the horizontal scroll bar. (Moves the scroll bar to the left or right.) |
Maximize | Maximizes the window or dialog box in an SAP GUI for Windows application. |
Output | Retrieves the current value of an item and stores it in a specified location. |
RefreshObject | Instructs UFT One to re-identify the object in the application the next time a step refers to this object. |
Resize | Resizes the window so that the available working area has the specified width and height in character metric. |
Restore | Restores a maximized window or dialog box in an SAP GUI for Windows application to its original size. |
SelectMenuItemById | Selects an item from a pop-up (right-click) menu in an SAP GUI for Windows application. |
SendKey | Presses a functional keyboard key. |
SetTOProperty | Sets the value of the specified description property in the test object description. |
ToString | Returns a string that represents the test object. |
VerticalScrollbarPosition | Sets the position of the vertical scroll bar. (Moves the scroll bar up or down.) |
WaitProperty | Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step. |
Properties
Exist | Checks whether the object currently exists in the open application. |
Object | Accesses the native methods and properties of the object. |
Activate Method
Description
Activates the SAP window.
Syntax
object.Activate
Return Type
None.
Example
'The following example uses the Activate method to activate the SAP window. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").Activate
Close Method
Description
Closes the window or dialog box in an SAP GUI for Windows application.
Syntax
object.Close
Return Type
None.
Example
'The following example uses the Close method to close the "Possible Entries" dialog box (after 'opening it for the cell in the first row of the "Materials" column in the "GridViewCtrl" table). SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("GridViewCtrl").OpenPossibleEntries 1, "Material" SAPGuiSession("Session").SAPGuiWindow("Restrict Value").Close
HorizontalScrollbarPosition Method
Description
Sets the position of the horizontal scroll bar. (Moves the scroll bar to the left or right.)
Syntax
object.HorizontalScrollbarPosition (Pos)
Arguments
Parameter | Description |
---|---|
Pos |
Required. A long integer value. The position where you want to place the horizontal scroll bar. Position values start from 0. |
Return Type
None.
Example
'The following example uses the HorizontalScrollBarPosition method to scroll to the appropriate position 'to place the cursor on "999" in the "Invoice Items" window. SAPGuiSession("Session").SAPGuiWindow("Invoice Items_2").SAPGuiEdit("Fiscal year").Set "1999" SAPGuiSession("Session").SAPGuiWindow("Invoice Items_2").SAPGuiEdit("Fiscal year").SetFocus SAPGuiSession("Session").SAPGuiWindow("Invoice Items_2").SAPGuiButton("Enter").Click SAPGuiSession("Session").SAPGuiWindow("Invoice Items_2").SAPGuiButton("Enter").Click SAPGuiSession("Session").SAPGuiWindow("Invoice Items").HorizontalScrollbarPosition 54 SAPGuiSession("Session").SAPGuiWindow("Invoice Items").SAPGuiLabel("999").SetFocus SAPGuiSession("Session").SAPGuiWindow("Invoice Items").SAPGuiLabel("999").SetCaretPos 1 SAPGuiSession("Session").SAPGuiWindow("Invoice Items").SendKey F2
Maximize Method
Description
Maximizes the window or dialog box in an SAP GUI for Windows application.
Syntax
object.Maximize
Return Type
None.
Example
'The following example uses the Maximize method to maximize the "Possible Entries" help dialog box for the 'cell in the first row of the "Materials" column of the "GridViewCtrl" table. SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("GridViewCtrl").OpenPossibleEntries 1, "Material" SAPGuiSession("Session").SAPGuiWindow("Restrict Value").Maximize
Resize Method
Description
Resizes the window so that the available working area has the specified width and height in character metric.
Syntax
object.Resize (Width, Height)
Arguments
Parameter | Description |
---|---|
Width |
Required. A long integer value. The width (in characters) of the resized window. |
Height |
Required. A long integer value. The height (in characters) of the resized window. |
Return Type
None.
IMPORTANT
This method uses the SAP API resizeWorkingPane function to resize the window.
Example
'The following example uses the Resize method to resize the "Create Document" window to 79 * 28 characters. SAPGuiSession("Session").SAPGuiWindow("Business Workplace").SAPGuiButton("New message").Click SAPGuiSession("Session_2").SAPGuiWindow("Create Document").Resize 79, 28 SAPGuiSession("Session_2").SAPGuiWindow("Create Document").SAPGuiTextArea("TextAreaControl").Set "I resized this Window" + vbCr + ""
Restore Method
Description
Restores a maximized window or dialog box in an SAP GUI for Windows application to its original size.
Syntax
object.Restore
Return Type
None.
Example
'The following example uses the Restore method to restore the "Create Purchase" window to its 'original size. SAPGuiSession("Session").SAPGuiWindow("Create Purchase").Maximize SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("All items").SetCellData 1, "Material", "p-100" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").Restore
SelectMenuItemById Method
Description
Selects an item from a pop-up (right-click) menu in an SAP GUI for Windows application.
Syntax
object.SelectMenuItemById (MenuItemId)
Arguments
Parameter | Description |
---|---|
MenuItemId |
Required. A String value. The ID of the pop-up menu item to be selected. |
Return Type
None.
Example
'The following example uses the SelectMenuItemById method to select the "Details" menu option by 'right-clicking in the "Create Sales" window and selecting it from the pop-up menu. SAPGuiSession("Session").SAPGuiWindow("Create Sales").SelectMenuItemById "DESP"
SendKey Method
Description
Presses a functional keyboard key.
Syntax
object.SendKey (Key)
Arguments
Parameter | Description |
---|---|
Key |
Required. A long integer value. The code representing a functional keyboard key. For example:
|
Return Type
None.
Example
'The following example uses the SendKey method to press the ENTER keyboard key after setting an OKCode. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "va01" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("Create Sales").SAPGuiEdit("Sales organization").SetFocus
'The following example uses the SendKey method to open the "Possible Entries" help dialog box (F4). SAPGuiSession("Session").SAPGuiWindow("Create Sales").SendKey F4 SAPGuiSession("Session").SAPGuiWindow("Sales organization").SAPGuiLabel("S300").SetFocus SAPGuiSession("Session").SAPGuiWindow("Sales organization").SAPGuiLabel("S300").SetCaretPos 1
VerticalScrollbarPosition Method
Description
Sets the position of the vertical scroll bar. (Moves the scroll bar up or down.)
Syntax
object.VerticalScrollbarPosition (Pos)
Arguments
Parameter | Description |
---|---|
Pos |
Required. A long integer value. The position where you want to place the vertical scrollbar. |
Return Type
None.
Example
'The following example uses the VerticalScrollBarPosition method to scroll the vertical scroll bar to 'position 5 after opening a "Possible Entries" dialog box. SAPGuiSession("Session").SAPGuiWindow("Create Sales").SAPGuiEdit("Order Type").SetFocus SAPGuiSession("Session").SAPGuiWindow("Create Sales").SendKey F4 SAPGuiSession("Session").SAPGuiWindow("Sales document").VerticalScrollbarPosition 5 SAPGuiSession("Session").SAPGuiWindow("Sales document").SAPGuiLabel("CS").SetFocus SAPGuiSession("Session").SAPGuiWindow("Sales document").SAPGuiLabel("CS").SetCaretPos 1 SAPGuiSession("Session").SAPGuiWindow("Sales document").SendKey F2
See also: