SapGuiGridContextMenu Function

Action

Opens a context menu for the currently selected cell.

Include file

SapGui.bdh

Syntax

SapGuiGridContextMenu( in sControlId : string allownull,
                       in sTimer     : string optional ) : boolean;
Parameter Description
sControlId The cell's unique id.
sTimer Timer name for measurements.

Return value

  • true if the function succeeds
  • 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(2.8);
    SapGuiLogon("ddic", "minisap", "000", "");

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

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

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

    // NodeName: Appointment Calendar
    // NodePath: 2\1\3
    SapGuiTreeExpandNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell",
    "Appointment Calendar", "0000000008", "Expand\\Appointment Calendar");

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

    // NodeName: Favorites
    // NodePath: 1
    SapGuiSelectTopNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell",
    "Favorites", "Favo", "TopNode\\Favorites");

    // NodeName: Owner
    // NodePath: 2\1\3\1
    SapGuiTreeDblClickNode("usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell",
    "Owner", "0000000009", "DblClNode\\Owner");
            
    // Grid Control Info: /app/con[0]/ses[0]/wnd[0]/usr/cntlCALE_CONTROL/shellcont/shell/shellcont[1]/shell/8 columns
            
    // -------------------------------------
            
    // 1: 1:Time
            
    // 2: 2:Monday
            
    // 3: 3:Tuesday
            
    // 4: 4:Wednesday
            
    // 5: 5:Thursday
            
    // 6: 6:Friday
            
    // 7: 7:Saturday
            
    // 8: 8:Sunday

            
    // Termine anzeigen: DDIC
    ThinkTime(9.3);
    SapGuiSetActiveWindow("wnd[0]", "Termine anzeigen: DDIC", SAPGUI_MATCH_Exact);
    ThinkTime(7.4);
    SapGuiCalendarFirstVisibleDate("usr/cntlCALE_CONTROL/shellcont/shell/shellcont[0]/shell", "20040802");
    SapGuiGridScrollToRow("usr/cntlCALE_CONTROL/shellcont/shell/shellcont[1]/shell",12);
    SapGuiGridDblClickCurrentCell("usr/cntlCALE_CONTROL/shellcont/shell/shellcont[1]/shell");

    // Terminkalender: Create Appointment
    ThinkTime(10.1);
    SapGuiSetActiveWindow("wnd[1]", "Terminkalender: Create Appointment",SAPGUI_MATCH_Exact);
    SapGuiPressButton("tbar[0]/btn[12]");

    // Termine anzeigen: DDIC
    ThinkTime(2.3);
    SapGuiSetActiveWindow("wnd[0]", "Termine anzeigen: DDIC", SAPGUI_MATCH_Exact);
    SapGuiGridSelectCell("usr/cntlCALE_CONTROL/shellcont/shell/shellcont[1]/shell", 13, " 2");
    SapGuiIgnoreError(SAPENGINE_STATUSBAR_CHANGED, SEVERITY_SUCCESS);
    SapGuiGridContextMenu("usr/cntlCALE_CONTROL/shellcont/shell/shellcont[1]/shell");
    ThinkTime(2.1);
  end TMain;