SapGuiVerifyWindowAvailability Function


Verifies whether a SapGui window exists and can be accessed during a test run.

Include file



SapGuiVerifyWindowAvailability( in sControlId    : string, 
                                in sWindowTitle  : string optional, 
                                in bAbsolutePath : boolean optional,
                                in nSeverity     : number optional := SEVERITY_ERROR ) : boolean;
Parameter Description
sControlId The unique id of the SapGui window.
sWindowTitle Matches the title of the window if the window as specified in the first parameter could be found. Set this parameter to NULL to have the function not perform a title verification.
bAbsolutePath If set to true, the id of the control has to be specified using the absolute path. This includes the connection, session, window and control id. Otherwise the verification will be performed looking up the control in the active session.
nSeverity Optional: Severity of the error that is raised if the verification fails. Can be one of the following values:
  • SEVERITY_SUCCESS: Success; no error (numerical value: 0)
  • SEVERITY_INFORMATIONAL: Informational; no error (numerical value: 1)
  • SEVERITY_WARNING: Warning; no error (numerical value: 2)
  • SEVERITY_ERROR: (Default) Error; simulation continues (numerical value: 3)
  • SEVERITY_TRANS_EXIT: Error; the active transaction is aborted (numerical value: 4)
  • SEVERITY_PROCESS_EXIT: Error; the simulation is aborted (numerical value: 5)

Return value

  • true if successful
  • false otherwise


transaction TMain
    sConnID : string;
    // Connecting to SAP
    sConnID := SapGuiOpenConnection( " /SAP_CODEPAGE=1100 /FULLMENU 0 /3");

    // SAP
    SapGuiSetActiveWindow("wnd[0]", "SAP", SAPGUI_MATCH_ExactNoCase);

    // Logon to SAP System
    // Before running a test you have to customize the password parameter!
    SapGuiLogon("ddic", "minisap", "000", "");
    SapGuiVerifyWindowAvailability("wnd[0]", false, SEVERITY_ERROR);
  end TMain;