Vous êtes sur la page 1sur 86

 

SAP

Tosca Engine
Table of Contents

Table of Contents

1 Survey 4
1.1 Tosca SAP Engine manual 4
1.2 Legal notice 4

2 Installing the Engine 5


2.1 Preparations 5
2.2 Files and directories 12

3 Creating Modules 18
3.1 Control types 20
3.2 Screen layout 29

4 Steering controls 32
4.1 Steering tables 35
4.1.1 Table types 46
4.2 Button 52
4.3 Calendar Control 53
4.4 ComboBox 54
4.5 Delay 55
4.6 ListTree 55
4.7 Login/Logout 56
4.8 Logon 57
4.9 SAP Menu 58
4.10 Multilic 59
4.11 OptSubToolbarButton 61
4.12 Popup 61
4.13 RadioButton 62
4.14 Refresh 63
4.15 Send Keys 64
4.16 SpecialToolbar 64
4.17 Statusbar 66
4.18 SubToolbar 68
4.19 TabControl 69
4.20 TableTree 69
4.21 Toolbar 78
4.22 TreeView 78
4.23 WaitStatusChange 81

5 Multi-Session Operations 83
6 Recovery 84
7 Extension of the existing Engine 86

Version 8.3.0 3
1 Survey

1 Survey
SAP Engine manual, version: 03.11.2014

1.1 Tosca SAP Engine manual


The Tosca SAP Engine manual is used as a reference for the execution of
software tests in projects with test automation of the SAP engine and provides a
detailed technical description of the use of special controls for the Tosca SAP
Engine.

1.2 Legal notice


Tricentis GmbH
Leonard-Bernstein-Straße 10
1220 Vienna
Austria
 
Tel.: +43 (1) 263 24 09
Fax: +43 (1) 263 24 09-15
E-Mail: support@tricentis.com
 
Information in this document is subject to change without notice. No part of this document may be
reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose without
the express written permission of Tricentis GmbH.

This product contains 3rd party software. You can find a full list, the licenses and the source code where
applicable in the directory %TRICENTIS_HOME%\src\3rdParty.

© by Tricentis GmbH

Version 8.3.0 4
2 Installing the Engine

2 Installing the Engine


The Tosca SAP Engine is installed by default as part of a complete Tricentis Tosca
Testsuite installation.
All information regarding software versions and hardware requirements for this
engine can be found in the System Requirements under %TRICENTIS_
HOME%\Docs\Installation\TOSCA_System_requirements_en.pdf.

2.1 Preparations

Activate scripting (server)

The parameter sapgui/user_scripting must be set to TRUE to be able to use the


scripting function (Please note that this value is case-sensitive). The default value
of the parameter is FALSE.

Tricentis recommends enabling scripting only in D and Q systems in


order to prevent the unintentional execution of automated tests in P
systems.

If one of the following parameters is available, it must have the value FALSE. The
available parameters depend on the SAP version used.
 n sapgui/user_scripting_disable_recording
 n sapgui/user_scripting_force_notification
 n sapgui/user_scripting_per_user
 n sapgui/user_scripting_set_readonly

Procedure

This procedure applies to all above mentioned parameters.


If parameters can be set dynamically, this is conducted via the transaction RZ11:
 1. Enter the parameter name sapgui/user_scripting and click on the Display
button.

Version 8.3.0 5
2 Installing the Engine

Illustration 1: Transaction RZ11 Profile parameter maintenance

 2. If the value is currently set to FALSE, select the button Change Value in the
toolbar. A window will be opened in which the new value TRUE can be
entered. When the changes are saved, the window is closed and the current
value of the parameter changes to TRUE.

Illustration 2: Parameter sapgui/user_scripting

Version 8.3.0 6
2 Installing the Engine

Illustration 3: Change Parameter Value

 3. This modification takes effect as soon as the user logs on to the system
again.
 4. If the parameter is not found, the respective support package must be
installed according to the list in chapter "Kernel Patchlevels".
If the current value has not changed after saving the modification, the Kernel
patch is too old. Please install a newer Kernel patch in this case.

Set the parameter in the server profile

If the support package is not installed, scripting can be still enabled. For this
purpose, the parameter in the profile file of the Application Server must be set
using the following line:
sapgui/user_scripting = TRUE
This procedure requires the necessary Kernel patchlevel, but does not require a
re-start of the Application Server.

Kernel Patchlevels

The parameter is supplied with the following Kernel patches:


 n 6.10: 360
 n 4.6D: 948
 n 4.5B: 753
 n 4.0B: 903
 n 3.1I: 650
In the following Kernel versions the parameter can be changed dynamically,
which means that a re-start of the Application Server is not required:

Version 8.3.0 7
2 Installing the Engine

 n 6.20 and later


 n 6.10 as of patch 391
 n 4.6D as of patch 972

Activate scripting (client)

Scripting must be installed on the client. This can either be done during the
installation of the SAP GUI or later.
Under Customizing of Local Layout (Alt + F12)->Options->Tab Scripting you can
check whether client-side scripting is installed or not.
In addition, the following user settings must be disabled: Notify When a Script
Attaches to a Running GUI and Notify When a Script Opens a Connection.

Illustration 4: Tab Scripting

Version 8.3.0 8
2 Installing the Engine

If these settings are enabled, a dialog window will be displayed, asking whether a
script should be allowed to connect to the SAP frontend:

Illustration 5: Scripting alert

Manual settings

The two relevant checkboxes are deselected via Customizing of Local Layout (Alt
+ F12)->Options->Tab >Scripting<-> User Settings.
This setting is disabled by the following registry sequence:
[HKEY_CURRENT_USER\Software\SAP\SAPGUI Front\SAP Frontend
Server\Security]
"UserScripting"=dword:00000001
"WarnOnAttach"=dword:00000000
"WarnOnConnection"=dword:00000000

Testing SAP scripting

You can easily check whether scripting is enabled or not by recording and playing
back a chosen sequence of actions. Open the Record and Playback window
under Customizing of Local Layout (Alt+F12) -> Script Recording and Playback.

Version 8.3.0 9
2 Installing the Engine

Illustration 6: Script Recording and Playback

 1. Start recording with a click on Record Script and enter, for example, test into
a text field of your choice.
 2. Click on Stop Recording to stop recording. After recording the script, delete
the content of the modified text field.
 3. To run the script, click on Playback Script and select the recorded script
(usually stored under the name Script1.vbs). The actions recorded before
should be replayed automatically. If the text field contains the text test again,
the script has been successfully executed.

Illustration 7: Record and Playback window

If the script was executed successfully, the preparations for test automation with
Tosca are finished. No further modifications of the SAP system are required.
After installing Tosca (as described in the installation guide) you can start
automated testing.

User-specific settings in SAP

The menu entry Help->Settings enables user-specific settings to be configured.

Version 8.3.0 10
2 Installing the Engine

In order to scan specific F4 help windows with Tosca Wizard, the option Dialog
(modal) must be selected in the Display section of the F4 Help tab.

Illustration 8: F4 Help

Version 8.3.0 11
2 Installing the Engine

In order to scan F1 help windows, in Modal Dialog Box must be selected under
Display in the F1 Help tab.

Illustration 9: F1 Help

2.2 Files and directories


In order to run the Tosca SAP Engine, the file
 n SAPEngine.ocx
is required in a state that is compatible with the standard installation of the
Tosca Base Engine. The location of this file is irrelevant (.\Tricentis\dll is the
recommended default directory), as long as it is registered correctly with
RegSvr32.exe.
The Tosca SAP Engine usually works only on Windows systems, which SAP can
also run on.
Please ensure that the process name of the SAP Client started has been specified
correctly for the setting SAP Logon Path in the Settings dialog (see Tosca
Commander™ Manual - Settings - Special Engines - Settings SAPEngine).

Version 8.3.0 12
2 Installing the Engine

ObjectMappings.dat

This file is stored under the path %TRICENTIS_HOME%\dll\Dat.


The following entries must exist:

[SAP]
handlerClassName=SAPEngine.clsSAPKwds
recoveryClassName=SAPEngine.clsSAPReco
taRepresentationClassName=SAPEngine.clsSAPWindow
scriptHandlerClassName=SAPEngine.clsSAPScriptHandler
wizardItemClassName=SAPEngine.clsSAPWizardItem

[SAPTab]
paRepresentationClassName=SAPEngine.clsSAPTab
omTranslationName=Tabcontrol

[SAPLLOTabControl]
paRepresentationClassName=SAPEngine.clsWin32TabForSAP
omTranslationName=Tabcontrol

[SAPButton]
paRepresentationClassName=SAPEngine.clsSAPButton
omTranslationName=Pushbutton

[SAPToolBar]
paRepresentationClassName=SAPEngine.clsSAPToolbar
omTranslationName=Toolbar

[SAPGridViewToolBar]
paRepresentationClassName=SAPEngine.clsSAPGridView
omTranslationName=Table

Version 8.3.0 13
2 Installing the Engine

[SAPLabel]
paRepresentationClassName=SAPEngine.clsSAPLabel
omTranslationName=Label

[SAPTree]
paRepresentationClassName=SAPEngine.clsSAPTree
omTranslationName=Treeview

[SAPSpecialToolbar]
paRepresentationClassName=SAPEngine.clsSAPSpecialToolbar
omTranslationName=Toolbar

[SAPTable]
paRepresentationClassName=SAPEngine.clsSAPTable
omTranslationName=Table

[SAPPage]
paRepresentationClassName=SAPEngine.clsSAPTable
TableLoaderClassName=SAPEngine.clsPageLoader
omTranslationName=Table

[SAPTableTree]
paRepresentationClassName=SAPEngine.clsSAPTableTree
omTranslationName=Treeview

[SAPTextField]
paRepresentationClassName=SAPEngine.clsSAPTextField
omTranslationName=Editbox

Version 8.3.0 14
2 Installing the Engine

[SAPTextArea]
paRepresentationClassName=SAPEngine.clsSAPTextField
omTranslationName=Editbox

[SAPMenu]
paRepresentationClassName=SAPEngine.clsSAPMenu
omTranslationName=Menu

[SAPContextMenu]
paRepresentationClassName=SAPEngine.clsSAPContextMenu
omTranslationName=Menu

[SAPComboBox]
paRepresentationClassName=SAPEngine.clsSAPComboBox
omTranslationName=Combobox

[SAPRadioButton]
paRepresentationClassName=SAPEngine.clsSAPRadioButton
omTranslationName=Radiobutton

[SAPCheckBox]
paRepresentationClassName=SAPEngine.clsSAPCheckBox
omTranslationName=Checkbox

[SAPCalendar]
paRepresentationClassName=SAPEngine.clsSAPCalendar
; omTranslationName= <kein passender verfügbar>

[SAPStatusBar]
paRepresentationClassName=SAPEngine.clsSAPStatusBar

Version 8.3.0 15
2 Installing the Engine

; omTranslationName= <kein passender verfügbar>

[SAPGUIContainer]
paRepresentationClassName=SAPEngine.clsSAPGUIContainer
; omTranslationName= <kein passender verfügbar>

WizardMappings.dat

This file is located under the path %TRICENTIS_HOME%\dll\Dat. To enable Tosca


Wizard to recognize SAP, the WizardMappings.dat file must contain the
following entry:

[Class=SAP_FRONTEND_SESSION]
EnginePrefix=SAP
EngineName=SAPEngine
UserControlRepresentationClassName=SAPEngine
.SAPDetailsPage

[SAPLOGON.EXE]
EnginePrefix=SAP
EngineName=SAPEngine
UserControlRepresentationClassName=SAPEngine
.SAPDetailsPage

[SAPGUIRECORD.EXE]
EnginePrefix=SAP
EngineName=SAPEngine
UserControlRepresentationClassName=SAPEngine
.SAPDetailsPage

Depending on what the process is called on the particular system, the following
entry must exist:

Version 8.3.0 16
2 Installing the Engine

[SAPLGPAD.EXE]
EnginePrefix=SAP
EngineName=SAPEngine
UserControlRepresentationClassName=SAPEngine
.SAPDetailsPage

If no assigned engine is found in the WizardMappings.dat file for the test object,
upon scanning with Tosca Wizard, a pop up window will open, prompting the
user to select the appropriate engine to scan the application with(see
Tosca Commander™ Manual).

Version 8.3.0 17
3 Creating Modules

3 Creating Modules
The creation of Modules is described in general in the Tosca Commander™
Manual . In the chapters below you will be provided with engine specific methods
for identifying screens and controls as well as a list of properties and wildcards
and their possible uses in the TechnicalID.

Screen identification

The SAP transaction code allows SAP screens to be uniquely identified,


independent from the language setting. The SAP transaction code can be entered
into the toolbar (see chapter "Main window") in order to access the
corresponding screen.
When scanning SAP screens, Tosca Wizard identifies the SAP transaction code
and writes its value to the ObjectMap under the property
Systeminfo.Transaction.
To be able to select the screen context required for steering, the screen to be
steered must be named accordingly in the Module.
This name is stored in the property TechnicalID of the Module. Tosca Wizard
suggests a name in the Map Property Context Info.

Illustration 10: Example of a screen context; Tosca Wizard detail

Specifying the context information

The Context Info can be specified with two different information types:
 n Caption of the screen (business-based identification)
This is the title of the screen which is written to the Context Info field. Some
screens in SAP have different business-based names. Thus the Context Info
can be generalized: the context to be steered is always searched starting from
the left (with LeftMatch).
The use of wildcard symbols enables generalizations to be extended. The
Context Info of controls, which may occur on several screens (e.g. menu
steering), can thus be set to *. This ensures that the first main screen is used
for steering.

Version 8.3.0 18
3 Creating Modules

 n SAP path of the screen (technical identification)


The SAP path enables a screen to be precisely technically identified. In this
case, the following ID is specified to identify the screen:
ID:/app/con[0]/ses[0]/wnd[1] (see Illustration "Example of a screen context;
Tosca Wizard detail").
We recommend using this method only in exceptional cases.

Wildcards and regular expressions

Wildcards can be used in the TechnicalID of screens.

*eate ord* instead of Create order

Regular expressions can also be used in the TechnicalID.

{RegEx[Styleg.*: C.*box]}
instead of
Styleguide: Checkbox

Control identification

IDs are required for identifying the controls to be steered. These are displayed as
SAP-ID in Tosca Wizard and must be entered under the attribute TechnicalID in
the control tag. Tosca Wizard does this automatically.

Static IDs

All controls that exist in a SAP session at a particular point of time usually have
static IDs. This means that the IDs of the controls do not change during runtime.
The entire ID of the corresponding controls is scanned as a TechnicalID (default
behavior of Tosca Wizard).

Dynamic IDs

In exceptional cases, dynamic IDs are assigned to containers which contain the
controls to be steered. In these cases the dynamic part may be replaced by a
wildcard (*), or a Body ID can be used for identification. Please note the following
when using wildcards:
 n Wildcards can only be used for controls in the UserArea, i.e. the path must
start from level /usr/...
 n Body IDs must not be used in paths.
 n Only one wildcard may be used per level.

Version 8.3.0 19
3 Creating Modules

Regular expressions can also be used for the entire ID expression. However, the
dynamic part cannot be replaced with a regular expression.

Example with wildcard:

The absolute ID is:


/usr/ssubTABSTRIPCONTROL1SUB:SAPLMEVIEWS:1102/
subSUB1:SAPLMEGUI:1319/ctxtMEPO1319-MATKL
The changeable part of the ID, e.g. 1102, can be replaced by the
wildcard:
/usr/ssubTABSTRIPCONTROL1SUB:SAPLMEVIEWS:*/
subSUB1:SAPLMEGUI:1319/ctxtMEPO1319-MATKL

Example with a regular expression:

{RegEx[/usr/.*/txtF1]}
instead of
/usr/subSA_0100_1:SAPLEXAMPLE_ENTRY_
SCREEN:0200/subSA_200_2:SAPLEXAMPLE_ENTRY_
SCREEN:1200/txtF1

Example with Body ID:

The absolute ID is:


/usr/ssubTABSTRIPCONTROL1SUB:SAPLMEVIEWS:1102/
subSUB1:SAPLMEGUI:1319/ctxtMEPO1319-MATKL
If the ID contains several changeable parts, it is sufficient to enter
the ID part after the last slash (/):
/ctxtMEPO1319-MATKL
Using the absolute ID is highly recommended for steering in order
to speed up control steering.

3.1 Control types


SAPButton

Illustration 11: SAPGui-Type GuiButton

Version 8.3.0 20
3 Creating Modules

SAPTextField

Illustration 12: SAPGui-Type GuiTextField

Illustration 13: SAPGui-Type GuiLabel

SAPComboBox

Illustration 14: SAPGui-Type GuiComboBox

SAPCheckBox

Illustration 15: SAPGui-Type GuiCheckBox

SAPTabControl

Illustration 16: SAPGui-Type GuiTabStrip

Version 8.3.0 21
3 Creating Modules

SAPTable

Illustration 17: SAPGui-Type GuiTableControl

Illustration 18: SAPGui-Type GuiShell, Subtype Gridview

Version 8.3.0 22
3 Creating Modules

Illustration 19: SAPGui-Type GuiSimpleContainer

Illustration 20: SAPGui-Type GuiUserArea

Version 8.3.0 23
3 Creating Modules

SAPTableTree

Illustration 21: SAPGui-Type GuiShell, Subtype Tree, TypeAsNumber 207

Version 8.3.0 24
3 Creating Modules

Illustration 22: SAPGui-Type GuiSUserArea

Version 8.3.0 25
3 Creating Modules

SAPTree

Illustration 23: SAPGui-Type GuiShell, Subtype Tree, TypeAsNumber 203

SAPStatusBar

Illustration 24: SAPGui-Type GuiStatusbar

SAPRadioButton

Illustration 25: SAPGui-Type GuiRadioButton

Version 8.3.0 26
3 Creating Modules

SAPMenu

Illustration 26: SAPGui-Type GuiMenubar

SAPSpecialToolbar

Illustration 27: SAPGui-Type GuiShell, Subtype Toolbar

SAPCalendar

Illustration 28: SAPGui-Type GuiShell, Subtype Calendar

Version 8.3.0 27
3 Creating Modules

SAPTextArea

Illustration 29: SAPGui-Type GuiShell, Subtype TextEdit

In the current version, the toolbar of the SAPTextArea cannot be steered.

Version 8.3.0 28
3 Creating Modules

SAPContextMenu

Illustration 30: SAPGui-Type GuiContextMenu

3.2 Screen layout


There are two types of screens in SAP applications:
 n Main window
 n Modal window (child window)

Main window

Main windows are the standard case, and they are structured as follows:

Version 8.3.0 29
3 Creating Modules

Illustration 31: SAP main window

The upper part of the window contains the SAP Menu (see chapter 4.9 "SAP
Menu"). Depending on the operation, different functions are available via the SAP
Menu.
The SAP Toolbar is located (see chapter 4.21 "Toolbar") beneath the SAP Menu. It
is always structured in the same way and provides buttons for general functions
such as Enter, Back, Cancel, etc. and the text field for entering transaction codes.
The SAP status bar in the lower part of the screen shows messages for currently
performed actions (OK, notes, errors) (see chapter 4.17 "Statusbar").
The area between the SAP toolbar and the SAP status bar contains information
for the corresponding transactions. This area may contain simple controls (such
as buttons or text fields) that can be scanned collectively in Modules, and further
toolbars, tables, tree views etc., that can be used via pre-made Modules.

Modal window (Child window)

Modal windows usually appear as a confirmation popup or input window for


search requests or value specifications.

Version 8.3.0 30
3 Creating Modules

Illustration 32: SAP modal window

If a modal window is active, text cannot be input in the main parent window. The
modal window must be steered first.

Some modal windows cannot be scanned with the SAP Engine


because they block the current SAP session (for instance the Open
dialog). These windows can be scanned and steered with the Win32
Engine or the UIA Engine.

Version 8.3.0 31
4 Steering controls

4 Steering controls
This chapter describes the SAP Engine specific control steering. Some SAP
controls can be steered using specific Modules. These SAP Engine Modules can
be downloaded from the Tosca Exchange Portal.
For further information on general control steering, please see also the Tosca
Commander™ Manual.

Click operations

Click operations are specified via the Action row and the ActionMode Input.
If simple controls should be steered, this requires click operations to be specified
with curly brackets. Table steering does not need curly brackets since this is an
action. Mouse commands are not case-sensitive.
The Tosca SAP Engine supports the following click operations:

Control Table Description


{CLICK} or X CLICK or X Click with the left mouse button
DBLCLICK DBLCLICK Double-click with the left mouse
button
  SELECT Selects the specified row or column.
If neither a column nor a row is
specified, the entire table will be
selected.
  DESELECT Deselects the specified row or
column.
If neither a column nor a row is
specified, the entire selection will be
removed.
  ADDSELECT Adds the specified rows or columns to
the current selection.
Either a row or a column can be
specified. Specifying both attributes is
invalid. Analogous to Select and
Deselect, everything will be selected
or deselected if neither a row nor a
column is specified.

Version 8.3.0 32
4 Steering controls

Control Table Description


  DRAG A cell is selected and moved using
drag and drop.
GUISimpleContainers require the
entry to be written between curly
brackets.
  DROP The selected cell is inserted here after
selecting it with DRAG.
GUISimpleContainers require the
entry to be written between curly
brackets.
{RIGHTCLICK}   Click with right mouse button
{CONTEXTMENU}   Click with the right mouse button to
open a context menu.

Specific control steering

The following Composite Controls are available in SAP:

Type/log. Subtype Control type/phys. Basic Controls Representation in


Subtype Tosca
Table      
TableContol GuiTableControl Table ModuleAttribute
of the type
SAPTable
GridView GuiShell/GridView Table ModuleAttribute
(possibly with of the type
toolbar) SAPTable
Emulated Table GuiUserArea Labels ModuleAttribute
of the type
SAPTable
SimpleContainer GuiSimpleContain CheckBoxes, ModuleAttribute
er text fields and of the type
labels SAPTable
TableTree      
TableTree GuiShell/TableTree Table with Module SAP
tree TableTree

Version 8.3.0 33
4 Steering controls

Type/log. Subtype Control type/phys. Basic Controls Representation in


Subtype Tosca
Emulated Tree GuiUserArea Labels Module SAP
TableTree
Tree      
TreeView GuiShell/SimpleTr Tree Modul SAP
ee or ListTree TreeView
ToolBar      
Main Toolbar GuiToolbar[0] in Text fields Module SAP
the Main-Window and buttons Toolbar
Sub Toolbar GuiToolbar/tbar[1] Buttons Module SAP Sub
in the Main- Toolbar
Window
Toolbar in Popup GuiToolbar/tbar[0] Buttons registered as a
window in the Modal- Button attribute
Window in the
corresponding
ObjectMaps
Toolbar in GuiShell/Grid/View Buttons ToolbarItem field
GridView in the
ModuleAttribute
type SAPTable
Table 1: Chart of Composite Controls in SAP

Steering modal windows - Parameter LogStatusAfterAction

If a modal window is opened by clicking on a button, the execution in Tosca


Commander™ is halted until the modal window is closed.
To avoid this, we recommend using the ActionMode Input along with the value
{click} (instead of X). A mouse click is thus performed on the button. In addition,
the parameter LogStatusAfterAction containing the value false must be added in
the corresponding ModuleAttribute (see Tosca Commander™ Manual - Working
with Modules - Operations - ObjectControl). As a result, the execution thus
continues in Tosca Commander™ even if the window to be opened is displayed
as a modal window.

Some modal windows cannot be scanned with the SAP Engine


because they block the current SAP session (for instance the Open
dialog). These windows can be scanned and steered with the Win32
Engine or the UIA Engine.

Version 8.3.0 34
4 Steering controls

4.1 Steering tables


The control type SAPTable is used for steering SAP tables in Tosca Commander™.
Unlike simple controls, tables provide additional attributes that are required to
steer tables, e.g. Zeile (row) and Spalte (column).
The controls in SAP that users may recognize as tables can be structured into the
following physical types. The types shown in Tosca Wizard are indicated in
brackets.
 n TableControls (GUITable)
 n Emulated Tables (GUIUserArea)
 n GUISimpleContainer (GUISimpleContainer)
 n GridView (GUIShell, GridView)
Tosca Wizard recognizes these types as SAPTable, and they can be steered with
this control type. For a general description of table steering, see also the Tosca
Commander™ Manual.

Filtering rows of a table

The engine enables to limit the number of rows to be loaded when loading
tables. This requires the attribute RowFilter to be newly created for the table
control (ObjectCustomControlAttribute).

Illustration 33: ObjectCustomControlAttribute RowFilter

The TestStepValue RowFilter specifies the rows to be loaded. This may include
either individual rows or even a certain area. If no value is defined, the entire
table will be loaded.

Specifying individual rows

Syntax: #<row number1>,#<row number2>,...

Version 8.3.0 35
4 Steering controls

#42,#123,#789
The rows 42, 123 and 789 are loaded.

Specifying a certain area

Syntax: #<first row>-#<last row>


or
#<first row>-END

#7-#58
All rows from 7 to 58 are loaded.
#42-END
All rows from row number 42 to the last row are loaded.

Steering loaded tables

If tables are steered whose rows are restricted, the specified row number
indicates the loaded table rather than the original table.

If for instance the rows 42, 123 and 789 were loaded, the value #2
must be specified as a row number for steering row 123.

Input

To enter a value into a cell, the value must be specified under Action. The
required cell is specified via Row and Column. The cell in the test object must be
editable upon steering.

In the first row of the column Material the value M-08 should be
entered.

Version 8.3.0 36
4 Steering controls

Illustration 34: Example table input

WaitOn

The ActionMode WaitOn suspends the execution of the TestCase until the
corresponding control receives the value or property specified under Value. (For
detailed information, please refer to the Tosca Commander™ Manual.)

Baseline comparison

It is possible to compare the entire content of a table upon each execution to its
content during an earlier execution.
For this purpose, the ActionMode of the table is set to Verify and .baseline is
entered under Aktion.

Illustration 35: Baseline comparison

Version 8.3.0 37
4 Steering controls

If a baseline comparison is performed for the first time, an XML file (base file) is
created and stored in the base file directory. This directory is specified in the
Settings dialog under Engine->BaseLines->Directory.
During each additional execution another XML file (current file) is created and
compared to the base file. If differences occur during an execution, a verification
error is raised and written to the ExecutionLog. The directory of the current XML
file is specified in the Settings dialog under Engine->BaseLines->Dumps.
From Tosca version 6.3.3 on, SAP table modules have the attribute Baseline
Filename, in which the baseline name can be specified.
If no name is specified or if an older Tosca version is used, the baseline name is
generated according to the following schema:
<TestCase name>_<Table name><UniqueID of the table>_<TestStep
name>.xml
Dynamic values such as order numbers cause an error and must not be
considered. For this purpose, the row or column is specified under
Unberücksichtigte Zeile (Ignore rows) or Unberücksichtigte Spalte (Ignore
columns). If the table content needs to be modified, the base file can be
overwritten with the current XML file (Current File) via Set Dump to Baseline.

Hiding rows and columns

Tosca Commander™ can hide rows and columns while steering SAP tables.
Hidden parts of the table cannot be steered and are not considered during
verification. This function is specified as follows:
 n Irrelevant rows
Rows to be ignored upon steering are indicated here. Possible values are
numeric row numbers with initial hash sign (#) and business-based values. The
rows are specified separated by semicolons.
Example: #2;Rownumber;#17
Skips the rows 2 and 17 as well as all rows which contain the value
Rownumber.
 n Irrelevant columns
Columns to be ignored upon steering are indicated here. Possible values are
numeric column numbers. The columns are specified separated by
semicolons.
Example: 2;5
Skips the columns 2 and 5.

Verifying the traffic light status

Tables may contain a traffic light value that can be verified. For this purpose, the
ActionMode of the table is set to Verify and the color to be verified (Green,

Version 8.3.0 38
4 Steering controls

Yellow, Red - entry is case sensitive!) is specified for the attribute Aktion.
The Tosca Commander™ Manual contains a detailed desciption of how to specify
rows and columns.

Illustration 36: Verify traffic light value

Verifying the tooltip of a cell

The tooltip of a cell can be verified by using the following syntax for Action:

Syntax: .ToolTip=<Tooltip>

In this way, the tooltip of the cell that is defined by Row and Column can be
verified.

The following TestStep verifies whether the tooltip of the fourth row
in the third column of the specified table has the value Green.

Illustration 37: Example: Verifying a tooltip

SAP does not correctly return umlauts or other special characters


that are contained in the tooltip (For instance: IMG - Aktivität

Version 8.3.0 39
4 Steering controls

becomes IMG - Aktivität). In this case, the TestStep in question has


to be run once with the error in order to determine the value of the
tooltip returned by SAP.

LastContentRow and FirstEmptyRow

Tosca enables to determine the last row that was filled with data already upon
runtime. This is for instance necessary if the value of the last row should be
verified. For this purpose #LastContentRow is specified under the attribute Row.

Illustration 38: LastContentRow

Analogous to this, the first empty row can be accessed by entering


#FirstEmptyRow under the Attribute Zeile . As the first empty row
(FirstEmptyRow) the row that follows the last row with content (LastContentRow)
is recognized.

Row and column number

The Tosca SAP Engine allows you to read row and column numbers in order to
perform verify or buffer operations with the values. For this purpose, .row (row
number) or .col (column number) must be specified for the Property.

The following example verifies whether the second row is the last
row with content:

Version 8.3.0 40
4 Steering controls

Illustration 39: Verify LastContentRow

The following example verifies whether the column ME is column


number 6:

Illustration 40: Verify a value in a column

In the following example, the number of the row Customer is stored


in the buffer rowbuffer:

Illustration 41: Buffer row number

Version 8.3.0 41
4 Steering controls

In the following example, the number of the column Account is


written to the buffer colbuffer:

Illustration 42: Buffer column number

For further information on how to use buffer operations and the


exact syntax, please refer to the Tosca Commander™ Manual.

Number of row and column occurrences

The Tosca SAP Engine allows the number of row and column occurrences to be
read out in order to perform verify or buffer operations with these values. For
this purpose, .rowcount (row occurrences) or .colcount (column occurrences)
must be specified under Property.

If .rowcount is used with tables that contain empty rows, the


occurrence of the completed rows plus three empty rows is read.

Syntax for verification:

Property: .rowcount or .colcount


Row or column: virtual (The DataType of the TestStepValue has an asterisk *)
Action: <Operator><Value>
The following operators are supported: <, >, !=, == and = . If the operators < and
> are used, the DataType of the TestStepValue must be set to Numeric.

In the following example, it is verified whether the table contains 6


rows:

Version 8.3.0 42
4 Steering controls

Illustration 43: .rowcount

In the following example, the number of column occurrences is


written to the buffer Occurrence_Columns:

Illustration 44: .colcount

Decisive Column

Individual columns of a table can be entirely filled with standard data (e.g.
currencies or dates). The cells of these columns do not necessarily have to
contain relevant data. A column that contains relevant data is referred to as
Decisive Column.
The Tosca SAP Engine reads only rows which contain concrete values. For this
purpose the following syntax is used for the Steering property:

Syntax: DecisiveCol=<column number>

Version 8.3.0 43
4 Steering controls

The value DecisiveCol=3 is specified for the Steering property. As a


result, only those rows of a table are considered whose third
column is not empty. Rows, whose third column does not contain
any values, will be ignored.

Illustration 45: DecisiveColumn

Example with LastcontentRow

In the example below, the third column of a table is completely filled


with standard data and is therefore insignificant (currency):

Vehicle Price Currency


Automobile1 10,000 Euro
Automobile2 12,000 Euro
    Euro
    Euro
Table 2: Example - entirely filled column

The value LastContentRow can be used with a table column which has
been predefined as DecisiveCol. Hereby the last row of the table
column that contains a value is determined. By specifying
DecisiveCol=2 the second column is used. In the table above this is
the Price column. The value Test is to be entered into the second

Version 8.3.0 44
4 Steering controls

column's last row that is filled with data. In the table above, the value
12,000 of the Price column would be replaced by Test.

Illustration 46: LastContentRow

Read table contents

Contents of a table column can be exported to an Excel spreadsheet. This


requires a column name to be specified. The following syntax must be used for
the Action row:

Syntax: dumprows[<Path to Excel file>\<SAP Transaction>

If no column name is specified, only row numbers will be read. Values that exist
twice are only read once. Empty values are not used.

In the example below, the content of the Servername column is


read to an Excel worksheet of the name Columns_Values.xls which
is located at D:\Examples.

Illustration 47: Example Dumprows

Version 8.3.0 45
4 Steering controls

4.1.1 Table types

TableControls (GUITable)

Tables of the type GUITable are default tables. These tables can be included in
the ObjectMap without any additional special treatment by selecting them in
Tosca Wizard.

Illustration 48: GuiTableControl

Illustration 49: GuiTableControl in Tosca Wizard

Emulated Tables (GUIUserArea)

Emulated tables optically look like normal tables. From a technical point of view
they are not tables, but collections of labels. Emulated tables can be steered with
the control SAPTable.

Version 8.3.0 46
4 Steering controls

Illustration 50: Example Emulated Table

Illustration 51: Emulated table in Tosca Wizard

Version 8.3.0 47
4 Steering controls

Emulated tables often have an ambiguous table structure that may contain
different column arrangements per row and complex header areas. The
additionally required steering information can be specified in Tosca Wizard when
the table is scanned and stored in the control SAPTable under the property
Steering.

Illustration 52: Example Module with the Property Steering

Version 8.3.0 48
4 Steering controls

Tosca Wizard provides an additional format for tables, for which additional
properties can or must be specified. With the checkbox Is Table activated,a
preview of the table layout is displayed.

Illustration 53: Tosca Wizard - Form for additional properties

The following entries are possible:

 n Header row: Number of the row, in which the header is located. This Attribute
is used as an alternative to Header. The row number is displayed in the ID of
the respective cell element (visible in Tosca Wizard): The ID is structured as
follows:
[<column index>,<row index>]
If no header exists, headerRow=-1 must be set. The default value is
headerRow=0.
 n Header: List of concrete column names. For tables with a header that cannot
be read, but that have a logical header, the column names can be specified
separated by commas.
 n Data start row: Number of the row, in which the first data row is located.
Default value is headerRow+1.

Version 8.3.0 49
4 Steering controls

 n Data end row: Row number of the last data row to be read. For
EmulatedTables, which do not reach the end of the screen it is possible to
specify the index of the last row that is part of the table in order to stop the
reading process.
 n Identify table by header: If two or more emulated tables are located on a SAP
screen one below the other, beginning from the second table, the header row
cannot be specified absolutely, as the number of rows of the first table is not
known at the time of scanning. In this case Identify table by header must be
specified. Thus the Engine searches for a row with the column names specified
under Header and sets it as Header row. Data start row is also specified
relatively to this row.
 n List of column positions: List of the starting positions of relevant columns. In
order to keep the data volume to be loaded as small as possible, a list of
relevant column positions for the loading process can be specified. The
column indices can be read off from the ID of the respective cell element
(visible in Tosca Wizard). The ID is structured as follows:
[<column index>,<row index>].
If List of column positions is set and no explicit header is specified, the
positions that are defined here are also used for the specification of the
header.
 n Row shift: Some tables have rows that are only used to structure the table
layout, but do not contain any relevant data. These rows must be blanked out
during the loading process of the table in Tosca. In such a case rowShift must
specify for how many rows the row number must be raised in order to receive
the next reasonable data row. The default value of rowShift is 1.
 n Row Height: Specifies the height of the row. Some logical rows cover several
row indices. The default value is 1.

GUISimpleContainer (GUISimpleContainer)

GUISimpleContainer is a container of CheckBoxes, text fields and labels that are


presented to the user as a table.

Illustration 54: SAP GUISimpleContainer

Version 8.3.0 50
4 Steering controls

Illustration 55: GuiSimpleContainer in Tosca Wizard

GridView (GUIShell, GridView)

GridViews are represented in Tosca by one single control, but normally they
include a corresponding toolbar that provides table-specific functionalities.

Illustration 56: GridView: table with toolbar

Version 8.3.0 51
4 Steering controls

Illustration 57: GridViewCtrl.1 in Tosca Wizard

The toolbar is steered by the Attribute ToolbarItem. Individual items are steered
like the SAP SpecialToolbar (see chapter 4.16 "SpecialToolbar").

Dynamic column names

The modification of a GridView table’s column width may affect the length of the
displayed column name. The Tosca SAP Engine allows the static tooltip of a
GridView table to be steered.
To steer GridView tables via the tooltip, the property ColNameFromTooltip must
either have the value True in the table steering or the setting Get column name
from Tooltip (see Tosca Commander™ Manual - Settings - Special Engines - SAP
Engine) must have the value Yes. If the property ColNameFromTooltip exists on
the Module level, it overwrites the general setting Get column name from
Tooltip. If this property has the value False or another value, the column name is
determined on the basis of the displayed (dynamic) header. The property
ColNameFromTooltip must be created manually via the Properties tab of the
GridView table (on the ModuleAttribute level) by using the option Create
parameter - _New.

4.2 Button
The Module SAP Buttons allows buttons to be steered which are not embedded
into a toolbar.

Illustration 58: Position detail of a button in SAP

All other buttons use the Module SAP SpecialToolbar.


The ModuleAttribute Button-Tooltip contains a variety of standard buttons as
sub-elements. This list can be extended as required by using the option Create

Version 8.3.0 52
4 Steering controls

ControlGroupItem (see Tosca Commander™ Manual). New control group items


require a unique technical ID to be defined.

Illustration 59: Module SAP Buttons

4.3 Calendar Control


Calendar controls can be scanned using Tosca Wizard.

Illustration 60: Calendar Control

Steering options

 n Specify an individual: <year><month><day>


Example: 20071029
 n Specify an interval: <year><month><day>-<year><month><day>
Example: 20071029-20071105
 n Specify a calendar week: CW <calendar week>/<year>
Example: CW41/2007
Valid abbreviations for calendar week: wk=week,cw=calendar week, wn=week
number, kw=Kalenderwoche (calender week)

Version 8.3.0 53
4 Steering controls

4.4 ComboBox
The SAP ComboBox can be steered with Tosca Wizard.

Input

The SAP ComboBox supports the input of key and value and thus allows values
to be used from a ComboBox . If the combination cannot be found, the engine
searches the value list.

Syntax: <key><space><value>

In the example below, the value 97 Kreditlimit is selected from the ComboBox
Liefersperre and 03 Preise unvollständig is selected from the ComboBox
Fakturasperre.

Verify

The ActionMode Verify supports the search for values.

Syntax: <key value>

Illustration 61: SAP ComboBox

Verification is supported according to the following criteria:


Lists:
 n .List: the Value column includes for instance .List=001 Value1;002 Value2
 n .KeyList: the Value column includes for instance .KeyList=001;002
 n .ValueList: the Value column includes for instance .ValueList=Value1;Value2
Individual entries:

Version 8.3.0 54
4 Steering controls

 n .Contains: the Value column includes for instance .Contains=001 Value1


 n .ContainsKey: analogous to Lists
 n .ContainsValue: analogous to Lists

4.5 Delay
The Module SAP Delay can be used to define a wait time in a TestCase. The time
is specified in milliseconds.

Illustration 62: SAP Delay

4.6 ListTree
SAP ListTrees are SAP TableTrees of the type ListTree. SAP ListTrees can be
scanned using Tosca Wizard.

Illustration 63: SAP ListTree

Input

If rows to be selected are entered, the path must be specified with wildcards. This
is necessary since the visible name does not always match the entire name.

*Cost center group*->*Cost center*

If a name is part of another name, the entry must be specified using an Exact
Match Delimiter.

Version 8.3.0 55
4 Steering controls

*Cost center group*->*Cost center<

4.7 Login/Logout
The Module SAP Login is used to enter user-specific data of a certain user into
the SAP Login screen.

Illustration 64: SAP Login screen

Login procedure:

 1. Prior to login, an SAP Logon must be performed.


 2. In the next TestStep, the login data is entered using the Module SAP Login.
Passwords are displayed encrypted by default. If the value of the DataType is
set to Password, this value will be encrypted.
 3. The entry is confirmed via the Module SAP Toolbar.

Version 8.3.0 56
4 Steering controls

Illustration 65: SAP Login example

Logout

The Modules SAP Menü and SAP Popup Frage are used for logging off from SAP.

Illustration 66: SAP Logout example

4.8 Logon
The Module SAP Logon can be used to select an SAP system from the SAP Logon
window. The selected system is double clicked on in order to open the login
screen.

Version 8.3.0 57
4 Steering controls

Illustration 67: SAP Logon

Illustration 68: SAP Logon options

To start an SAP system, the Module SAP Logon should always be used. The Logon
screen cannot be scanned with the Tosca SAP Engine, as it cannot be steered via
the SAP Scripting interface.

4.9 SAP Menu


The Module SAP Menu allows various SAP functions to be accessed and SAP
settings to be modified. The available menu options vary depending on the
operation that is currently being executed.
The ActionMode Input can be used to access a menu item and the ActionMode
Verify verifies the properties of a menu entry.

Illustration 69: SAP Menu

Version 8.3.0 58
4 Steering controls

ActionMode Input

Specific menu entries can be steered by specifying the respective menu paths.
Any menu nodes must be separated by ->.

In the following example, the menu entryEdit->Incompletion log is


selected.

Illustration 70: SAP Menu - Input

ActionMode Verify

The following syntax must be used in order to verify the property of a menu
entry:

Syntax: <Menu entry>.<Property>=<Value>

The command .itemexists enables whether a specific item exists or not to be


verified:

Syntax: .itemexists(<path of menu entry>)=<Value>

In the following example, the system verifies whether the menu


entry System->Map exists.

Illustration 71: SAP Menu - Verify

4.10 Multilic
The Module SAP Multilic is used for steering the modal dialog License
information for Multiple Logon. This dialog opens whenever a user tries to log
on to the system several times.
Specify the caption of the dialog window to be steered in the Properties tab of
the Module for the parameter CaptionList. If you would like to specify more than
one caption in various languages, they must be separated by semicolons.

Version 8.3.0 59
4 Steering controls

Illustration 72: CaptionList example

The modal dialog can be steered with the three options beneath the RadioButton
Anmeldungsoption. The TestStepValue Button confirms the selected entry.

Illustration 73: SAP Multilic

If the modal dialog box does not appear, an error will not be displayed during
test execution.

Version 8.3.0 60
4 Steering controls

4.11 OptSubToolbarButton
A button in the second row of a toolbar can be steered using the SAP
OptSubToolbarButton Module.

Illustration 74: SAP OptSubToolbarButton

The tooltip text of the button to be steered is entered under Button.

4.12 Popup
Standard pop-up menus can be steered with the following three Modules: SAP
Popup, SAP Popup Frage and SAP Popup Info. Any new pop-up menus can be
scanned using Tosca Wizard.

Illustration 75: Module SAP Popup question

Illustration 76: Popup screen in SAP

Version 8.3.0 61
4 Steering controls

4.13 RadioButton
The method to steer SAP RadioButtons is different for simple RadioButtons (see
chapter "ControlSimple") and for RadioButtons that are part of a ControlGroup
(see chapter "ControlGroup")

ControlSimple

Input

Simple SAP RadioButtons can be selected via the ActionMode Input and the value
X.

Verify

To verify if a simple SAP RadioButton has been selected, the following syntax is
required:

Syntax: .value=X

To verify if a simple SAP RadioButton has not been selected, the following syntax
is required:

Syntax: .value=<space>

The following example verifies if the RadioButton Master data is


selected and if the RadioButton Change request is not selected.

Illustration 77: SAP RadioButton - ControlSimple

ControlGroup

Input

SAP RadioButtons that are part of a ControlGroup can be selected via the
ActionMode Input. The name of the desired RadioButton is specified under
Value.

Verify

To verify if an SAP RadioButton that is part of a ControlGroup has been selected,


the following syntax is required:

Version 8.3.0 62
4 Steering controls

Syntax: Control.value=X

To verify if an SAP RadioButton that is part of a ControlGroup has not been


selected, the following syntax is required:

Syntax: Control.value=<space>

The following example verifies if the RadioButton Master data has


been selected and if the RadioButton Change request has not been
selected.

Illustration 78: SAP RadioButton - ControlGroup

4.14 Refresh
The SAP Refresh Module allows a window to be refreshed several times until
either a defined message is shown or a defined number of attempts is reached.

Illustration 79: Module SAP Refresh

The Module contains 5 ModuleAttributes. The required information is provided in


the following table.

ModuleAttribute Description

Control Here, the SAP ID of the container is entered, which shows


the message to be waited for.
Message The string to be waited for is entered here.

Version 8.3.0 63
4 Steering controls

ModuleAttribute Description

Retry Defines the maximum number of times the Refresh


button should be clicked on.
WaitFor Defines the time span in milliseconds between retries.

RefreshButton The SAP ID of the button, which is clicked to trigger a


refresh action, is entered here.

The SAP window to be steered must be scanned with Tosca Wizard to be able to


enter the SAP ID into the ModuleAttributes Control and RefreshButton. The
according SAP ID is shown on the corresponding control.

4.15 Send Keys


The Module SAP Send Keys can be used for sending keyboard commands such
as Enter, F4, etc. directly to the application. The key is entered directly at the
cursor position. Key commands are specified with curly brackets.
If the cursor is not active, the keyboard command is sent directly to the
application. This allows functions to be accessed via shortcuts.
It is also possible to steer controls that have not been scanned with Tosca
Wizard.

Illustration 80: SAP Send Keys

If a special key such as Ctrl should be pressed in addition to the keys


{ENTER}, {F1}, {PF1}, {F3}, {PF3}, {F5} or {PF5}, this requires the
use of the Module TC Send Key (from the Exchange Portal package
Basic Windows Operations) instead of SAP Send Key.

4.16 SpecialToolbar
Special toolbars are mostly used along with tables or tabs. The Module SAP
SpecialToolbar is used for steering SpecialToolbars.
The following control types may exist in a SpecialToolbar:

Version 8.3.0 64
4 Steering controls

Control type Sample icon Description


Button A click onto the left button performs
an action.
ButtonAndMenu A click onto the left button performs
an action. A click on the right button
opens its context menu.
Menu A click onto the Menu icon opens its
context menu. The entries of the
Menu can be steered using the
following syntax: <Icon>->Menu entry.
Table 3: Control types

Creating Toolbars

You are able to add any number of new TableTrees to the Module SAP
SpecialToolbar.
 1. Select the ModuleAttribute Toolbar in the Module SAP SpecialToolbar.
 2. Select the option Create ControlGroupItem from the context menu of the
attribute.

Illustration 81: Create Toolbar

A name and a TechnicalID must be entered for the new toolbar. The TechnicalID
is determined using Tosca Wizard.
 3. Scan the required window using Tosca Wizard. The Technical ID is displayed
in Tosca Wizard in the SAP ID field of the required SpecialToolbar.
 4. Copy the value of the SAP ID of the SpecialToolbar to the clipboard.
 5. Close Tosca Wizard. The Module is not saved.

Version 8.3.0 65
4 Steering controls

 6. Select the ModuleAttribute Toolbar in the left window section of Tosca
Commander™.
 7. Switch to the right section of the window, go to the Properties tab and select
the newly created toolbar.
 8. Copy the value of the property SAP ID to the Value column of the property
TechnicalId.

Illustration 82: TechnicalId of the new TableTree

Defining TestSteps

 1. Select the toolbar to be steered from the drop-down menu in the Value field
of the TestStepValue Toolbar.
 2. Specify the name of the control to be steered in the TestStepValue
ToolbarItem.

Illustration 83: Module SAP SpecialToolbar

The table "Control types" lists all control types that may exist in a SpecialToolbar.
The Description column illustrates the actions that are performed when the
respective control is steered.

4.17 Statusbar
In SAP, status messages are shown in the status bar. These messages can be
verified using both the Module SAP Statusbar and the ActionMode Verify. You
can verify the text of the status message and its type (error, hint, ok).

Illustration 84: SAP Statusbar

Version 8.3.0 66
4 Steering controls

Dynamic text fragments can be written to the buffer (XBuffer) and read out if
required. For further information on the XBuffer, see Tosca Commander­™
Manual.

Illustration 85: SAP Statusbar: Reading order number

The message type error can explicitly prevent the test execution from being
aborted. This behavior can, for instance, be used in negative tests to verify if a
particular error message appears.

Illustration 86: SAP Statusbar Error

Illustration 87: SAP Statusbar: verifying an error message

To verify additional properties of the SAP Statusbar, these can be added to any
Module. For this purpose, the ModuleAttribute Statustext is copied to the
required Module. The following properties can be verified:

Control Property Description


.Systeminfo.Client Client that is currently logged in
.Systeminfo.Flushes Specifies how often the Automation Queue
is cleared
.Systeminfo.Interpretationtime Time period between receipt of data from
the server on the SAP GUI Client and
display of the data
.Systeminfo.Program Currently active program
.Systeminfo.Responsetime Time until a response is received
.Systeminfo.Roundtrips Time that a data package needs for the way
from the source to the target and back
.Systeminfo.System SAP system which the user is currently
logged into.

Version 8.3.0 67
4 Steering controls

Control Property Description


.Systeminfo.Transaction Currently active transaction
.Systeminfo.User Username of the user that is currently
logged in

4.18 SubToolbar
The Module SAP SubToolbar can be used for steering specific buttons. The sub-
toolbar may contain different elements depending on the screen used.

Illustration 88: SAP SubToolbar (tooltip text)

To be able to steer a button, the corresponding tooltip text must be specified in


the TestStepValue ToolbarButton.
You can verify whether a message exists in a particular screen area by specifying
the expected message in the Attribute Message. The ActionMode must be set to
Verify.
The Technical ID of the screen area is specified in the Attribute Container which
exactlymatches the ID that is shown in the SAP ID field in Tosca Wizard.
The TestStepValue WaitFor specifies the time to be waited for the message, and
the TestStepValue Retry specifies how often this procedure is to be repeated.

In the example below, the Save button should be clicked on up to 7


times until the text Data has been saved appears in the specified
Container. The engine waits for 1000 milliseconds between the
attempts.

Illustration 89: Module SAP SubToolbar

Version 8.3.0 68
4 Steering controls

4.19 TabControl
The Module SAP TabControl allows individual tabs of a screen to be accessed.
The TestStepValue Tab specifies the name of the tab to be steered.

Illustration 90: SAP TabControl

Illustration 91: SAP TabControl

The ActionMode Verify checks if the SAP TabControl is currently active. The
following syntax must be used in order to verify whether a certain tab exists:

Syntax: <Tab name>.Exists=True or False

4.20 TableTree
The Module SAP TableTree is used for steering table trees.
Unlike TreeViews, TableTrees contain a tree in the first column and tables in the
second column. Therefore, the Module SAP TableTree contains the attributes
Zeile (row), Spalte (column) and Aktion (action).

Illustration 92: SAP TableTree

Illustration 93: Steering of SAP TableTrees

Version 8.3.0 69
4 Steering controls

Creating TableTrees

You can add any number of new TableTrees to the Module SAP TableTree.
 1. Select the ModuleAttribute TreeView in the Module SAP TableTree.
 2. Select the option Create ControlGroupItem from the context menu of the
attribute.

Illustration 94: Create TableTree

A name and a TechnicalID must be entered for the new TableTree. The
TechnicalID is determined using Tosca Wizard.
 3. Scan the required window using Tosca Wizard. The technical ID is displayed
in Tosca Wizard in the SAP ID field of the required TableTree.

Illustration 95: TechnicalID in Tosca Wizard

 4. Copy the value of the SAP ID of the TableTree to the clipboard.
 5. Close Tosca Wizard. The Module is not saved.

Version 8.3.0 70
4 Steering controls

 6. Select the ModuleAttribute TreeView in the left window section of Tosca
Commander™.
 7. Switch to the right section of the window, go to the Properties tab and select
the newly created TableTree.
 8. Copy the value of the property SAP ID to the Value column of the property
TechnicalId.

Illustration 96: TechnicalId of the new TableTree

Defining TestSteps

 1. Select the TableTree to be steered from the drop-down menu in the Value
field of the TestStepValue TreeView.

Illustration 97: Selecting the required TreeView

 2. In the TestStepValue Zeile (row), define the path to the required node (see
chapter 4.22 "TreeView").
 3. Specify the required input action in the TestStepValue Action.
The following input actions are possible for elements that are embedded in a
TableTree:

Syntax Description
click, dblclick, linkclick Click with the left mouse button, double-click with
the left mouse button or click on a link.
The system clicks using the SAP Engine methods.

Version 8.3.0 71
4 Steering controls

Syntax Description
{click}, {dblclick}, Click with the left mouse button, double-click with
{rightclick} the left mouse button or click with the right mouse
button.
These clicks are generically performed by
calculation of coordinates using the mouse pointer
or simulated key entries.
drag, drop A drag or drop operation on an item in the
TableTree.
select Selects an item in the TableTree.
x, [space] Selects or deselects an item in the TableTree.
Table 4: Actions

 4. Define the column to the steered via the TestStepValue Spalte, if needed.

In the following example the node Workflow->Prüfung is selected.


The link in the row with the column 5 containing the value Kandidat
is clicked on.

Illustration 98: Example - linkclick with row selection

In the next example a cell or the clickable element in column 2 of


the node Prozess->Tester is clicked on.

Illustration 99: Example - click with column and row selection

Verifying ChildNodes

It is possible to verify how many ChildNodes a node contains. Thus under Zeile
(row) the path to the desired node is specified. Under Aktion (action)
.childCount=n is entered and the ActionMode is set to Verify.

Version 8.3.0 72
4 Steering controls

Illustration 100: Verification of ChildNodes

Verifying the existence of a node

The existence of nodes is verified by entering the following syntax into the Action
row: .itemexists=True oder False.
The path to the required node is to be specified under Row. At least one row
must be specified.
The ActionMode must be set to Verify.

Illustration 101: Verify existence of a node

Legacy steering

With legacy steering, the desired node can additionally be verified by specifying
the column number and the content of the table of the tree. For this purpose, the
following syntax must be used:

Syntax: <Level1>-><Level2>->...<Level x>;<column no.>=<value>;<column


no.>=<value>

This syntax can be used for all hierarchy levels.


In the first column of a TableTree the node hierarchy is displayed.

a->b->c;3=Test1;4=Test2
In this example, c is assumed as the value of the first column. Test1
must be found in column 3, and Test2 in column 4.

Version 8.3.0 73
4 Steering controls

Verifying the traffic light value of a node

Nodes of TableTrees may receive a traffic light value that can be verified. For this
purpose, under Zeile (row), the path to the desired element is specified, in the
row Aktion (action), the ActionMode is set to Verify and under Value, the color
(Green, Yellow, Red) is specified.
This entry is case sensitive! Under Spalte (column) Trafficlight must be entered.

Illustration 102: Verify traffic light value

Verifying the IconName of a node

TableTrees may contain icons with names which can be verified. Under Zeile
(row), the path to the desired symbol is specified, in the row Aktion (action), the
ActionMode is set to Verify, and under Value, the name of the icon is specified.
Under Spalte (column), theIconName must be entered.

Illustration 103: Verify IconName

The verification of IconNames is only supported for emulated Trees.

Verifying icons with screenshot comparison

If icons are contained in TableTrees, they can be compared within a reference


folder. These reference images must be provided in BMP format. A screenshot of
the icon is created in the TableTree for comparison. The comparison returns the
name of the image contained in the reference folder without an extension and
that differs from the screenshot to the lowest extent. The settings that are
relevant to this verify process, such as the path to the reference folder, are
specified in the Settings dialog under Special Engines->SAPEngine->IconCompare
(see Tosca Commander™ Manual).
The images used for comparison purposes should

Version 8.3.0 74
4 Steering controls

 n be almost of the same size as the icon to be verified


 n have a light background color
 n only include the images which have had TestSteps executed for them.

In this example, the engine verifies whether the icon in row Level1-
>Level2 and column Icon of the TableTree TableTree1 matches the
reference image Image1.

Illustration 104: Verify icon via screenshot comparison

Emulated Trees

Emulated Trees are containers of labels. They consist of individual control


elements and are steered with the Module SAP TableTree.

Illustration 105: Example Emulated Tree

Version 8.3.0 75
4 Steering controls

Steering headers

SAP TableTrees are identified by the control names. As the text of the header may
vary from language to language, but the column names remain the same and are
independent from the applied language, the Tosca SAP Engine can switch
between steering the header text and the column name.
For this purpose, the parameter IdentifyColumnBy (please note that the
parameter is case sensitive) must be created in the ObjectMap of the SAP
TableTree Module.

Illustration 106: Parameter IdentifyColumnBy

The following values can be specified for the parameter IdentifyColumnBy:


 n text: the SAP TableTree header is steered via the header text
 n name: Die SAP TableTree header is steered via the header name
If no value is specified or if the parameter IdentifyColumnBy does not exist, the
default value text is applied.

Using templates

If a certain sequence of Actions should be applied to every node in a TableTree,


this sequence can be saved to an Excel template and reused.

Procedure

 1. The Action row indicates in which Excel file the values should be read.
Syntax: dumpChildren[<Path to Excel® file>\<Name of worksheet>]]
Example: dumpChildren[C:\Temp\children.xls\Table1]

Version 8.3.0 76
4 Steering controls

 2. The row indicates the node from which the child elements are to be written
to the Excel sheet.
 3. In addition, the TestCase name, the name of the parent node and the table
tree name are also copied to the Excel sheet.

Illustration 107: Example dumpChildren in the TestCase

Illustration 108: Example dumChildren in Excel

Using wildcards and regular expressions in paths

Wildcards and regular expressions can be used when specifying paths in the
TestStepValue Row. Additionally, entering an index is an option. The index is
specified after the wildcard or the regular expression in square brackets: [Index].
For regular expressions, the following syntax is used:

Syntax: {REGEX[<regular expression]}

The root node Workbench Demos is searched for. Then the first
child node is selected, and from this the fifth child node, and then
from this the third child node.
Workbench Demos->*[1]->*[5]->*[3]

The first child node is selected, starting from the root node. From
this, the fifth child node which contains the string Control in its
name is selected, and then from this the third child node.
->*[1]->{RegEx[.*Control.*]}[5]->*[3]

Version 8.3.0 77
4 Steering controls

4.21 Toolbar
The Module SAP Toolbar allows both the input field for transaction codes and
toolbar buttons to be accessed.

Illustration 109: SAP Toolbar

Illustration 110: Module SAP Toolbar

The following syntax enables to verify whether a control exists in the toolbar:

Syntax: .itemexists(<toolbar item>)

4.22 TreeView
The Module SAP TreeView is used for steering simple TreeViews.
The attributes Menupath and Docked Tree-Menu are provided in the Module
SAP TreeView. The Technical ID of the respective TreeView to be steered
determines which attribute is to be used. By default, the ModuleAttribute
Menupath is used.

Version 8.3.0 78
4 Steering controls

This control type can be used in several Modules. For this purpose, the
ModuleAttribute Menupath or Docked Tree-Menu must be copied to the
required Module.

Illustration 111: SAP Tree

The TestStepValue indicates the path to the menu item to be selected. The
elements (levels) are specified separated by -> characters. The last element is
double-clicked.

Illustration 112: Specifying the path in the TreeView

If the first level is a dynamic value, the paths can be specified starting with the
second level. Relative paths must begin with an arrow.

Syntax: ->second level->third level->forth level->...

TreeViews can also be selected with a mouse click. This is for


instance the case if a details page exists for the TreeView.
This option must be enabled via the setting Use mouse for Tree
Node selection. Alternatively, the parameter
UseMouseForTreeNodeSelection can be created on the Module level
containing the value Yes. In this case, the behavior changes only for
the current TreeView.

Drag & drop

The following syntax is used for performing drag and drop operations on an
item:

Syntax: {Drag(Level1->Level2->...->item)}

Version 8.3.0 79
4 Steering controls

{Drop(Level1->Level2->...->item)}

Identical entries

If several entries of the same name exist on one level, they can be steered using
an index in square brackets [ ].

Illustration 113: Identical items on the same level

IDoc->Data records->E1OILT1->E1OILT2[3]

Illustration 114: Steering identical items

Identification by specifying columns

Entries can additionally be steered by specifying columns if this makes unique


identification possible. As regards specification, the path is followed by the
column name and it is specified by using a semicolon ;.

IDoc->Data records->E1OILT1->E1OILT2;Segment 000004

Illustration 115: Identification by specifying columns

Verifying TreeView items (itemexists)

It is possible to verify whether an entry exists in a TreeView. The following syntax


is thus used along with the ActionMode Verify:

Version 8.3.0 80
4 Steering controls

Syntax: .itemexists(<path>)=true or false

This example verifies whether the menu entry Logistics exists.

Illustration 116: Verifying menu entry

Context menu of TreeViews

Context menu entries of TreeViews are selected in three steps:


 1. In the first TestStep, the required entry must be verified by specifying the
path.
 2. In the second TestStep, the context menu is opened by using the click
operation {RIGHTCLICK}.
 3. In the third TestStep, the menu entry is selected via the Module SAP
ContextMenu.

In the example below, the entry Create is verified in an SAP


TreeView, and the context menu is opened with a right-click. Then,
the entry Documentation is selected from this context menu.

Illustration 117: SAP TreeView context menu

4.23 WaitStatusChange
The Module SAP WaitStatusChange allows dynamic status messages to be
verified in the status bar.
 n The first value of the status bar is specified in the attribute From.
 n The modified value of the status bar is specified in the attribute To.

Version 8.3.0 81
4 Steering controls

 n MaxWait defines the time to be waited until the modified value of the status
message is displayed. This wait time is specified in seconds.

Illustration 118: SAP WaitStatusChange

Version 8.3.0 82
5 Multi-Session Operations

5 Multi-Session Operations
It is possible to administrate several SAP sessions (Connections) at the same
time. This option must be enabled via the Settings dialog (see Tosca
Commander™ Manual - Settings - Special Engines - SAPEngine - Allow Multiple
SAP Connections). The session with the specified TechnicalID is searched for. If an
* is specified as TechnicalID, the last active window is searched for.

Version 8.3.0 83
6 Recovery

6 Recovery
In the case of a recovery, the correct initial situation must be re-established for
the test cases. If the setting TestCaseStartScreen (see Tosca Commander™
Manual - Settings - Special Engines - SAPEngine) is set to SAP Easy Access, the
steering must first log on to the system to be able to execute the next test case.
For the login the following steps must be conducted:
 n Start the application SAP (see Tosca Commander™ Manual - Settings - Special
Engines - SAPEngine - SAP Logon Path)
 n Select the system (see Tosca Commander™ Manual - Settings - Special Engines
- SAPEngine - Recovery)
 n Specify SysID, Mandant, UserID and password (see Tosca Commander™
Manual - Settings - Special Engines - SAPEngine - Recovery)
This setting specifies which system must be selected. The Engine is able to
remember the system in which the last test case was executed (in the Buffer
under the key lastSAPSystem), but in SAP only the system ID can be read.
However, a system is accessed via the system name. Thus the setting System
offers the option to find a system name for a system ID.
The Engine is able to remember the system and client in which (in the Buffer
under the key lastSAPClient) and under which user (in the Buffer under the key
lastSAPUser) the last test case was executed, but the password of the current
logged-in user cannot be read from SAP. Thus it is necessary to provide a
password under the setting User for the Engine to log on to the client.
The passwords are stored unencrypted. This should not cause any problems, as
these are the passwords of test users.
Additionally, the last used language is stored in the Buffer under the key
lastSAPLanguage.

Exemplary script for a recovery case:

Sub Main(testAction)
' Helper for Recovery, if setting "Special Engines.SAPEngine.Startscreen
of Testcases" == SAP Easy Access
' (While recovering, SAP Engine has to log in into last used system/client
using last used test user)
' Keyword's module has to be from screentype "SAP"
' SAP Modules provide the settings object as global "oSAPSettings"
' 2 Systems available: 01 Tricentis (ID=T01, Client 200), 02 Tricentis
(ID=T02, Clients 100, 200)
' 2 Test user should be able to log in for all System's Clients: test01, test02

Version 8.3.0 84
6 Recovery

' First step: Register systems


' SetSystemName(ByVal sysID As String, ByVal longName As String)
oSAPSettings.SetSystemName "T01", "01 Tricentis"
oSAPSettings.SetSystemName "T02", "02 Tricentis"
' Second step: Register user passwords
' SetUserPassword(ByVal sysID As String, ByVal client As String, ByVal
user As String, ByVal pwd As String)
oSAPSettings.SetUserPassword "T01", "200", "test01", "securePwd01"
oSAPSettings.SetUserPassword "T02", "100", "test01", "securePwd01"
oSAPSettings.SetUserPassword "T02", "200", "test01", "securePwd01"
oSAPSettings.SetUserPassword "T01", "200", "test02", "securePwd02"
oSAPSettings.SetUserPassword "T02", "100", "test02", "securePwd02"
oSAPSettings.SetUserPassword "T02", "200", "test02", "securePwd02"
' If your test cases are only executed on specified systems/clients and only
uses specified users,
' SAP Recovery will always be able to resume test execution after an error
by
' logging in into the last used system/client using the last used test user
' Passwords will be saved in plain text in TOSCA's settings
End Sub

Version 8.3.0 85
7 Extension of the existing Engine

7 Extension of the existing Engine


Creation and integration of specific keywords

The creation and integration of specific keywords on the basis of a practical


example is described in the Base Engine Manual.

Engine objects in VB script

The SAP Engine offers the following objects for creating keywords with VBScript:

Name Type
oSAPProxy SAPEngine.clsSAPProxy
oSAPSettings SAPEngine.clsSAPSettings
Table 5: SAP objects

Access to initialized session in derived classes

The object oSAPProxy contains the initialized session which enables the SAP
application to be steered to be accessed. In order to ensure that derived classes
are able to use the available connection, an instance of the class clsSAPObjServer
must be created. The session, which has been initialized beforehand, can thus be
collected via the method GetServiceObject("SAPProxy").

Version 8.3.0 86