Example: sapgui_grid_clear_selection

The following example uses sapgui_grid_clear_selection to unselect rows so that different rows can be selected.

// Save the Grid ID in variable "GridID" to make the code more readable
lr_save_string
    ("usr/cntlBCALVC_TOOLBAR_D100_C1/shellcont/shell",
    "GridID");
// Select first row
sapgui_grid_select_rows("One row", 
        "{GridID}", 
        "0", 
        BEGIN_OPTIONAL, 
            "AdditionalInfo=sapgui1023", 
        END_OPTIONAL);
sapgui_grid_clear_selection("", "{GridID}", LAST );
// Select three rows listed explicitly
sapgui_grid_select_rows("Three rows listed", 
        "{GridID}", 
        "1,3,5", LAST );
sapgui_grid_clear_selection("", "{GridID}", LAST );
// Select rows with combination of list and range syntax
sapgui_grid_select_rows("Six rows, listed and range", 
        "{GridID}", 
        "1,2,6-9", LAST );