sapgui_grid_open_context_menu

Grid Functions

Right clicks in a grid to open a context menu.

int sapgui_grid_open_context_menu( const char *description, const char *gridID, [args,] LAST );
description User entered text to aid in understanding script
gridIDObject ID Strings
argsOptional Arguments
LAST A marker indicating the end of the argument list. Not required if Optional Arguments are used.

sapgui_grid_open_context_menu emulates a user right clicking in a grid to open a context menu.

When recording, sapgui_grid_open_context_menu is recorded before sapgui_grid_select_context_menu.

Return Values

This function returns True (-1) or False (0).

Parameterization

You can parameterize all string (char type) arguments.

Example

The following example shows how sapgui_open_context_menu is recorded.

    // Load the sample
    sapgui_set_ok_code("/nme51n", LAST );
    sapgui_send_vkey(ENTER, LAST );
    // Save the Grid ID to make code more readable
    lr_save_string( "usr/subSUB0:SAPLMEGUI:0016/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:3212/cntlGRIDCONTROL/shellcont/shell",
        "GridID");
    /* If the grid we want to work with isn't visible
        click the button to display it.    */ 
    if (!sapgui_is_object_available("{GridID}", LAST ))
        sapgui_press_button("Expand", "usr/subSUB0:SAPLMEGUI:0016/subSUB2:SAPLMEVIEWS:1100/subSUB1:SAPLMEVIEWS:4001/btnDYN_4000-BUTTON", LAST );
    sapgui_grid_select_cell("Select Cell", 
        "{GridID}", "0", "MATNR", LAST );
    // Put in some data 
    sapgui_grid_set_cell_data("(0, Material)", 
        "{GridID}", 
        "0", 
        "MATNR", 
        "0", 
        BEGIN_OPTIONAL, 
            "AdditionalInfo=sapgui1015", 
        END_OPTIONAL);
/* When ENTER is pressed, a detail tab control pops up and
     the grid ID changes. */
    sapgui_grid_press_ENTER("ENTER", "{GridID}", "BEGIN_OPTIONAL", "AdditionalInfo=sapgui1017", "END_OPTIONAL");
    // Save the new ID
    lr_save_string( "usr/subSUB0:SAPLMEGUI:0015/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:3212/cntlGRIDCONTROL/shellcont/shell",
        "GridID_Details");
    sapgui_grid_select_cell_column("'Item of requisition'", 
        "{GridID_Details}", 
        "BNFPO", 
        BEGIN_OPTIONAL, 
            "AdditionalInfo=sapgui1018", 
        END_OPTIONAL);
    sapgui_grid_open_context_menu("(CtrlGrid)", 
        "{GridID_Details}", 
        BEGIN_OPTIONAL, 
            "AdditionalInfo=sapgui1019", 
        END_OPTIONAL);
    /* Choose "Duplicate" from the context menu
        to create a new row with the same data */
    sapgui_grid_select_context_menu("(CtrlGrid)", 
        "{GridID_Details}", 
        "&MEREQDUPLICATE", 
        BEGIN_OPTIONAL, 
            "AdditionalInfo=sapgui1020", 
        END_OPTIONAL);