SapGuiSetActiveConnection Function

Action

This function sets the active SapGui connection. All subsequent SapGui calls will use this connection.

Include file

SapGui.bdh

Syntax

SapGuiSetActiveConnection( in sConnId : string ) : boolean;
Parameter Description
sConnId The id uniquely identifying the connection.

Return value

  • true if successful
  • false otherwise

Example

transaction TMain
  var
    sId : string;
  begin
    // Connecting to SAP
    sId := SapGuiOpenConnection(" /SAP_CODEPAGE=1100 /FULLMENU 10.5.2.198 0 /3");
    SapGuiSetActiveConnection(sId);
    SapGuiSetActiveSession("ses[0]");

    // SAP
    SapGuiSetActiveWindow("wnd[0]", "SAP", SAPGUI_MATCH_Exact);
    SapGuiWindowResize(117, 28, false);

    // Logon to SAP System
    // Before running a test you have to customize the password parameter!
    ThinkTime(5.3);
    SapGuiLogon("bcuser", "*******", "000", "");
  end TMain;