Share this page

# Example: sapgui_is_object_available

The following example uses sapgui_is_object_available to see if a grid is visible. If not, it clicks the expand button that displays it. After ensuring that the grid is visible the script can work with it.

    sapgui_set_ok_code("/nme51n", LAST );

    sapgui_send_vkey(ENTER, LAST );

    // Store Grid ID in "ContainerObjectID" to make code more readable

    lr_save_string("usr/subSUB0:SAPLMEGUI:0016/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:3212/cntlGRIDCONTROL/shellcont/shell",
        "ContainerObjectID");
    	// Store expand button ID in "ButtonID"
    	lr_save_string( "usr/subSUB0:SAPLMEGUI:0016/subSUB2:SAPLMEVIEWS:1100/subSUB1:SAPLMEVIEWS:4001/btnDYN_4000-BUTTON", "ButtonID");

    // If the grid is not available, click the expand button

    if ( !sapgui_is_object_available("{ContainerObjectID}", LAST))
            sapgui_call_method("{ButtonID}",
                "press",
                LAST );

    // It is now certain that the grid is available.

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