ToolbarControl.ClickButton
Clicks a button in the toolbar
CallVBAsync
guinet.ToolbarControl.ClickButton
Parameters
1
butName Internal name of the
button or button text
2 toolBarNo Default:
-1
Number of the toolbar on screen. The value -1 means: the button is
searched by its name in all toolbars on the screen
Returns "X" if the button was found, ""
otherwise
Example:
CallVBAsync
guinet.ToolbarControl.ClickButton
"%ATTA_DISPLAY"
The button names are shown in the GuiXT Script Editor Pro:

Alternatively, you can record the button click with GuiXT
Input Recording and then copy the string specified as
item=

Or you use SAP GUI Scripting Recording: the button name is specified
in the function pressToolbarButton:
session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").pressToolbarButton
"%ATTA_DISPLAY"
ToolbarControl.SelectMenuitem
Selects a menu item of a "menu type" button
CallVBAsync
guinet.ToolbarControl.SelectMenuitem
Parameters
1
itemname
Internal name of the menu button, followed by a dot and the internal name of the menu item, or number for the grid control toolbar (see section below)
2 toolBarNo Default:
-1
Number of the toolbar on screen. The value -1 means: the menu button
is searched by its name in all toolbars on the screen
Returns "X" if the button was found, ""
otherwise
Example:
CallVBAsync
guinet.ToolbarControl.SelectMenuitem
"%GOS_TOOLBOX.%GOS_VIEW_ATTA"
The button names are shown in the GuiXT Script Editor Pro. Menu type
buttons are either denoted as "Menu" or "ButtonAndMenu" :

The item names are currently not shown in the Script Editor Pro.
You can use GuiXT Input Recording to get the menu button and item names:

Or you use SAP GUI Scripting Recording:
session.findById("wnd[0]/titl/shellcont/shell").pressContextButton
"%GOS_TOOLBOX"
session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem
"%GOS_VIEW_ATTA"
Grid control toolbar For the grid control toolbar you need to use the number of the menu item instead of its id.
Example: In transaction SE16N we add a button to download the grid control content as a tab separated text file:

We need to select the third menu item: 
The menu id is "&MB_EXPORT":

InputScript
// Transaction SE16N
// download table content to local file (tab separated text file)
Screen SAPLSE16N.0200
CallVBAsync guinet.toolbarcontrol.SelectMenuItem "&MB_EXPORT.3"
Enter
// Save list in file...
Screen SAPLSPO5.0110
Set R[Text with Tabs] "X"
Enter
|