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.

Tuesday, 26 June 2018

Launching SAP Using UFT/QTP


Here is an utility object from QTP for SAP . It is “SAPGuiUtil”. SAPGuiUtil supports multiple methods. Below is the list of them with small description.

Autologon ::: Connects and logs on to an SAP Server
AutoLogonByIP ::: Connects and logs on to SAP server according to its IP address.
CloseConnections ::: Closes any SAP connections that were opened by QTP or by user.
 OpenConnection  ::: Opens a connection to the specified SAP server.
OpenConnectionByIP :::  Opens a connection to the specified SAP server according to its IP.

Let’s have a look at each one of them.

1. Autologon :  The AutoLogon method opens a new connection even if an open session already exists.

Syntax :

SAPGuiUtil.Autologon <ServerDescription>,<Client>,<User>,<Password>,<Language>

'The following example uses the AutoLogon method to connect to client "100" of the "ERPNext" SAP server, using the logon information for the MAster user. The Password argument is parameterized to take the encrypted value from the Data Table.

SAPGuiUtil.AutoLogon "ERPNext", 100, "MAster", DataTable("Password",dtLocalSheet),”EN”
2. AutoLogonByIP : Connects and logs on to an SAP server according to its IP address.

“SAPGuiUtil.AutoLogonByIP <ConnectionString>, <Client>, <User>, <Password>, <Language>, [SystemNumber], [RoutingServers]”

Below is the example

'The following example uses the AutoLogonByIP method to log on to the "ERPNext" SAP server
'using its IP address instead of its name.'The Password argument is parameterized to take the encrypted value from the Data Table.

SAPGuiUtil.AutoLogonByIP "/H/212.199.95.5/S/3200", "100", "QA01", DataTable("Password", dtGlobalSheet), "en", "00"

3. CloseConnections  : Closes any SAP connections that were opened by QuickTest or by the user.
                Syntax: SAPGuiUtil.CloseConnections

4. OpenConnection   : Opens a connection to the specified SAP server.

SAPGuiUtil.OpenConnection ServerDescription

Below is an example.

Sapguiutil.OpenConnection “A:Test Server”
SAPGuiSession("Session").SAPGuiWindow("SAP").SAPGuiEdit("User").Set strUserID
SAPGuiSession("Session").SAPGuiWindow("SAP").SAPGuiEdit("Password").SetSecure strPassword
SAPGuiSession("Session").SAPGuiWindow("SAP").SAPGuiButton("Enter").Click

5. OpenConnectionByIP : Opens a connection to the specified SAP server according to its IP address.

Syntax: object.OpenConnectionByIP ConnectionString, [SystemNumber], [RoutingServers]

Below is the example.

SAPGuiUtil.OpenConnectionByIP "10.168.11.57", 0

No comments:

Post a Comment

Note: only a member of this blog may post a comment.