SAPGuiGrid Object
Description
A grid control 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 SAPGuiGrid object.
Note: You can also view a list and descriptions of the SAPGuiGrid 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
ActivateCell | Double-clicks the specified cell in a grid. |
ActivateColumn | Double-clicks the specified column in a grid. |
ActivateRow | Double-clicks the specified row in a grid. |
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. |
ClearSelection | Clears any selected rows or columns in a grid. |
ClickCell | Clicks the specified cell in a grid. |
ColumnCount | Retrieves the number of columns in the grid. |
DeselectColumn | Clears the selection of the specified column. |
DeselectRow | Clears the selection of the specified row. |
DeselectRowsRange | Deselects the specified rows in the grid. |
ExtendColumn | Selects an additional column in the grid. |
ExtendRow | Selects an additional row in the grid. |
ExtendRowsRange | Adds the specified range of rows to the selected rows in the grid. |
FindAllRowsByCellContent | Retrieves all rows of all cells in the given column whose content matches the specified data. |
FindRowByCellContent | Retrieves the first row of the cell in the given column whose content matches the specified data. |
GetCellData | Returns the data contained in the specified cell. |
Returns a cell's content from a row with specific content in another cell. | |
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. |
Input | Records an Input statement each time new or modified table cell data is sent to the SAP server. |
IsCellEditable | Checks whether the cell is editable. |
OpenPossibleEntries | Opens the list of possible entries for a specified cell in a grid. |
Output | Retrieves the current value of an item and stores it in a specified location. |
PressEnter | Presses the ENTER keyboard key when a grid control is in focus. |
RefreshObject | Instructs OpenText Functional Testing to re-identify the object in the application the next time a step refers to this object. |
RowCount | Returns the number of rows in the grid. |
SelectAll | Selects all cells in a grid. |
SelectCell | Selects the specified cell in a grid. |
SelectColumn | Selects the specified column in the grid. |
SelectMenuItemById | Selects a menu item from a context menu (opened by right-clicking the grid) based on the specified SAP ID. |
SelectRow | Selects the specified row in the grid. |
SelectRowsRange | Selects the specified range of rows in the grid. |
SetCellData | Sets the cell contents with the specified data. |
SetCheckbox | Sets the specified checkbox in a grid. |
SetTOProperty | Sets the value of the specified description property in the test object description. |
ToString | Returns a string that represents the test object. |
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. |
ActivateCell Method
Description
Double-clicks the specified cell in a grid.
Syntax
object.ActivateCell (Row, Column)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number of the cell to activate. Row numbers begin with 1. |
Column |
Required. A String value. The column of the cell to activate. The column can be specified by the column's label or column number in the format "#index". Column numbers begin with 1. |
Return Type
None.
Example
'The following example uses the ActivateCell method to activate (double-click) the cell in the first row, in the "SD document" column, to 'display the details of a new order. SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiButton("Enter").Click SAPGuiSession("Session").SAPGuiWindow("List of Sales_2").SAPGuiGrid("GridViewCtrl").ActivateCell 1, "SD document"
ActivateColumn Method
Description
Double-clicks the specified column in a grid.
Syntax
object.ActivateColumn (Column)
Arguments
Parameter | Description |
---|---|
Column |
Required. A String value. The column to activate. The column can be specified by the column's label or column number in the format " #index". Column numbers begin with 1. |
Return Type
None.
IMPORTANT
Activating the column selects the entire column, or in certain cases, displays another window.
Example
'The following example uses the ActivateColumn method to double-click on the header of the "Item (SD)" column in 'a list of Sales Orders, and selects the entire column. Sometimes, the ActivateColumn operation also sets the 'column's content in descending or ascending order. SAPGuiSession("Session").SAPGuiWindow("List of Sales_2").SAPGuiGrid("GridViewCtrl").ActivateColumn "Item (SD)"
ActivateRow Method
Description
Double-clicks the specified row in a grid.
Syntax
object.ActivateRow (Row)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number to activate. Row numbers begin with 1. |
Return Type
None.
IMPORTANT
We recommend using an SAPGuiGrid.SelectRow statement before using this method.
Example
'The following example uses the ActivateRow method to double-click the 9th row in a list of Sales Orders 'to display more details for the selected sales order. SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectRow 9 SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ActivateRow 9
ClearSelection Method
Description
Clears any selected rows or columns in a grid.
Syntax
object.ClearSelection
Return Type
None.
IMPORTANT
This method is not recorded. To add this method to your test, use the Step Generator or enter it manually in the Keyword View or Editor. For more information, see the OpenText Functional Testing User Guide.
Example
'The following example uses the ClearSelection method to verify that a dialog box opens only if no rows are 'selected in the grid. SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectRow 3 SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ExtendRow 4 SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ClearSelection SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiButton("Choose detail").Click
ClickCell Method
Description
Clicks the specified cell in a grid.
Syntax
object.ClickCell (Row, Column)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number of the cell to click. Row numbers begin with 1. |
Column |
Required. A String value. The column of the cell to click. The column can be specified by the column's label or column number in the format "#index". Column numbers begin with 1. |
Return Type
None.
IMPORTANT
This method is generally recorded when a button is pressed within a cell or if another item is pressed, resulting in a communication with the SAP server.
Example
'The following example uses the ClickCell method to click the cell in the first row of the "Status" column, 'which opens the "Messages" dialog box. A check box is selected in the "Messages" dialog box and then 'the "Continue (Enter)" button is clicked to close the "Messages" dialog box and return to the grid. SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").ClickCell 1, "Status" SAPGuiSession("Session").SAPGuiWindow("Messages").SAPGuiCheckBox("SAPGuiCheckBox").Set "ON" SAPGuiSession("Session").SAPGuiWindow("Messages").SAPGuiButton("Continue (Enter)").Click
ColumnCount Method
Description
Retrieves the number of columns in the grid.
Syntax
object.ColumnCount
Return Type
A Variant.
Example
'The following example uses the ColumnCount method to retrieve the number of columns in the grid. 'If the number of columns is more than expected, then the grid's view is modified and one of the 'columns is removed. Dim GridColumns GridColumns = SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ColumnCount If GridColumns = 77 Then SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiButton("Current...").Click SAPGuiSession("Session").SAPGuiWindow("Change layout").SAPGuiGrid("GridViewCtrl").SelectRow 6 SAPGuiSession("Session").SAPGuiWindow("Change layout").SAPGuiButton("Hide selected").Click SAPGuiSession("Session").SAPGuiWindow("Change layout").SAPGuiButton("Transfer (Enter)").Click 'check if the grid has changed GridColumns = SAPGuiSession("Session").SAPGuiWindow("List of Sales_2").SAPGuiGrid("GridViewCtrl").ColumnCount If GridColumns = 76 Then Reporter.ReportEvent micPass, "Number of columns in grid", "The right number of columns are displayed" Else Reporter.ReportEvent micFail, "Number of columns in grid", "The wrong number of columns are displayed" End If End If
DeselectColumn Method
Description
Clears the selection of the specified column.
Syntax
object.DeselectColumn (Column)
Arguments
Parameter | Description |
---|---|
Column |
Required. A String value. The column to deselect. The column can be specified by the column's label or column number in the format "#index". Column numbers begin with 1. |
Return Type
None.
Example
'The following example uses the DeselectColumn method to clear (deselect) the "ARKTX" column after selecting 'several columns in the "GridViewCtrl" grid. SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectColumn "ARKTX" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ExtendColumn "Confirmed quantity" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ExtendColumn "Sales document type" SAPGuiSession("Session").SAPGuiWindow("List of Sales_2").SAPGuiGrid("GridViewCtrl").DeselectColumn "ARKTX"
DeselectRow Method
Description
Clears the selection of the specified row.
Syntax
object.DeselectRow (Row)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The number of the row to deselect. Row numbers begin with 1. |
Return Type
None.
IMPORTANT
This method is not recorded. To add this method to your test, use the Step Generator or enter it manually in the Keyword View or Editor. For more information, see the OpenText Functional Testing User Guide.
Example
'The following example uses the DeselectRow method to clear the already selected third row in the "GridViewCtrl" grid '(after all of the rows are selected using the SelectAll method). All other rows remain selected. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "va05" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiButton("ENTER (Enter)").Click SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiEdit("VBCOM-KUNDE").Set "1000" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectAll SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiButton("Enter").Click SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").DeselectRow "3"
DeselectRowsRange Method
Description
Deselects the specified rows in the grid.
Syntax
object.DeselectRowsRange (From, To)
Arguments
Parameter | Description |
---|---|
From |
Required. A long integer value. The number of the first row to deselect. Row numbers begin with 1. |
To |
Required. A long integer value. The number of the last row to deselect. Row numbers begin with 1. |
Return Type
None.
IMPORTANT
This method is not recorded. To add this method to your test, use the Step Generator or enter it manually in the Keyword View or Editor. For more information, see the OpenText Functional Testing User Guide.
Example
'The following example uses the DeselectRowsRange method to deselect rows 3 through 7 in the '"GridViewCtrl" grid (after all of the rows are selected using the SelectAll method). All other 'rows remain selected. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "va05" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiButton("ENTER (Enter)").Click SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiEdit("VBCOM-KUNDE").Set "1000" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectAll SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiButton("Enter").Click SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").DeselectRowsRange 3, 7
ExtendColumn Method
Description
Selects an additional column in the grid.
Syntax
object.ExtendColumn (Column)
Arguments
Parameter | Description |
---|---|
Column |
Required. A String value. The column to add to the selection. The column can be specified by the column's label or column number in the format "#index". Column numbers begin with 1. |
Return Type
None.
Example
'The following example uses the ExtendColumn method to select several columns in the "GridViewCtrl" 'grid before setting a filter. SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiButton("Enter").Click SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectColumn "Sales document type" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ExtendColumn "ARKTX" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ExtendColumn "Selection" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ExtendColumn "Schedule line number" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiButton("Set filter").Click
ExtendRow Method
Description
Selects an additional row in the grid.
Syntax
object.ExtendRow (Row)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The number of the row to add to the selection. Row numbers begin with 1. |
Return Type
None.
Example
'The following example uses the ExtendRow method to select several orders (rows) from a grid. It then uses 'the "New plant" menu item to change the Plant ID associated with these orders. SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectRowsRange 8, 12 SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ExtendRow 14 SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ExtendRow 16 SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ExtendRow 18 SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiMenuBar("mbar").Select "Edit;Mass change;New plant" SAPGuiSession("Session").SAPGuiWindow("Change Plant").SAPGuiEdit("Plant").Set "1001"
ExtendRowsRange Method
Description
Adds the specified range of rows to the selected rows in the grid.
Syntax
object.ExtendRowsRange (From, To)
Arguments
Parameter | Description |
---|---|
From |
Required. A long integer value. The number of the first row to add to the selection. Row numbers begin with 1. |
To |
Required. A long integer value. The number of the last row to add to the selection. Row numbers begin with 1. |
Return Type
None.
Example
'The following example uses the ExtendRowsRange method to select orders (rows) 14-18 in addition to the already 'selected rows 8-12 from a grid. It then uses the "New plant" menu item to change the Plant ID associated with these orders. SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectRowsRange 8, 12 SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").ExtendRowsRange 14, 18 SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiMenuBar("mbar").Select "Edit;Mass change;New plant" SAPGuiSession("Session").SAPGuiWindow("Change Plant").SAPGuiEdit("Plant").Set "1001" SAPGuiSession("Session").SAPGuiWindow("Change Plant").SAPGuiEdit("New plant").Set "1000" SAPGuiSession("Session").SAPGuiWindow("Change Plant").SAPGuiEdit("New plant").SetFocus SAPGuiSession("Session").SAPGuiWindow("Change Plant").SAPGuiButton("Save").Click
FindAllRowsByCellContent Method
Description
Retrieves all rows of all cells in the given column whose content matches the specified data.
Syntax
object.FindAllRowsByCellContent (Col, CellText)
Arguments
Parameter | Description |
---|---|
Col |
Required. A Variant. The column in which you want to search. The column can be specified by the column's label or column number in the format " #index". Column numbers begin with 1. |
CellText |
Required. A Variant. The data for which you want to search. |
Return Type
A Variant.
Example
'The following example uses the FindAllRowsByCellContent method to find all rows in which the city Tokyo is 'displayed in the "Arrival city" column. It then searches these rows to determine if Tokyo also appears in the '"Depart. city" column (each row represents one leg of a flight itinerary). It then reports all instances in which 'Tokyo appears as both the arrival city and the departure city to the run results, since the flight information 'is incorrect (one flight leg cannot arrive to and depart from the same location). Dim rows_num Set rows_num = SAPGuiSession("Session").SAPGuiWindow("BCALV_GRID_08: Define").SAPGuiGrid("Overview").FindAllRowsByCellContent("Arrival city", "TOKYO") For Each num In rows_num If SAPGuiSession("Session").SAPGuiWindow("BCALV_GRID_08: Define").SAPGuiGrid("Overview").GetCellData(num, "Depart. city") = "TOKYO" Then Reporter.ReportEvent micWarning, "The grid contains incorrect data", "In row " & num & " we found that the Arrival city and the Departure city are the same - the flight information is incorrect!" End If Next
FindRowByCellContent Method
Description
Retrieves the first row of the cell in the given column whose content matches the specified data.
Syntax
object.FindRowByCellContent (Col, CellText, [StartFromRow])
Arguments
Parameter | Description |
---|---|
Col |
Required. A Variant. The column in which you want to search. The column can be specified by the column's label or column number in the format " #index". Column numbers begin with 1. |
CellText |
Required. A Variant. The data for which you want to search. |
StartFromRow |
Optional. A Variant. The row in which you want the search to start. Row numbers begin with 1. Default value = 1 |
Return Type
A Variant.
If no content matches the specified value, the return value is NULL.
Example
'The following example uses the FindRowByCellContent method to find the first row in which the "Depart. city" is Rome and 'the "Arrival city" is Frankfurt. If it finds a row with this information, it activates the row. Otherwise, it 'reports to the run results that the searched row could not be found in the grid. SAPGuiSession("Session").SAPGuiWindow("Enjoy Demo Center: Display").SAPGuiTree("TableTreeControl").ActivateItem "Workbench Demos;Controls;Grid Controls;Grid demo with menu button & detail grid", "Grid demo with menu button & detail grid" rowDepart = SAPGuiSession("Session").SAPGuiWindow("BCALV_GRID_08: Define").SAPGuiGrid("Overview").FindRowByCellContent("Depart. city", "ROME") If rowDepart <> Null Then rowArrival = SAPGuiSession("Session").SAPGuiWindow("BCALV_GRID_08: Define").SAPGuiGrid("Overview").GetCellData(rowDepart, "Arrival city") If rowArrival = "FRANKFURT" Then SAPGuiSession("Session").SAPGuiWindow("BCALV_GRID_08: Define").SAPGuiGrid("Overview").ActivateRow rowDepart Else Reporter.ReportEvent micFail, "FindRowByCellContent", "The first row in which ROME is displayed for 'Depart. city' column is not the first row in which the FRANKFURT text was found under the Arrival. city column" End If Else Reporter.ReportEvent micFail, "FindRowByCellContent", "Could not find a row in which the ROME text was found under the Depart. city column" End If
GetCellData Method
Description
Returns the data contained in the specified cell.
Syntax
object.GetCellData (Row, Column)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number of the cell for which you want to retrieve data. Row numbers begin with 1. |
Column |
Required. A String value. The column of the cell for which you want to retrieve data. The column can be specified by the column's label or column number in the format "#index". Column numbers begin with 1. |
Return Type
A Variant.
Example
'The following example uses the GetCellData method to perform iterations on a list of orders 'to find one containing order ID 8373. If order ID 8373 is found, the cell containing it is selected. Dim GridRows Dim cellData, i GridRows = SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").RowCount For i = 1 To GridRows cellData = SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").GetCellData(i, "SD document") If cellData = "8373" Then Exit For End If Next If cellData = "8373" Then Reporter.ReportEvent micPass, "Sales Order search", "The Sales Order was found in the list" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectCell CInt(i), "SD document" Else Reporter.ReportEvent micFail, "Sales Order search", "The Sales Order was not found in the list" End If
GetCellDataEx Method
Description
Returns a cell's content from a row with specific content in another cell.
This method performs the equivalent of FindRowByCellContent and GetCellData, retrieving the content of the specified column from the first row found with the specified content.
Syntax
object.GetCellDataEx (Column, ByColumn, ByValue, [StartFromRow])
Arguments
Parameter | Description |
---|---|
Column |
Required. A String value. The column of the cell for which you want to retrieve data. The column can be specified by the column's label or column number in the format "#index". Column numbers begin with 1. |
ByColumn |
Required. A Variant. The column in which you want to search for the value specified in the ByValue argument. The column can be specified by the column's label or column number in the format " #index". Column numbers begin with 1. |
ByValue | Required. A String. The value for which to search in the column specified in the ByColumn argument. |
StartFromRow |
Optional. A Variant. The row in which you want the search to start. Row numbers begin with 1. Default value = 1 |
Return Type
A Variant.
Example
'The following example uses the GetCellDataEx method to retrieve the contents of the 'cell in the "Arrival city" column from a row with ROME in the "Depart. city" column. 'Note that if there are several rows that match the search criteria, 'OpenText Functional Testing retrieves cell content from the first row that matches the criteria. cellContent = SAPGuiSession("Session").SAPGuiWindow("BCALV_GRID_08: Define").SAPGuiGrid("Overview").GetCellDataEx (“Arrival city”,"Depart. city", "ROME") If cellContent = "FRANKFURT" Then Reporter.ReportEvent micPass, " GetCellDataEx ", “GetCellDataEx method works properly” Else Reporter.ReportEvent micFail, " GetCellDataEx ", “Didn't find right cellcontent” End If
Input Method
Description
Records an Input statement each time new or modified table cell data is sent to the SAP server.
Syntax
object.Input (DataSheet, [ScrollMethod])
Arguments
Parameter | Description |
---|---|
DataSheet |
Required. A String value. The name of the input data sheet containing the data for the grid. |
ScrollMethod |
Optional. A tagSCROLL_METHOD Value. The keyboard key that OpenText Functional Testing uses to scroll or add rows to the grid if the input data sheet includes rows that exceed the number of rows currently displayed in the application. Possible values: 82 or PAGEDOWN: (default) Sends a Page Down key command to scroll the grid. 0 or ENTER: Sends an Enter key command to scroll the grid. For details on when to use this argument, refer to the "Automatically parameterizing table and grid cell values" topic in the SAP Solutions Add-in section of the OpenText Functional Testing Help Center. Default value = micPageDown |
Return Type
None.
IMPORTANT
This method is recorded only if the Auto-parameterize table and grid controls option is selected in the SAP pane of the Options dialog box.
When the Auto-parameterize table and grid controls option is selected, an Input statement is recorded each time new or modified grid cell data is sent to the SAP server. The statement represents all cell values that were set prior to sending the data to the server.
For each recorded Input method, a corresponding input data sheet is automatically inserted in the test's Data Table as a sub-sheet of the action data sheet containing the recorded cell values. Columns are added to the data sheet only for cells containing input data.
Once the new input data sheet has been created by recording the Input statement, you can add or modify the data set, and add additional data sets for each action iteration.
During the test run, this method inserts the values from the input data sheet specified by the SheetName argument into the grid.
During each action iteration, the values of all cells in the relevant data set of the input data sheet are inserted into the grid according to the row position and column name.
Notes:
You must record the Input method using the Auto-parameterize table and grid controls option to create the input data sheet. You cannot create the required input data sheet manually.
A SelectCell method is automatically recorded after each Input statement.
When the Auto-parameterize table and grid controls option is not selected, a SetCellData statement is recorded for each value you set in a grid cell.
For a detailed explanation of how to work with the Input statement and how to edit or add data sets to the input data sheet, refer to the "Automatically parameterizing table and grid cell values" topic in the SAP Solutions Add-in section of the OpenText Functional Testing Help Center.
Example
'The following example uses the Input method to insert the data set from the "Action1.SAPGUI.GridViewCtrl.1" 'input data sheet into the appropriate cells in the "GridViewCtrl" grid. If the action runs multiple iterations, 'the corresponding data set is used in each iteration. SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").Input "Action1.GridViewCtrl" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").PressEnter 'If one or more data sets in your input data sheet contain data for rows that require scrolling in order to make 'them visible, and your grid uses the ENTER key for scrolling, you should add the ScrollMethod argument to the 'Input statement as follows: SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").Input "Action1.GridViewCtrl", ENTER 'If the Auto-parameterize table and grid controls option was not selected, inserting the data into four cells 'would require the following statements instead of the single Input statement. SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Material", "p-101" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 2, "Material", "p-102" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Order quantity", "2" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 2, "Order quantity", "2" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").PressEnter
IsCellEditable Method
Description
Checks whether the cell is editable.
Syntax
object.IsCellEditable (Row, Col)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number of the cell to check. Row numbers begin with 1. |
Col |
Required. A Variant. The column of the cell to check. The column can be specified by the column's label or column number in the format " #index". Column numbers begin with 1. |
Return Type
A Variant.
Example
'The following example uses the IsCellEditable method to determine whether a cell is still editable after a 'user enters data in another cell and presses Enter. SAPGuiSession("Session").Reset "me51n" SAPGuiSession("Session").SAPGuiWindow("Create Purchase Requisition").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Material", "100-433" SAPGuiSession("Session").SAPGuiWindow("Create Purchase Requisition").SAPGuiGrid("GridViewCtrl").SelectCell 1, "Material" SAPGuiSession("Session").SAPGuiWindow("Create Purchase Requisition").SAPGuiGrid("GridViewCtrl").PressEnter Grid_IsCellEditable = SAPGuiSession("Session").SAPGuiWindow("Create Purchase Requisition").SAPGuiGrid("GridViewCtrl").IsCellEditable(2, "Quantity requested") If Grid_IsCellEditable = True Then SAPGuiSession("Session").SAPGuiWindow("Create Purchase Requisition").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Quantity requested", "1" Else Reporter.ReportEvent micPass, "Grid.IsCellEditable return a FALSE value", "Grid.IsCellEditable returned False, therefore the cell cannot be edited" End If
OpenPossibleEntries Method
Description
Opens the list of possible entries for a specified cell in a grid.
Syntax
object.OpenPossibleEntries (Row, Column)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number of the cell for which you want to open the Possible Entries dialog box. Row numbers begin with 1. |
Column |
Required. A String value. The column of the cell for which you want to open the Possible Entries dialog box. The column can be specified by the column's label or column number in the format "#index". Column numbers begin with 1. |
Return Type
None.
Example
'The following example uses the OpenPossibleEntries method to display a list of values that can be 'selected for a specific cell. In this case, it inserts data into the "Material" and "Quantity" columns in 'the "Purchase Requisition" grid. Then it clicks the "Open Possible Entries" button next to the cell 'in the "Unit of measure" column to display a list of values which can be selected for this cell. SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Material", "p-101" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Quantity requested", "1" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").OpenPossibleEntries 1, "Unit of measure"
PressEnter Method
Description
Presses the ENTER keyboard key when a grid control is in focus.
Syntax
object.PressEnter
Return Type
None.
Example
'The following example uses the PressEnter method to press the ENTER keyboard key after entering data in a cell. SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Unit", "PC" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Plant", "1000" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").PressEnter
RowCount Method
Description
Returns the number of rows in the grid.
Syntax
object.RowCount
Return Type
A Variant.
Example
'The following example uses the RowCount method to find the number of rows in the grid in order to iterate 'through the list of orders. If order ID 8373 is found, the cell containing it is selected. Dim GridRows Dim cellData, i GridRows = SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").RowCount For i = 0 To GridRows cellData = SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").GetCellData(i, "SD document") If cellData = "8373" Then Exit For End If Next If cellData = "8373" Then Reporter.ReportEvent micPass, "Sales Order search", "The Sales Order was found in the list" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectCell (i), "SD document" Else Reporter.ReportEvent micFail, "Sales Order search", "The Sales Order was not found in the list" End If
SelectAll Method
Description
Selects all cells in a grid.
Syntax
object.SelectAll
Return Type
None.
Example
'The following example uses the SelectAll method to select all the rows and columns in the "List of Sales Orders" 'grid. SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectAll
SelectCell Method
Description
Selects the specified cell in a grid.
Syntax
object.SelectCell (Row, Column)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number of the cell to select. Row numbers begin with 1. |
Column |
Required. A String value. The column of the cell to select. The column can be specified by the column's label or column number in the format "#index". Column numbers begin with 1. |
Return Type
None.
Example
'The following example uses the SelectCell method to select the first cell in the "SD document" column and then 'opens the "Possible Entries" dialog box for the selected cell. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "va05" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiButton("ENTER (Enter)").Click SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiEdit("VBCOM-KUNDE").Set "1000" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectCell 1, "SD document" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SendKey F4
SelectColumn Method
Description
Selects the specified column in the grid.
Syntax
object.SelectColumn (Column)
Arguments
Parameter | Description |
---|---|
Column |
Required. A String value. The column to select. The column can be specified by the column's label or column number in the format "#index". Column numbers begin with 1. |
Return Type
None.
Example
'The following example uses the SelectColumn method to select the "Quantity requested" column and then 'selects the "&MB_SUM" toolbar button's "Total" menu item (identified by its ID "&SUMC"). SAPGuiSession("Session").SAPGuiWindow("Change Purch.").SAPGuiGrid("GridViewCtrl").SelectColumn "Quantity requested" SAPGuiSession("Session").SAPGuiWindow("Change Purch.").SAPGuiToolbar("GridToolbar").ContextButtonPress "&MB_SUM" SAPGuiSession("Session").SAPGuiWindow("Change Purch.").SAPGuiToolbar("GridToolbar").SelectMenuItemById "&SUMC"
SelectMenuItemById Method
Description
Selects a menu item from a context menu (opened by right-clicking the grid) based on the specified SAP ID.
Syntax
object.SelectMenuItemById (MenuItemId)
Arguments
Parameter | Description |
---|---|
MenuItemId |
Required. A String value. The internal SAP ID for the menu item. |
Return Type
None.
IMPORTANT
When a context menu opens from a grid, OpenText Functional Testing always records a SelectColumnmethod, SelectRow method, or SelectCellmethod, and then records the SelectMenuItemById method. If you want to add a SelectMenuItemById method manually in the Editor, be sure to include one of the Select* methods mentioned above before the SelectMenuItemById method.
Example
'The following example uses the SelectMenuItemById method to select the "Personnel number" column in a grid, 'and select the "Set Filter" context menu item. It then sets a filter option and clicks the "Execute (Enter)" button to display 'the results of the requested filter. SAPGuiSession("Session").SAPGuiWindow("Personalstammdaten").SAPGuiGrid("GridViewCtrl").SelectColumn "Personnel number" SAPGuiSession("Session").SAPGuiWindow("Personalstammdaten").SAPGuiGrid("GridViewCtrl").SelectMenuItemById "&FILTER" SAPGuiSession("Session").SAPGuiWindow("Determine values").SAPGuiEdit("%%DYN001-LOW").Set "*104*" SAPGuiSession("Session").SAPGuiWindow("Determine values").SAPGuiButton("Execute (Enter)").Click
SelectRow Method
Description
Selects the specified row in the grid.
Syntax
object.SelectRow (Row)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The number of the row to select. Row numbers begin with 1. |
Return Type
None.
Example
'The following example uses the SelectRow method to select row 1 from the grid and then clicks the "Choose 'detail" button. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "va05" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiButton("ENTER (Enter)").Click SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiEdit("VBCOM-KUNDE").Set "1000" SAPGuiSession("Session").SAPGuiWindow("List of Sales").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectRow 1 SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiButton("Choose detail").Click
SelectRowsRange Method
Description
Selects the specified range of rows in the grid.
Syntax
object.SelectRowsRange (From, To)
Arguments
Parameter | Description |
---|---|
From |
Required. A long integer value. The number of the first row to select. Row numbers begin with 1. |
To |
Required. A long integer value. The number of the last row to select. Row numbers begin with 1. |
Return Type
None.
Example
'The following example uses the SelectRowsRange method to select rows 8-12 from a grid and then uses the '"New plant" menu item to change the Plant ID associated with these orders (rows). SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiGrid("GridViewCtrl").SelectRowsRange 8, 12 SAPGuiSession("Session").SAPGuiWindow("List of Sales").SAPGuiMenuBar("mbar").Select "Edit;Mass change;New plant" SAPGuiSession("Session").SAPGuiWindow("Change Plant").SAPGuiEdit("Plant").Set "1001" SAPGuiSession("Session").SAPGuiWindow("Change Plant").SAPGuiEdit("New plant").Set "1000" SAPGuiSession("Session").SAPGuiWindow("Change Plant").SAPGuiEdit("New plant").SetFocus SAPGuiSession("Session").SAPGuiWindow("Change Plant").SAPGuiButton("Save").Click
SetCellData Method
Description
Sets the cell contents with the specified data.
Syntax
object.SetCellData (Row, Column, Data)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number of the cell for which you want to specify data. Row numbers begin with 1. |
Column |
Required. A String value. The column of the cell for which you want to specify data. The column can be specified by the column's label or column number in the format "#index". Column numbers begin with 1. |
Data |
Required. A String value. The data to set for the specified cell. The possible values for the data depends on the type of cell. For example, the values may be "ON" or "OFF" for a check box or radio button cell, or may be limited to the available values of a combo box. |
Return Type
None.
IMPORTANT
This method is recorded only when the Auto-parameterize tables and grids option is not selected in the SAP pane of the Options dialog box.
Example
'The following example uses the SetCellData method to enter data in several cells in the first row of a grid 'and then presses the ENTER keyboard key. SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Item", "10" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Material", "100-433" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Quantity", "1" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Unit", "PC" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").SetCellData 1, "Plant", "1000" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiGrid("GridViewCtrl").PressEnter
SetCheckbox Method
Description
Sets the specified checkbox in a grid.
Syntax
object.SetCheckbox (Row, Col, Value)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number of the cell whose check box state you want to set. Row numbers begin with 1. |
Col |
Required. A String value. The column of the cell whose check box state you want to set. The column can be specified by the column's label or column number in the format " #index". Column numbers begin with 1. |
Value |
Required. A String value. The state of the check box. "ON" "OFF" |
Return Type
None.
Example
'The following example uses the SetCheckbox method to select (turn "ON") and clear (turn "OFF") specific 'check boxes inside the grid, as follows: SAPGuiSession("Session").SAPGuiWindow("SAP R/3_2").SAPGuiGrid("My titlebar").SetCheckbox 1, "Check", "OFF" SAPGuiSession("Session").SAPGuiWindow("SAP R/3_2").SAPGuiGrid("My titlebar").SetCheckbox 4, "Check", "OFF" SAPGuiSession("Session").SAPGuiWindow("SAP R/3_2").SAPGuiGrid("My titlebar").SetCheckbox 7, "Check", "OFF" SAPGuiSession("Session").SAPGuiWindow("SAP R/3_2").SAPGuiGrid("My titlebar").SetCheckbox 1, "Check", "ON" SAPGuiSession("Session").SAPGuiWindow("SAP R/3_2").SAPGuiGrid("My titlebar").SetCheckbox 4, "Check", "ON" SAPGuiSession("Session").SAPGuiWindow("SAP R/3_2").SAPGuiGrid("My titlebar").SetCheckbox 6, "Check", "ON" SAPGuiSession("Session").SAPGuiWindow("SAP R/3_2").SAPGuiGrid("My titlebar").SelectCell 6, "Check" SAPGuiSession("Session").SAPGuiWindow("SAP R/3_2").SAPGuiButton("Enter").Click
See also: