SapGuiContextMenuSelectItem Function

Action

Selects an item of a context menu using the unique identifier of the item.

Include file

SapGui.bdh

Syntax

SapGuiContextMenuSelectItem( in sControl : stringallownull,
                             in sItem    : string,
                             in sTimer   : string optional ) : boolean;
Parameter Description
sControlId The context menu's unique id.
sItem The menu item to be selected from the context menu.
sTimer Timer name for measurements.

Return value

  • true if successful
  • false otherwise

Example

transaction TMain
  var
    sConnID : string;
  begin
    // Connecting to SAP
    sConnID := SapGuiOpenConnection(" /SAP_CODEPAGE=1100 /FULLMENU 10.5.2.198 0 /3");
    SapGuiSetActiveConnection(sConnID);
    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!
    SapGuiIgnoreError(SAPENGINE_STATUSBAR_CHANGED, SEVERITY_SUCCESS);
    ThinkTime(3.3);
    SapGuiLogon("ddic", "*******", "000", "");

    // Copyright
    SapGuiSetActiveWindow("wnd[1]", "Copyright", SAPGUI_MATCH_Exact);
    SapGuiPressButton("tbar[0]/btn[0]");

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

    // 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");
    SapGuiContextMenuSelectItem("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell", "XXEXPD");
  end TMain;