Share this page

# sapgui_grid_select_toolbar_menu

Grid Functions

Selects an option from a grid toolbar menu.

    int sapgui_grid_select_toolbar_menu( const char *description, const char *gridID, const char *functionCode, [args,] LAST );

description | User entered text to aid in understanding script
gridID | Object ID Strings
functionCode | Object ID Strings for the selected menu option
args | Optional Arguments
LAST | A marker indicating the end of the argument list. Not required if Optional Arguments are used.

sapgui_grid_select_toolbar_menu emulates a user selecting an option from a grid toolbar menu.

## Return Values

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure.

## Parameterization

You can parameterize all string (char type) arguments.

## Example

The following example uses sapgui_grid_select_toolbar_menu to delete a row from a grid.

    // 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 );

    // Enter some data

        sapgui_grid_set_cell_data("(0, Material)", "{GridID}", "0", "MATNR", "1", LAST );

    /* 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");

        // Select the row to delete

         sapgui_grid_select_rows("0", "{GridID}", "0", LAST );

        // Delete using grid toolbar context menu

        sapgui_grid_select_toolbar_menu("(CtrlGrid)", "usr/subSUB0:SAPLMEGUI:0015/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:3212/cntlGRIDCONTROL/shellcont/shell",
            "&MEREQDELETE",
            BEGIN_OPTIONAL,
                "AdditionalInfo=sapgui1067",
            END_OPTIONAL);

        // Confirm deletion

        sapgui_select_active_window("wnd[1]");

        sapgui_press_button("Yes", "usr/btnSPOP-OPTION1", LAST );

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: