SapGuiWindowAction Function

Action

Performs certain actions on the active window. The window can be closed, minimized, restored or maximized.

Include file

SapGui.bdh

Syntax

SapGuiWindowAction( in nAction : number, 
                        sTimer : in string optional) : boolean;
Parameter Description
nAction

The action to be performed on the active window. Available options are:

  • SAPGUI_WND_CLOSE. Closes the active window.
  • SAPGUI_WND_MAXIMIZE. Maximized the active window.
  • SAPGUI_WND_RESTORE. Restores the active window.
  • SAPGUI_WND_ICONIFY. Minimizes the active window.
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);
    SapGuiWindowAction(SAPGUI_WND_MAXIMIZE);

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

    // Copyright
    SapGuiSetActiveWindow("wnd[1]", "Copyright", SAPGUI_MATCH_Exact);

    // Continue (Enter)
    SapGuiPressButton("tbar[0]/btn[0]", "Continue (Enter)");

    // SAP Easy Access
    SapGuiSetActiveWindow("wnd[0]", "SAP Easy Access", SAPGUI_MATCH_Exact);

    // Other menu
    SapGuiPressButton("tbar[1]/btn[17]", " Other menu");

    // Restrict Values
    SapGuiSetActiveWindow("wnd[1]", "Restrict Values", SAPGUI_MATCH_Exact);

    // Cancel (F12)
    SapGuiPressButton("tbar[0]/btn[12]", "Cancel (F12)");

    // SAP Easy Access
    SapGuiSetActiveWindow("wnd[0]", "SAP Easy Access", SAPGUI_MATCH_Exact);

    // Log off (Shift+F3)
    SapGuiPressButton("tbar[0]/btn[15]", "Log off (Shift+F3)");

    // Log Off
    SapGuiSetActiveWindow("wnd[1]", "Log Off", SAPGUI_MATCH_Exact);

    // Yes
    SapGuiPressButton("usr/btnSPOP-OPTION1", "Yes");
  end TMain;