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
	// 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))
            LAST );
// It is now certain that the grid is available.