Close Method : - Close method to close an SAP GUI for Windows session without displaying a warning message.
Example: -
SAPGuiSession("Session").Close
CreateSession Method: - Creates a new SAP GUI for Windows session for the current connection.
Example:SAPGuiSession("Session").CreateSession SAPGuiSession("Session_2").SAPGuiWindow("SAP Easy Access").Resize 136, 23Note: CreateSession method to create a new SAP GUI for Windows session and then resizes the new windowReset Method: - Navigates to the sessions initial screen or to the specified transaction.
Example:
SAPGuiSession("Session").Reset SAPGuiSession("Session").Reset "/nVA01"Sync Method: - Sync method Instructs UFT to wait until the SAP GUI for Windows session is available.Example:
SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set"sbwp" SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER SAPGuiSession("Session").SAPGuiWindow("Business Workplace").SAPGuiButton("New message").Click SAPGuiSession("Session_2").SyncNote: Sync method to ensure that a second SAP GUI for Windows session (opened by pressing 'the "New message" button) is loaded before performing operations on it.GetItem Method:- Returns the value of the item specified by the index.Example-SAPGuiSession("Session").SAPGuiWindow("Create Material").SAPGuiComboBox("Industry sector")._Select "Food and Related Products" SAPGuiSession("Session").SAPGuiWindow("Create Material").SAPGuiComboBox("Industry sector").SetFocus relatedItem = SAPGuiSession("Session").SAPGuiWindow("Create Material").SAPGuiComboBox("Material type").GetItem(10) If relatedItem = "Finished product" Then MsgBox "The Material type comboBox has the correct value in it" End IfNote: - GetItem method to check that when the "Food and Related Products" option is selected in the "Industry sector" combo box, that the tenth item ("Finished product") is displayed in the "Material type" combo box.
Select Method: - Selects an item from the combo box list.
Example:
SAPGuiSession("Session").SAPGuiWindow("Create Material").SAPGuiComboBox("Industry sector")._Select "Food and Related Products" SAPGuiSession("Session").SAPGuiWindow("Create Material").SAPGuiComboBox("Material type").Select "#4" SAPGuiSession("Session").SAPGuiWindow("Create Material").SAPGuiComboBox("Material type").SetFocus SAPGuiSession("Session").SAPGuiWindow("Create Material").SAPGuiButton("Select view(s)").ClickNote: Select method to select the "Food and Related Products" option from the "Industry sector"combo box and the fourth option from the "Material type" combo box. Then it clicks the"Select view(s)" button.SelectKey Method: - Selects the SAP (shortcut) key representing an item in the combo box list.Example:
SAPGuiSession("Session").SAPGuiWindow("EnjoySAP Demo").SAPGuiTree("TableTreeControl")._ActivateItem "Workbench Demos;USER INTERFACE;Examples of User Interface Design", "REPTITLE" SAPGuiSession("Session").SAPGuiWindow("User Interface").SAPGuiMenuBar("mbar").Select "Elements;Dropdown list box" SAPGuiSession("Session").SAPGuiWindow("User Interface").SAPGuiComboBox("Country").SelectKey "AG" SAPGuiSession("Session").SAPGuiWindow("User Interface").SAPGuiComboBox("Language").SetFocus SAPGuiSession("Session").SAPGuiWindow("User Interface").SAPGuiButton("Next screen").ClickNote:-SelectKey method to select the "AG" key from the "Country" box.SetFocus Method: - Sets the focus on a combo box object in an SAP GUI for Windows application.Example:SAPGuiSession("Session").SAPGuiWindow("CPurchase").SAPGuiTextArea("TAControl").Set"This is an editor"SAPGuiSession("Session").SAPGuiWindow("CPurchase").SAPGuiComboBox("MTEXT-EDITOR").SetFocus SAPGuiSession("Session").SAPGuiWindow("CPurchase").SAPGuiComboBox("MTEXT-EDITOR").Select"Line editor"Note: SetFocus method to ensure that the "MEPOTEXT-EDITOR" combo box is in focus before the "Select" operation is performed.DoubleClick Method: -Double-clicks inside a text area at the cursor position.Example:
SAPGuiSession("Session").SAPGuiWindow("ABAPEditor:").SAPGuiTextArea("TAControl").SetSelectionIndexes 710, 710 SAPGuiSession("Session").SAPGuiWindow("ABAPEditor:").SAPGuiTextArea("TAreaControl").DoubleClickNote: DoubleClick method to double-click the cursor inside a text area at the position (710,710).
SetSelectionIndexes Method: - Selects the specified section of text in the text area and positions the cursor. Syntax : object.SetSelectionIndexes (Start, End) Note: The text is selected from the specified start character and up to, but not including, the end character.
SAPGuiSession("Session").SAPGuiWindow("EnjoySAP Demo").SAPGuiTextArea("TAControl").Set ""+vbCr+"HELLO"+vbCr+"" SAPGuiSession("Session").SAPGuiWindow("EnjoySAP Demo").SAPGuiTextArea("TextAreaControl").SetSelectionIndexes 1,4Note: SetSelectionIndexes method to highlight the three letters ELL (positions 1, 2 and 3) in the string HELLO and position the cursor on the character at position 4 (The letter "O"), which is not highlighted.SAPGuiSession("Session").SAPGuiWindow("EnjoySAP Demo").SAPGuiTextArea("TextAreaControl").Set ""+vbCr+"HELLO"+vbCr+"" SAPGuiSession("Session").SAPGuiWindow("EnjoySAP Demo").SAPGuiTextArea("TextAreaControl").SetSelectionIndexes 5, 5Note: SetSelectionIndexes method to position the cursor immediately after the string HELLO in the text area (on character 5).SetUnprotectedTextPart Method: - Sets the specified text in the predefined unprotected sections of the text area. Syntax: object.SetUnprotectedTextPart (Part, Text)
SAPGuiSession("Session").SAPGuiWindow("Mer").SAPGuiTextArea("TA").SetUnprotectedTextPart 1,"Purchase Order"+vbCr+"" SAPGuiSession("Session").SAPGuiWindow("Mer").SAPGuiTextArea("TA").SetUnprotectedTextPart 2,"Order Number 5678"+vbCr+"" SAPGuiSession("Session").SAPGuiWindow("Mer").SAPGuiTextArea("TA").SetUnprotectedTextPart 3,"Authorized"+vbCr+ ""Note: SetUnprotectedTextPart method to type the text Purchase Order, Order Number 5678 and Authorized in the unprotected sections of the "TextAreaControl" text area. The three text strings are entered into sections 1, 2, and 3 respectively, starting from the top of the text area.