Methods on SAP controls can be invoked using SapGuiInvokeMethod. The basic information about methods that are offered by controls can be viewed in the COM type library. OLEView32 is a tool that comes with Microsoft Visual Studio that can be used for this purpose.
SapGuiInvokeMethod("BUTTONCTRLID", "pressButton");
When a method call returns another SAPGUI object or SAPGUI collection, the returned object is stored internally and can be accessed with the constant value SAPGUI_ACTIVEOBJECT for any SAPGUI API call for the control ID parameter.