SAPGuiAPOGrid Object
Description
An APO 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 SAPGuiAPOGrid object.
Note: You can also view a list and descriptions of the SAPGuiAPOGrid 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 an APO 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 an APO grid. |
ColumnCount | Returns the number of columns in the APO grid. |
DeselectCell | Deselects the specified cell. |
DeselectColumn | Clears the selection of the specified column. |
DeselectRow | Clears the selection of the specified row. |
DeselectRowsRange | Deselects the specified rows in the APO grid. |
ExtendCell | Extends the cell selection to include the specified cell. |
ExtendColumn | Selects an additional column in the APO grid. |
ExtendRow | Selects an additional row in the APO grid. |
ExtendRowsRange | Adds the specified range of rows to the selected rows in the APO 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. | |
GetCellFormat | Retrieves the type of the specified 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 APO grid cell data is sent to the SAP server. |
IsCellEditable | Checks whether the cell is editable. |
Output | Retrieves the current value of an item and stores it in a specified location. |
PressEnter | Presses the ENTER keyboard key when an APO grid control is in focus. |
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 APO grid. |
SelectAll | Selects all cells in the APO grid. |
SelectCell | Selects the specified cell in an APO grid. |
SelectCellMenuItem | Right-clicks the specified cell and selects the specified menu item. |
SelectColumn | Selects the specified column in the APO grid. |
SelectColumnMenuItem | Right-clicks the specified column and selects the specified menu item. |
SelectRow | Selects the specified row in the APO grid. |
SelectRowsRange | Selects the specified range of rows in the APO grid. |
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. |
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 an APO 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 second row, 'in the "M 02.2004" column, to display the details of the last year's sales. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access SAP Advanced").SAPGuiTree("TableTreeControl").ActivateNode "Favorites;/SAPAPO/SDP94 - Demand Planning -> Planning -> Interactive Demand Planni" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiTree("TableTreeControl").ActivateItem "MILL_DEMO;SALES MM EU", "SALES MM EU" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ActivateCell 2, "M 02.2004"
ClearSelection Method
Description
Clears any selected rows or columns in an APO grid.
Syntax
object.ClearSelection
Return Type
None.
Example
'The following example uses the ClearSelection method to verify that no rows are selected in the APO grid. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectCell 2, "M 02.2004" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendCell 5, "M 02.2004" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendColumn "M 03.2004" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiButton("Enter").Click SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ClearSelection
ColumnCount Method
Description
Returns the number of columns in the APO grid.
Syntax
object.ColumnCount
Return Type
A Variant.
Example
'The following example uses the ColumnCount method to retrieve the number of columns in the APO grid. 'If the number of columns is more than expected, it switches to 'Design mode'. Dim GridColumns SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ColumnCount If GridColumns < 50 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" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiToolbar("ToolBarControl").PressButton "MSDP_DESIGN" End If
DeselectCell Method
Description
Deselects the specified cell.
Syntax
object.DeselectCell (Row, Column)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The number of the row to deselect. Row numbers begin with 1. |
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 DeselectCell method to clear (deselect) the cell in row 4, column 6, after 'selecting it in the "IgridCtrl" grid. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectCell 4, "#6" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").DeselectCell 4, "#6"
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 "M 05.2005" column, after 'selecting several columns in the "IgridCtrl" grid. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectColumn "M 12.2004" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendColumn "M 02.2005" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendColumn "M 01.2005" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").DeselectColumn "M 05.2005" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiButton("Enter").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.
Example
'The following example uses the DeselectRow method to clear the third row in the "IgridCtrl" APO grid '(after all of the rows are selected using the SelectAll method). All other rows remain selected. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectAll SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").DeselectRow 3 SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiButton("Enter").Click
DeselectRowsRange Method
Description
Deselects the specified rows in the APO grid.
Syntax
object.DeselectRowsRange (StartRow, EndRow)
Arguments
Parameter | Description |
---|---|
StartRow |
Required. A long integer value. The number of the first row to deselect. Row numbers begin with 1. |
EndRow |
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 UFT One User Guide.
Example
'The following example uses the DeselectRowsRange method to deselect rows 3 through 7 in the '"IgridCtrl" APO grid (after all of the rows are selected using the SelectAll method). All other 'rows remain selected. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectAll SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiButton("Enter").Click SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").DeselectRowsRange 3, 7
ExtendCell Method
Description
Extends the cell selection to include the specified cell.
Syntax
object.ExtendCell (Row, Column)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The number of the row to add to the selection. Row numbers begin with 1. |
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 ExtendCell method to select the cell in row 5 in the "M 02.2004" column in addition to 'any already selected cells in the "IgridCtrl" APO grid. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectCell 2, "M 02.2004" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendCell 5, "M 02.2004" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendColumn "M 03.2004" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiButton("Enter").Click
ExtendColumn Method
Description
Selects an additional column in the APO 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 "IgridCtrl" 'APO grid before setting a filter. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectColumn "M 12.2004" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendColumn "M 02.2004" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendColumn "M 03.2004" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiButton("Enter").Click
ExtendRow Method
Description
Selects an additional row in the APO 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 rows in the APO grid. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectRowsRange 8, 12 SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendRow 14 SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendRow 16 SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendRow 18
ExtendRowsRange Method
Description
Adds the specified range of rows to the selected rows in the APO 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 rows 8-12 and 14-18 in an APO grid. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectRowsRange 8, 12 SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ExtendRowsRange 14, 18
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 number '12338.78' is 'displayed in the "M 12.2004" column. It then reports all instances in which this data appears. Dim rows_num Set rows_num = SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").FindAllRowsByCellContent("M 12.2004", "12338.78") For Each num In rows_num If SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").GetCellData(num, "M 12.2004") = "12338.78" Then Reporter.ReportEvent micWarning, "The grid contains duplicate data", "In row " & num 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 "12338.78" is displayed in the "M 12.2004" column. 'If it finds a row with this information, it highlights the row. Otherwise, it it reports to the run results 'that the specified row could not be found in the APO grid. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access SAP Advanced").SAPGuiTree("TableTreeControl").ActivateNode "Favorites;/SAPAPO/SDP94 - Demand Planning -> Planning -> Interactive Demand Planni" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiTree("TableTreeControl").ActivateItem "MILL_DEMO;SALES MM EU", "SALES MM EU" rowSales = SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").FindRowByCellContent("M 12.2004", "12338.78") If rowSales <> Null Then SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectRow rowSales Reporter.ReportEvent micPass, "FindRowByCellContent", "The first row in which '12338.78' is displayed in the 'M 12.2004' column is " & rowSales Else Reporter.ReportEvent micFail, "FindRowByCellContent", "Could not find a row in which the '12338.78' text was found under the 'M 12.2004' 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("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").RowCount For i = 1 To GridRows cellData = SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").GetCellData(i, "M 10.2004") If cellData = "8373" Then Exit For End If Next If cellData = "8373" Then Reporter.ReportEvent micPass, "material search", "The data was found in the list" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectCell i, "M 10.2004" Else Reporter.ReportEvent micFail, "material search", "The data 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 column "M 10.2004" from a row with "12338.78" in column "M 12.2004". 'Note that if there are several rows that match the search criteria, 'UFT One retrieves cell content from the first row that matches the criteria. cellContent = SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").GetCellDataEx (“M 10.2004”,"M 12.2004", "12338.78") If cellContent = "8373" Then Reporter.ReportEvent micPass, " GetCellDataEx ", “GetCellDataEx method works properly” Else Reporter.ReportEvent micFail, " GetCellDataEx ", “Didn't find right cellcontent” End If
GetCellFormat Method
Description
Retrieves the type of the specified cell.
Syntax
object.GetCellFormat (Row, Column)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number of the cell. Row numbers begin with 1. |
Column |
Required. A String value. The column of the cell. 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 GetCellFormat method to check whether the cell in row 5, column 4 has the format "float.2". If SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").GetCellFormat(5, "#4") = "float.2" Then Reporter.ReportEvent micPass, "SAPGuiAPOGrid - GetCellFormat Method", "" Else Reporter.ReportEvent micFail, "SAPGuiAPOGrid - GetCellFormat Method", "" End If
Input Method
Description
Records an Input statement each time new or modified APO grid 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 UFT One 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 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 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 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.IgridCtrl" 'input data sheet into the appropriate cells in the "IgridCtrl" grid. If the action runs multiple iterations, 'the corresponding data set is used in each iteration. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").Input "Action1.IgridCtrl" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").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("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").Input "Action1.IgridCtrl", 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("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SetCellData 1, "M 10.2003", "103,2" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SetCellData 2, "M 12.2003", "14000" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SetCellData 1, "M 01.2004", "50" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SetCellData 2, "M 02.2004", "23490" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").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").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SetCellData 1, "M 3.2004", "10000" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectCell 1, "M 3.2004" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").PressEnter Grid_IsCellEditable = SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").IsCellEditable(2, "M 3.2004") If Grid_IsCellEditable = True Then SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SetCellData 2, "M 3.2004", "15000" Else Reporter.ReportEvent micPass, "Grid.IsCellEditable return a FALSE value", "Grid.IsCellEditable returned False, therefore the cell cannot be edited" End If
PressEnter Method
Description
Presses the ENTER keyboard key when an APO 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 an APO grid. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SetCellData 1, "M 11.2003", "14,3" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SetCellData 1, "M 12.2004", "500" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").PressEnter
RowCount Method
Description
Returns the number of rows in the APO grid.
Syntax
object.RowCount
Return Type
A Variant.
Example
'The following example uses the RowCount method to find the number of rows in the APO grid in order to iterate 'through the list of material sale quantities. If "8373" is found, the cell containing it is selected. Dim GridRows Dim cellData, i GridRows = SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").RowCount For i = 0 To GridRows cellData = SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").GetCellData(i, "M 11.2003") If cellData = "8373" Then Exit For End If Next If cellData = "8373" Then Reporter.ReportEvent micPass, "material search", "The data was found in the list" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectCell (i), "M 11.2003" Else Reporter.ReportEvent micFail, "material search", "The data was not found in the list" End If
SelectAll Method
Description
Selects all cells in the APO grid.
Syntax
object.SelectAll
Return Type
None.
Example
'The following example uses the SelectAll method to select all the rows and columns in the "IgridCtrl" 'APO grid. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access SAP Advanced").SAPGuiTree("TableTreeControl").ActivateNode "Favorites;/SAPAPO/SDP94 - Demand Planning -> Planning -> Interactive Demand Planni" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiTree("TableTreeControl").ActivateItem "MILL_DEMO;SALES MM EU", "SALES MM EU" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectAll
SelectCell Method
Description
Selects the specified cell in an APO 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 "M 01.2005" column. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access SAP Advanced").SAPGuiTree("TableTreeControl").ActivateNode "Favorites;/SAPAPO/SDP94 - Demand Planning -> Planning -> Interactive Demand Planni" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiTree("TableTreeControl").ActivateItem "MILL_DEMO;SALES MM EU", "SALES MM EU" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectCell 1, "M 01.2005"
SelectCellMenuItem Method
Description
Right-clicks the specified cell and selects the specified menu item.
Syntax
object.SelectCellMenuItem (Row, Column, MenuItemPath)
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row number of the cell to select. |
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. |
MenuItemPath |
Required. A String value. The text of the menu item. |
Return Type
None.
Example
'The following example uses the SelectCellMenuItem method to select the "Display details" menu item 'for the cell in row 9, column "M 01.2005" in the "IgridCtrl" APO grid. SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access SAP Advanced").SAPGuiTree("TableTreeControl").ActivateNode "Favorites;/SAPAPO/SDP94 - Demand Planning -> Planning -> Interactive Demand Planni" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiTree("TableTreeControl").ActivateItem "MILL_DEMO;SALES MM EU", "SALES MM EU" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectCellMenuItem 9, "M 01.2005", "Display details"
'The following example uses the SelectCellMenuItem method to select the "Display details" context menu item 'of the fourth cell in the "M 10.2003" column. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ClearSelection SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectCell 4, "M 10.2003" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectCellMenuItem 4, "M 10.2003", "Display details"
SelectColumn Method
Description
Selects the specified column in the APO 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 "M 09.2003" column and then 'click the "Period information/description" context menu item. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectColumn "M 09.2003" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectColumnMenuItem "M 09.2003", "Period information/description"
SelectColumnMenuItem Method
Description
Right-clicks the specified column and selects the specified menu item.
Syntax
object.SelectColumnMenuItem (Column, MenuItemPath)
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. |
MenuItemPath |
Required. A String value. The text of the menu item. |
Return Type
None.
Example
'The following example uses the SelectColumn method to select the "M 09.2003" column 'and then click the "Period information/description" context menu item. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectColumn "M 09.2003" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectColumnMenuItem "M 09.2003", "Period information/description"
SelectRow Method
Description
Selects the specified row in the APO 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 APO grid 'and then click the "Send" toolbar button. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ClearSelection SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectRow 3 SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiToolbar("ToolBarControl").PressButton "MSDP_MAIL"
SelectRowsRange Method
Description
Selects the specified range of rows in the APO grid.
Syntax
object.SelectRowsRange (StartRow, EndRow)
Arguments
Parameter | Description |
---|---|
StartRow |
Required. A long integer value. The number of the first row to select. Row numbers begin with 1. |
EndRow |
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 an APO grid. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").ClearSelection SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SelectRowsRange 8, 12 SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiButton("Stat.").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 an APO grid 'and then presses the ENTER keyboard key. SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SetCellData 1, "M 03.2005", "10" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SetCellData 1, "M 04.2005", "100" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").SetCellData 1, "M 05.2005", "5" SAPGuiSession("Session").SAPGuiWindow("Planning Book: [Live]").SAPGuiAPOGrid("IgridCtrl").PressEnter
See also: