SapGuiContextMenuSelectItemByText Function

Action

Selects an item of a context menu using the text of the item.

Include file

SapGui.bdh

Syntax

SapGuiContextMenuSelectItemByText( sControl : in string allownull,
                                   sText    : in string,
                                   sTimer   : in string optional) : boolean;
Parameter Description
sControl The context menu's unique ID
sText The text of the item to be selected
sTimer Timer name for measurements

Return value

  • true if successful
  • false otherwise

Example

transaction TMain
  var
  begin
    // Connecting to SAP
    gsConnID := SapGuiOpenConnection("   /SAP_CODEPAGE=1100  /FULLMENU  atlid-test1 00 /3 /UPDOWNLOAD_CP=2",
    "SapGuiOpenConnection");
    SapGuiSetActiveConnection(gsConnID);
    SapGuiSetActiveSession("ses[0]");

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

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

    // SAP Easy Access
    SapGuiIgnoreError(SAPENGINE_STATUSBAR_CHANGED, SEVERITY_SUCCESS);
    ThinkTime(2.1);
    SapGuiSetActiveWindow("wnd[0]", "SAP Easy Access", SAPGUI_MATCH_ExactNoCase);

    // NodeName: Office
    // NodePath: 2\1
    SapGuiTreeSelectNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "Office", "0000000003", false,
    "SelNode\\Office");

    // NodeName: Office
    // NodePath: 2\1
    SapGuiTreeNodeContextMenu("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "Office", "0000000003",
    "NodeCtxt\\Office");

    ThinkTime(9.9);
    SapGuiContextMenuSelectItemByText("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "Open folder");

    // Log off
    ThinkTime(7.9);
    SapGuiSelectMenu("mbar/menu[4]/menu[12]", "SapGuiSelectMenu\\Log off");

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

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