Configure UFT to Open a SAP Gui for Windows Application
Source code
'************************************************************************************************************************
'Description:
'
'This example starts UFT, opens a new test, and configures it for recording and running
'on an SAP Gui for Windows application.
'
'Assumptions:
'UFT is not open.
'************************************************************************************************************************

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object

qtApp.SetActiveAddins Array("SAP") ' Load the SAP Add-in.
qtApp.Launch ' Start UFT
qtApp.New ' Open a new test

' Configure the SAP Record and Run settings to open an SAP Gui for Windows application with these settings:
qtApp.Test.Settings.Launchers("SAP").Active = True 'Open a new SAP Gui for Windows session when recording begins
qtApp.Test.Settings.Launchers("SAP").Server = "R/3 Enterprise" 'Launch SAP Gui for Windows and connect to the "R/3 Enterprise" Server
qtApp.Test.Settings.Launchers("SAP").AutoLogon = True 'Perform auto login using the logon details below
qtApp.Test.Settings.Launchers("SAP").Client = "800" 'Number for SAP client
qtApp.Test.Settings.Launchers("SAP").User = "QA01" 'User name for SAP server
qtApp.Test.Settings.Launchers("SAP").Password = "3f5aea819b0239" 'Password should be set as an encrypted string
qtApp.Test.Settings.Launchers("SAP").Language = "EN" 'Use English for UI language
qtApp.Test.Settings.Launchers("SAP").RememberPassword = True 'Save the logon password for use in future test runs
qtApp.Test.Settings.Launchers("SAP").CloseOnExit = True 'Close this SAP Gui for Windows session when exiting this test
qtApp.Test.Settings.Launchers("SAP").IgnoreExistingSessions = True 'Do not record or run tests on any SAP sessions that are already open prior to the start of the record or run session

qtApp.Visible = True ' Make the UFT application visible
Set qtApp = Nothing ' Release the Application object