SapGuiLogon Function

Action

Logs on a user to the SAP system using the provided credentials.

Include file

SapGui.bdh

Syntax

SapGuiLogon( in sUsername  : string,
             in sPassword  : string,
             in sClientNum : string,
             in sLanguage  : string,
             in sTimer     : string ) : boolean;
Parameter Description
sUserName The user to be logged using the SapGuiLogon function.
sPassword The user's password.
sClientNum SAP specific client number.
sLanguage SAP specific language code.
sTimer Timer name used for measurements.

Return value

  • true if successful
  • false otherwise

Example

transaction TMain
  var
    sId : string;
  begin
    // Connecting to SAP
    sId := SapGuiOpenConnection(" /SAP_CODEPAGE=1100 /FULLMENU lab77 00 /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", "fantastic", "000", "");
  end TMain;