Purpose
Use the built-in functions of the native control interface for the toolbar control

For most tasks it is not advisable to program your own VB functions that communicate with the special SAP UI controls such as grid control or tree control. The SAP UI controls are more complex than one might think, since they handle user actions, read and write the SAP GUI datastream and communicate with SAP application. So your VB function is player number three or four in this system.

The following functions, built in into the GuiXT Controls interface "guinet.dll", cover most of what is normally needed. Please observe:

  • All functions have obligatory and optional parameters. We suggest you use the "by name" calling for all optional parameters.
  • All functions can either be called from your GuiXT script, in most cases with CallVBAsync, or from your own VB.NET function. If you need to evaluate the return code of the built-functions it is often more practical to call up your own VB.NET function with CallVBAsync and then call the built-in function from there.

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

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"

 

Components
InputAssistant + Controls