SapGuiSetActiveSession Function

Action

Sets the active session to be used be the virtual user. Any subsequent calls will be made using the active session.

Include file

SapGui.bdh

Syntax

SapGuiSetActiveSession( in sSessionId : string ) : boolean;
Parameter Description
sSessionId Id uniquely identifying the session to be set as the active one.

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;