Categories

SAP

SAP: a functional tool

What is SAP?

SAP (Systems, Applications and Products) is one of the world's leading producers of software for business process management, by developing solutions that facilitate the efficient processing of data and the flow of information in organizations.

SAP is used as a data manager. It is an independent tool from Agilitest allowing to create programs through modules.

You can consult the SAP documentation directly on the SAP website.

SAP integration with Agilitest allows you to create and maintain complex tests with a functional approach. SAP GUI tests can be used to manage the modification or development of business rules, or the updating of ERP system functionality.

📙 To know more
architecture beteen ats and sap scheme
SAP is an independent tool from Agilitest. To establish a connection with this tool, a system driver is used to send the elements to the SAP driver. Once the link is established, a connection to the SAP server will be made through the SAP GUI protocol.

How to connect to a SAP server?

▶️ You can find a tutorial on how to connect to a SAP server on our Youtube channel

To use SAP you need to install a client: the SAP Logon. This client will allow you to interact with the SAP server. A connection is declared in this client with the elements transmitted by the SAP administrator, notably the target server.

SAP logon

To connect to an SAP server, the operation is the same as for any other application tested on Agilitest.

So start by a “Start channel” action

start channel action

Then select the SAP shortcut to set the channel from the drop-down menu in the input bar.

application shortcuts menu

Enter the details of the SAP server, present in the SAP log on, i.e. the name of the connection, the customer number (i.e. the associated mandate number) and possibly the language (EN/FR/...).

Then click on "Activate 'Basic authorization" to enter your login details: username + password.

SAP shortcut

💡 Tip

To prevent your password from appearing in the test, consider creating an encrypted password from the project properties menu.

To start the connection in English, in the logon part you can change the language by adding "/EN" at the end of the id.

SAP english connection

During the execution the connection is done automatically. Once connected, the driver takes over the open SAP window on the SAP home page.

🔸 Warning

:” is also a possible separator in the connection chain to an SAP channel.

Example: connection_name:customer_number:language

Session saved in the ATS properties

As a reminder it is also possible to configure commonly used applications to appear directly in the applications panel in the channel opening action. This is also possible for the sessions you have access to, including SAP sessions.

This shortcut allows you to avoid sharing information related to the connection to an SAP server (id, passwords) if you want to work on an SAP test on several workstations.

To use this shortcut, you need to modify the ATS properties.

To access the ATS properties, go to the "Settings" menu in Agilitest.

Settings button

Then click on “Edit configuration” in the ATS settings

Edit configuration button

This will open the ATS properties page where you can configure various elements.

ats properties

Below is an example of a possible configuration for an SAP session:

📙 SAP Configuration

<sap>

<timeOut>200</timeOut>

<sessions>

<session>

<name>MySAP</name>

<client>800</client>

<connection>(Logon_id)</connection>

<authentication>(Code_source_ATS)</authentication>

</session>

Authentication can be found in the ATS code of your script with an SAP connection.

To access it, open your script and click on the “Script header data.

Script header data button

Then click on “Code ATS”

code ats button

This displays all the actions of the script in code form.

To fill in the connection information in the properties, recover the code string data corresponding to the SAP server connection from the "start a channel" action.

ats code info

Copy the connection information in the ATS properties.

ats properties

Once you have entered the information, save your file and return to the Agilitest applications menu where you will find the session you have entered.

SAP application

SAP interface

Once SAP is open, just like a test on the Web, you can capture the elements with the capture tool to be able to test them.

capture in SAP

The SAP home screen displays the modules, or transactions, available to users.

sap modules

These modules correspond to programs that allow you to manage different business aspects, such as inventory management or HR information.

You will be able to choose among various possible interfaces according to the screens that were made available to you when you created your account.

SAP screens

The accessibility of these screens is decided according to the role occupied in the company and its needs in data management.

The SAP modules allow for the management of numerous business aspects such as finance, sales, production, logistics, distribution, accounting and human resources. Since SAP manages an information system that by its very nature is subject to change, it is important to regularly perform functional unit tests in your QA process to ensure that all these processes continually deliver the expected results.

Example: SAP offers an HRIS solution that automates business HR operations, but also provides experiences that drive employee engagement and productivity. SAP's HRIS core focuses include employee experience management, core HR and payroll functions, talent management and HR analytics.

Tests on SAP

Switching windows

In some cases, the module opens in a new SAP window. To manage this notion of window, you will have to change the window from Agilitest.

To do this, click on the window action.

Window action

Then switch to the window with index 1 (the main window is index 0).

indexes in switch window action

Actions on a table

Once you have your table open in the SAP interface, open your capture tool to perform actions on it.

When capturing you will need to define a Locator, which is a set of attributes that identify the captured item.

Among the parent branches of the element you will generally find: the object (Example: "TableControl", "GridControl", "TreeControl"), the Rows, the Columns.

Captured element's parents

Several table cases are possible:

  • Searching for an element of a table that appears directly on the interface

Example : A table with few lines.

When we capture an element on the screen, the search of the element with the locator will be less accurate.

The search can be done according to the "Text" attribute of the captured element and the ElementId of the "TableControl" branch.

Table elements

Once the attributes are selected, drag the element into the Agilitest editor to create an action.

click action

This type of search will not search for a row but will simply stay on the same screen.

  • Searching for a table element in a long list

When you want to capture an element from a long list that requires Agilitest to browse the elements, then you must specify it with attributes.

This time you have to tell it that the element is in a "Row

Table elements

Drag the element into an action

Click action

A search in a row is done according to the text in it. Agilitest will browse the rows of the table to find the row with the text entered as an attribute.

💡 Tip

To simplify the operations it is recommended to change the text into a regular expression.

Actions on Grids

It is possible to switch a table to Grid by pressing the F8 key and specifying the number of lines you want to appear in the "Maximum number of hits" box.

change table to grids

With the grids it will display more information that can be read vertically and horizontally.

grids

The capture of an element takes place in the same way as for tables, only the display of the parents of the captured elements will specify that they are grids.

Grids elements

Grids are a set of data organized in rows and columns.

It is also possible to search for the presence of an element in various rows using "Row".

To do this, you need to create a sub-script with runtime log comments to display the items found.

subscript action

Example: If we search for the text "MIERZWA" in all rows using the text property of the "GridRow" branch, then your subscript will display the rows that include this text.

In this example, 5 iterations are displayed, so MIERZWA appears 5 times in the rows. The parameters will indicate the exact location, such as the line "1014". (see screenshot below)

subscript execution parameters

With this action each row is passed to the script and each column represents a parameter.

ats code parameters

Actions on data trees

The data tree is sometimes composed in a simple configuration with a single column that includes several levels and other times in a more complex way, with several columns in the same tree. The execution of tests on trees is similar to those on grids and tables.

The search elements of a component are similar to those of grids and tables.

trees elements

The "TreeNode" branch will represent the nodes of the tree, i.e. the different levels that appear.

Each node has zero or n children that can be deployed.

Tree nodes

Example: The "Basic Data" element has 3 children, while its children have none.

When a tree is complex, a node can have several columns.

As with grids, the tree is configured with rows that will concatenate all columns in the row.

This means that the search for elements of a tree structure is mainly done through the "Row" branch.

Tree row branch

Activating Scripting SAP

There are two things to do to activate scripting, first on the server side and then on the client side.

Server side in SAP

RZ11 transaction:

Enter the “sapgui/user_scripting” parameter

Click on ”Display”.

When the following screen appears, click on “Modif. Val.

Then enter “TRUE” to activate the scripting.

Normally, this operation does not require the instance to be restarted.

Finally, click on the save button.

Customer side, on the SAPGUI

This configuration is necessary to avoid popups at each launch.

Click on the “Options” menu

Then in “Script support”, check “Enable script support”.

VBscript

SAP recorder in SAP

One of the features offered by SAP is the use of a recorder. Once activated, this function records the actions performed on SAP and then translates them into vbscript.

To launch the capture directly in SAP, go to the options from the drop-down menu: Plus > SAP GUI Options and Actions > Record and Playback Script

sap recorder

This will show you a launch pop-up.

recorder pop-up

Click on the "record" button to start the recording

record button

Once this is done, perform your manipulations and then click on the "stop" button to end the recording.

stop button

Once the capture is finished, a page with all your actions in vbscript format will open automatically.

vbscript

To replay this script, click on the "play" button.

This will open your Windows Explorer and the folder containing your script.

script in windows explorer

By clicking on the script it will perform again the actions that were executed directly on SAP.

To use the vbscript data in Agilitest you have to look at the last lines of your script.

vbscript actions

Scripting action in Agilitest

From Agilitest, you can also create actions in vbscript format and interact with SAP.

Two ways are possible:

  1. Either by using the script lines of the vbscript.

To do this, copt a script line from your vbscript that you want to transform into an action.

line in vbscript

Then click on the “Scripting” action

scripting action

There is no need to specify an interface element.

no element

Click directly on the "Scripting" action and paste the script line

enter text in scripting action

         2. Either by manually creating vbscript actions using the properties

Click on the "Scripting" action.

scripting action

Add an interface element and enter a value that will act on this element

interface element in scripting action

Example : Above, the interface element corresponds to an element in which text can be entered, with the "text" property of this element set to "MIGO".

When the action is executed, this translates into the text MIGO in the text entry on SAP.

"migo" entered in text bar

The difference between these two manipulations is that by passing through a line of code of the vbscirpt the access to the object is done by its id, while by passing through an Agilitest action, the access to the object is done by its properties.

SAP Recorder with Agilitest

Agilitest lets you use a Recorder for your SAP actions.

Once the SAP channel has been started, you can activate the Recorder.

Click on the button in the channel management menu to launch the Recorder.

record button, red

The button is red when deactivated, and green when activated.

Then perform your actions directly on SAP: text entry, clicks, etc... All of this will be translated into action in the Agilitest editor.

By default, the object selection criterion is "ElementId". To maintain Agilitest's flexibility, you can modify the attributes assigned to each action to suit your needs.

🔸 Warning

All text input actions must be validated by pressing the "ENTER" key at the end of the input.

You can also generate verification actions.

For this purpose, a keyboard command has been set up to create verification actions in the Agilitest editor:

  • Press ALT+F1 to create a property verification action
  • Press ALT+F2 to create an occurrence verification action
  • Press ALT+F3 to perform a property action

These three commands are independent of the Recorder, and can be performed without it being activated while doing a SAP test.

To stop the recorder button, click again in the channel management menu.

record button, green

Still require support?
Contact support