Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Monday, 4 February 2019

SAPGuiSession Objects

Close Method: 
Closes the SAP GUI for Windows session without displaying a warning message.

'The following example uses the Close method to close an SAP GUI for Windows session without displaying a warning message.

SAPGuiSession("Session").Close

CreateSession Method:

Creates a new SAP GUI for Windows session for the current connection.

'The following example uses the CreateSession method to create a new SAP GUI for Windows session and then resizes the new window. Note that by creating a new session, a new session object (Session_2) is saved in the object prepository.

SAPGuiSession("Session").CreateSession
SAPGuiSession("Session_2").SAPGuiWindow("SAP Easy Access").Resize 106, 24

Reset Method:

Navigates to the session initial screen or to the specified transaction

'The following example uses the Reset method to reset the SAP GUI for Windows session to the initial session 'window. Then it resets the SAP GUI for Windows session to the VA01 transaction

SAPGuiSession("Session").Reset
SAPGuiSession("Session").Reset "/nVA01"

Sync Method : 

Instructs UFT to wait until the SAP GUI for Windows session is available.

'The following example uses the 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. (It does this after first having performed several operations on another SAP GUI for Windows session.)

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").Sync

SAPGuiSession("Session_2").SAPGuiWindow("Create Document").SAPGuiEdit("Title").Set "A new message on a different" 

SAPGuiSession("Session_2").SAPGuiWindow("Create Document").SAPGuiButton("Send... (Shift+F8)").Click