SAPGuiTable Object
Description
A table 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 SAPGuiTable object.
Note: You can also view a list and descriptions of the SAPGuiTable 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 table. |
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. |
ClickCell | Emulates a click on the specified cell in a table. |
ColumnCount | Retrieves the number of columns in the table. |
DeselectColumn | Clears the selection of the specified column. |
DeselectRow | Clears the selection of the specified row. |
DeselectRowsRange | Clears the selection of the specified rows in the table. |
ExtendColumn | Selects an additional column in the table. |
ExtendRow | Selects an additional row in the table. |
ExtendRowsRange | Adds the specified range of rows to the selected rows in the table. |
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. | |
GetCellLength | Retrieves the maximum length of the 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 table. |
Output | Retrieves the current value of an item and stores it in a specified location. |
PressSettingsButton | Presses the table setting button. |
RefreshObject | Instructs UFT One 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 table. |
SelectAllColumns | Selects all columns in the table. |
SelectCell | Selects the specified cell in a table. |
SelectColumn | Selects the specified column in the table. |
SelectRow | Selects the specified row in the table. |
SelectRowsRange | Selects the specified range of rows in the table. |
SetCellData | Sets the cell contents with the specified data. |
SetTOProperty | Sets the value of the specified description property in the test object description. |
ToString | Returns a string that represents the test object. |
ValidRow | Indicates whether or not the specified row is a valid row for the table. |
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 table.
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.
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 UFT One User Guide.
Example
'The following example uses the ActivateCell method to double-click one of the materials (items) in Order 5121 '(after accessing transaction "VA03"). The checkpoint verifies that the data for the Order item is displayed. SAPGuiSession( "Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "va03" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("Display Sales").SAPGuiEdit("Order number").Set "5121" SAPGuiSession("Session").SAPGuiWindow("Display Sales").SAPGuiButton("Enter").Click SAPGuiSession("Session").SAPGuiWindow("Display Standard").SAPGuiTable("SAPMV45ATCTRL_U_ERF_").ActivateCell "1", "Material" SAPGuiSession("Session").SAPGuiWindow("Display Standard_2").Check CheckPoint("Display Standard_2")
ClickCell Method
Description
Emulates a click on the specified cell in a table.
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 simulate a click on a cell in the "Status" column 'of the "SAPLMEGUITC_1211" table. First, it adds the data for a material into the table in the Purchase 'Order transaction. Then, to verify the material's information, it clicks the button for the material '(located in the Status column). SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "me21n" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiButton("ENTER (Enter)").Click SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").SetCellData 1, "Material", "100-103" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").SetCellData 1, "PO quantity", "1" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").SetCellData 1, "Deliv. date", "20.10.2003" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").SetCellData 1, "Plnt", "1000" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").ClickCell 1, "Status"
ColumnCount Method
Description
Retrieves the number of columns in the table.
Syntax
object.ColumnCount
Return Type
A Variant.
Example
'The following example uses the ColumnCount method to retrieve the number of columns in the "SAPLMEGUITC_1211" 'table (after accessing the "me23n" transaction). Then, it verifies that the table is displayed with the 'required number of columns. If the number of columns in the table is not equal to the required number, the '"Set filter" button is clicked to change the layout of the table. Dim TableColumns SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "me23n" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER TableColumns = SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").ColumnCount If TableColumns < 9 Then SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").SelectCell 1, "Higher-level item" SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiButton("Set filter").Click SAPGuiSession("Session").SAPGuiWindow("Define filter").SAPGuiGrid("GridViewCtrl").SelectCell 35, "Column Name" SAPGuiSession("Session").SAPGuiWindow("Define filter").SAPGuiGrid("GridViewCtrl").SelectRow 35 SAPGuiSession("Session").SAPGuiWindow("Define filter").SAPGuiButton("Add filter criterion").Click SAPGuiSession("Session").SAPGuiWindow("Define filter").SAPGuiButton("Transfer (Enter)").Click 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 the selection of the "Confirmation" column in the '"SAPLCORUTABCNTR_3350" table. First, it selects three columns in the "SAPLCORUTABCNTR_3350" table 'and sorts them in ascending order. Then it clears the "Confirmation" column and sorts the selected 'columns in descending order. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "iw48" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("Confirmation").SAPGuiButton("Execute (F8)").Click SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").SelectColumn "Confirmation" SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").ExtendColumn "Order" SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").ExtendColumn "Operation" SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiButton("Sort in ascending").Click SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").DeselectColumn "Confirmation" SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiButton("Sort in descending").Click
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 valid only for tables that support multiple row selection.
Example
'The following example uses the DeselectRow method to clear the selection of rows 8 and 11 in the "SAPLMGMMTC_VIEW" table '(after first selecting all of the views (rows) in the "Select Views" window). SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiButton("Select all").Click SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLMGMMTC_VIEW").DeselectRow 8 SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLMGMMTC_VIEW").DeselectRow 11 SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLMGMMTC_VIEW").SelectCell 16, "#1" SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiButton("Continue (Enter)").Click
DeselectRowsRange Method
Description
Clears the selection of the specified rows in the table.
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 valid only for tables that support multiple row selection.
Example
'The following example uses the DeselectRowsRange method to clear the selection of rows 10 through 13 'in the "SAPLMGMMTC_VIEW" table. SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiButton("Select all").Click SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLMGMMTC_VIEW").DeselectRowsRange 10, 13 SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiButton("Continue (Enter)").Click
ExtendColumn Method
Description
Selects an additional column in the table.
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.
IMPORTANT
This method is valid only for tables that support multiple column selection.
Example
'The following example uses the ExtendColumn method to select three columns in a table and sort them in 'ascending order. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "iw48" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("Confirmation").SAPGuiButton("Execute (F8)").Click SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").SelectColumn "Confirmation" SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").ExtendColumn "Order" SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").ExtendColumn "Operation" SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiButton("Sort in ascending").Click
ExtendRow Method
Description
Selects an additional row in the table.
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.
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 UFT One User Guide.
This method is valid only for tables that support multiple row selection.
Example
'The following example uses the ExtendRow method to select rows 2 and 4 in addition to row 1 in the "SAPLMGMMTC_VIEW" table. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "mm01" '... SAPGuiSession("Session").SAPGuiWindow("Create Material").SAPGuiButton("Select view(s)").Click SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLMGMMTC_VIEW").SelectRow 1 SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLMGMMTC_VIEW").ExtendRow 2 SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLMGMMTC_VIEW").ExtendRow 4 SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLMGMMTC_VIEW").SelectCell 4, "#1" SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiButton("Continue (Enter)").Click
ExtendRowsRange Method
Description
Adds the specified range of rows to the selected rows in the table.
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.
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 UFT One User Guide.
This method is valid only for tables that support multiple row selection.
Example
'The following example uses the ExtendRowsRange method to select a range of additional rows (rows 2 to 5) 'in the "SAPLMGMMTC_VIEW" table. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "mm01" '... SAPGuiSession("Session").SAPGuiWindow("Create Material").SAPGuiButton("Select view(s)").Click SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLMGMMTC_VIEW").SelectRow 2 SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLMGMMTC_VIEW").ExtendRowsRange 2, 5 SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLMGMMTC_VIEW").SelectCell 4, "#1" SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiButton("Continue (Enter)").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). Finally, it closes the SAP windows 'session. Dim rows_num Set rows_num = SAPGuiSession("Session").SAPGuiWindow("Style Guide: Table control").SAPGuiTable("Table control example").FindAllRowsByCellContent("Arrival city", "TOKYO") For Each num In rows_num If SAPGuiSession("Session").SAPGuiWindow("Style Guide: Table control").SAPGuiTable("Table control example").GetCellData(num, "Depart. city") = "TOKYO" Then Reporter.ReportEvent micWarning, "The table 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 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 in order to display 'the order or flight that was found. Otherwise, it reports to the run results that the searched row could not be found 'in the table. Note that if there are several rows that match the search criteria, UFT One finds the first row that matches the criteria. rowDepart = SAPGuiSession("Session").SAPGuiWindow("Style Guide: Table control").SAPGuiTable("Table control example").FindRowByCellContent("Depart. city", "ROME") If rowDepart Then rowArrival = SAPGuiSession("Session").SAPGuiWindow("Style Guide: Table control").SAPGuiTable("Table control example").GetCellData(rowDepart, "Arrival city") If rowArrival = "FRANKFURT" Then SAPGuiSession("Session").SAPGuiWindow("Style Guide: Table control").SAPGuiTable("Table control example").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 retrieve data from cells in the "Material" column of the '"SAPLMEGUITC_1211" table (after accessing the "me23n" transaction). If the "100-110" material is found, it is 'reported to the run results. Dim TableRows Dim cellData, i SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "me23n" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiButton("ENTER (Enter)").Click TableRows = SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").RowCount For i = 1 To TableRows cellData = SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").GetCellData(CInt(i), "Material") If cellData = "100-110" Then Exit For End If Next If cellData = "100-110" Then Reporter.ReportEvent micPass, "Item search in a PO", "The material was found in the PO" SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").ClickCell 1, "Status" Else Reporter.ReportEvent micFail, "Item search in a PO", "The material was not found in the PO" 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 content of cell in column '"Destination cit" from a row where the "Flight Number" is 788. 'Note that if there are several rows that match the search criteria, UFT One retrieves the 'cell content from the first row that matches the criteria. CellContent = SAPGuiSession("Session").SAPGuiWindow("SAP R/3_3").SAPGuiTable("Table control tc spfli").GetCellDataEx("Destination cit","Flight Number","788") If CellContent<> "TOKYO" Then Reporter.ReportEvent micFail,"Table.GetCellDataEx","Table.GetCellDataEx method failed to retrieve the expected value, got"&CellContent&",expected TOKYO" Else Reporter.ReportEvent micPass,"Table.GetCellDataEx","Table.GetCellDataEx method works properly" End If
GetCellLength Method
Description
Retrieves the maximum length of the cell.
Syntax
object.GetCellLength (Row, Col)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number of the cell whose length you want to retrieve. Row numbers begin with 1. |
Col |
Required. A Variant. The column of the cell whose length you want to retrieve. 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 GetCellLength method to retrieve the length of the cell in row 3 of the '"Depart. city" column. If the cell length is inappropriate, it reports this to the run results. Table_GetCellLength = SAPGuiSession("Session").SAPGuiWindow("Table control example").SAPGuiTable("Table control title").GetCellLength(3, "Depart.city") If Table_GetCellLength = -1 Then Reporter.ReportEvent micFail, "Table.GetCellLength", "The requested cell does not have a valid length" Else Reporter.ReportEvent micPass, "Table.GetCellLength", "Table.GetCellLength returned " & Table_GetCellLength & " for the requested cell" 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 table. |
ScrollMethod |
Optional. A tagSCROLL_METHOD Value. The keyboard key that UFT One uses to scroll or add rows to the table 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 table. 0 or ENTER: Sends an Enter key command to scroll the table. 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 UFT One 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 table 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 table.
During each action iteration, the values of all cells in the relevant data set of the input data sheet are inserted into the table 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 table 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 UFT One Help Center.
Example
'The following example uses the Input method to insert the data set from the "Action1.All Items" input data 'sheet into the appropriate cells in the "All Items" table. If the action runs multiple iterations, 'the corresponding data set is used in each iteration. SAPGuiSession("Session").SAPGuiWindow("Create Standard").SAPGuiTable("All Items").Input "Action1.All Items" SAPGuiSession("Session").SAPGuiWindow("Create Standard").SAPGuiButton("Enter").Click 'If one or more data sets in the input data sheet contains data for rows that require the table to be scrolled to make 'them visible for data input, and the table uses the ENTER key for scrolling, the following ScrollMethod argument would be added 'to the Input statement as follows: SAPGuiSession("Session").SAPGuiWindow("Create Standard").SAPGuiTable("All Items").Input "Action1.All Items", 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 Standard").SAPGuiTable("All Items").SetCellData 1, "Material, p-101" SAPGuiSession("Session").SAPGuiWindow("Create Standard").SAPGuiTable("All Items").SetCellData 2, "Material, p-102" SAPGuiSession("Session").SAPGuiWindow("Create Standard").SAPGuiTable("All Items").SetCellData 1, "Order quantity", "2" SAPGuiSession("Session").SAPGuiWindow("Create Standard").SAPGuiTable("All Items").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 a cell and presses Enter. SAPGuiSession("Session").SAPGuiWindow("Create Standard Order:").SAPGuiTable("All items").SetCellData 1, "Item", "10" SAPGuiSession("Session").SAPGuiWindow("Create Standard Order:").SAPGuiTable("All items").SetCellData 1, "Material", "p-100" SAPGuiSession("Session").SAPGuiWindow("Create Standard Order:").SAPGuiTable("All items").SetCellData 1, "Order quantity", "1" SAPGuiSession("Session").SAPGuiWindow("Create Standard Order:").SAPGuiTable("All items").SelectCell 1, "Order quantity" SAPGuiSession("Session").SAPGuiWindow("Create Standard Order:").SendKey ENTER Table_IsCellEditable = SAPGuiSession("Session").SAPGuiWindow("Create Standard Order:").SAPGuiTable("All items").IsCellEditable(1, "#3") If Table_IsCellEditable = True Then SAPGuiSession("Session").SAPGuiWindow("Create Standard Order:").SAPGuiTable("All items").SetCellData 1, "#3", "2" Else Reporter.ReportEvent micFail, "Table.IsCellEditable return a FALSE value", "Table.IsCellEditable returned False, therefore the cell cannot be edited" End If
OpenPossibleEntries Method
Description
Opens the list of possible entries for a table.
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.
IMPORTANT
This method is not recorded for table controls. Instead a SelectCell step followed by a SendKey F4 step is recorded when you press F4 to open the Possible Entries dialog box for a cell in a table control. However, if you manually enter an OpenPossibleEntries statement for a table control, it runs successfully.
Example
'The following example uses the OpenPossibleEntries method to open the "Possible Entries" dialog box for the "8377" order 'in the "SAPMV45ATCTRL_U_ERF_" table. SAPGuiSession("Session").SAPGuiWindow("Change Sales").SAPGuiEdit("VBAK-VBELN").Set "8377" SAPGuiSession("Session").SAPGuiWindow("Change Sales").SAPGuiButton("Enter").Click SAPGuiSession("Session").SAPGuiWindow("Change Standard").SAPGuiTable("SAPMV45ATCTRL_U_ERF_").OpenPossibleEntries 1, "Plnt"
PressSettingsButton Method
Description
Presses the table setting button.
Syntax
object.PressSettingsButton
Return Type
None.
Example
'The following example uses the PressSettingsButton method to open the Table Settings dialog box for the '"Table control example" table. It then verifies that the "TableSettings Button" button works by checking 'whether the "Table Settings" dialog box was opened (and closes it it if it was opened). SAPGuiSession("Session").SAPGuiWindow("Style Guide: Table control").SAPGuiTable("Table control example").PressSettingsButton If SAPGuiSession("Session").SAPGuiWindow("Table Settings").Exist(1) Then Reporter.ReportEvent micPass, "TableSettings Button", "Table Settings Button passed" SAPGuiSession("Session").SAPGuiWindow("Table Settings").SAPGuiButton("Close").Click Else Reporter.ReportEvent micFail, "TableSettings Button", "Table Settings Button Failed to be pressed" End If
RowCount Method
Description
Returns the number of rows in the table.
Syntax
object.RowCount
Return Type
A Variant.
IMPORTANT
The value returned for this method is only an approximation when performed on a table control. We recommend using the ValidRow method instead of, or in conjunction with, this method.
Example
'The following example uses the RowCount method to check the number of rows in the table. It then searches all 'of the rows in the table for a specific material in a specific Purchase Order and checks the status of that item. Dim TableRows Dim cellData, i TableRows = SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").RowCount For i = 0 To TableRows cellData = SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").GetCellData(i, "Material") If cellData = "100-110" Then Exit For End If Next If cellData = "100-110" Then Reporter.ReportEvent micPass, "Item search in a PO", "The material was found in the PO" SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").ClickCell 1, "Status" Else Reporter.ReportEvent micFail, "Item search in a PO", "The material was not found in the PO" End If
SelectAllColumns Method
Description
Selects all columns in the table.
Syntax
object.SelectAllColumns
Return Type
None.
Example
'The following example uses the SelectAllColumns method to select all columns in a table after first navigating 'to the IW48 transaction. After it selects all of the columns in the "SAPLCORUTABCNTR_3350" table, it clicks the '"Sort in descending order" button and sorts all columns in descending order. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "iw48" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("Confirmation using operation").SAPGuiButton("Execute (F8)").Click SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation:").SAPGuiTable("SAPLCORUTABCNTR_3350").SelectAllColumns SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation:").SAPGuiButton("Sort in descending order").Click
SelectCell Method
Description
Selects the specified cell in a table.
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.
IMPORTANT
The SelectCell and SendKey F4 steps are recorded whenever an F4 Help (Possible Entries) dialog box is opened for a table control.
Example
'The following example uses the SelectCell method to select a specific cell in the "Deliv. date" column in 'the "SAPLMEGUITC_1211" table (after accessing the "me22n" transaction). It then opens the "Possible Entries" dialog box for the cell to modify the 'delivery date (by changing the month) for one of the materials in a Purchase Order. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "me22n" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").SelectCell 1, "Deliv. date" SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").OpenPossibleEntries 1, "Deliv. date" SAPGuiSession("Session").SAPGuiWindow("Calendar").SAPGuiComboBox("WORKFLDS-MONTH").SetFocus SAPGuiSession("Session").SAPGuiWindow("Calendar").SAPGuiComboBox("WORKFLDS-MONTH").Select "October" SAPGuiSession("Session").SAPGuiWindow("Calendar").SAPGuiEdit("IOWORKFLDS-DAY03").SetFocus SAPGuiSession("Session").SAPGuiWindow("Calendar").SAPGuiButton("Choose").Click
SelectColumn Method
Description
Selects the specified column in the table.
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 a column in a table and then sorts it in descending 'order. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "iw48" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("Confirmation").SAPGuiButton("Execute (F8)").Click SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").SelectColumn "Order" SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").SelectCell 1, "Order" SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiButton("Sort in descending").Click
SelectRow Method
Description
Selects the specified row in the table.
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 4 from the table in the "Select View(s)" dialog box 'and then clicks the "Continue (Enter)" button. SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiTable("SAPLM_VIEW").SelectRow 4 SAPGuiSession("Session").SAPGuiWindow("Select View(s)").SAPGuiButton("Continue (Enter)").Click
SelectRowsRange Method
Description
Selects the specified range of rows in the table.
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.
IMPORTANT
This method is valid only for tables that support multiple row selection.
Example
'The following example uses the SelectRowsRange method to select row 4 in the "Order Confirmation" table and 'extend the selection to rows 5-8. It then clicks the "Actual data" button to display its details. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "iw48" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiButton("ENTER (Enter)").Click SAPGuiSession("Session").SAPGuiWindow("Confirmation").SAPGuiButton("Execute (F8)").Click SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").SelectRow 4 SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").SelectRowsRange 5, 8 SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiTable("SAPLCORUTABCNTR_3350").SelectCell 5, "Chg" SAPGuiSession("Session").SAPGuiWindow("PM Order Confirmation").SAPGuiButton("Actual data").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 the '"SAPLMEGUITC_1211" table during the purchase order creation process. Note that 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. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "me21n" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").SetCellData 1, "#2", "10" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").SetCellData 1, "Material", "100-433" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").SetCellData 1, "PO quantity", "1" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").SetCellData 1, "OUn", "PC" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").SetCellData 1, "C", "D" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").SetCellData 1, "Deliv. date", "20.10.2003" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiTable("SAPLMEGUITC_1211").SelectCell 1, "Deliv. date" SAPGuiSession("Session").SAPGuiWindow("Create Purchase").SAPGuiButton("Enter").Click
ValidRow Method
Description
Indicates whether or not the specified row is a valid row for the table.
Syntax
object.ValidRow (Row)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number you want to check. Row numbers begin with 1. |
Return Type
A Variant.
IMPORTANT
This method is especially useful when working with table control objects, for which the RowCount Method can only retrieve an estimated row count.
Example
'The following example uses the ValidRow method to check each row in the table until an empty (and valid) row 'is found and then enters data into the empty row. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "me22n" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER nRowsCount = SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").RowCount nRowIdx = 1 While nRowIdx <= nRowsCount And SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").ValidRow(iRowIdx) = True If SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").GetCellData(nRowIdx, "Material") = "" Then Exit Do End If nRowIdx = nRowIdx + 1 Wend SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").SetCellData nRowIdx, "#2", "50" SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").SetCellData nRowIdx, "Material", "102-110" SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").SetCellData nRowIdx, "PO quantity", "1" SAPGuiSession("Session").SAPGuiWindow("Standard PO").SAPGuiTable("SAPLMEGUITC_1211").SelectCell nRowIdx, "PO quantity" SAPGuiSession("Session").SAPGuiWindow("Standard PO").SendKey ENTER
See also: