SAP Intelligent RPA – How to Capture SAP Logon and SAP GUI
For general information regarding SAP Intelligent RPA please read the blog “SAP Intelligent RPA – enablement and getting started” by Lena Grothaus.One of the first steps in SAP software automation is the logon to a SAP system. In this blog post I describe how to build a logon scenario using SAP GUI in SAP Intelligent RPA.
Step-by step instruction:
Create a new project in Desktop Studio
To create a new project goto File -> New Project or use Ctrl+N. A pop-up appears where you can maintain the new project. Fill the fields Project Name, Title and Client Name and klick on “Save” to save the project:
Activate SAP GUI connector
After the project is save goto File -> Edit Project. Klick in the pop-up on the index tab “Libraries” and scroll down. Enable SAP GUI Scripting and save the project.
Please check also if SAP GUI scripting is activated on client and server side. For the activation of SAP GUI Scripting please check out this Link.
Now you can start with the capturing of the screens. Therefor you open the SAP Logon application and launch the system where you want to login. The assumption is, that you have to use user and password to access the system.
Capturing and Declaration of the SAP Logon
To capture the “SAP Logon” you have to add an application. Therefor click on “+ Add Application”, select UIAutomation as technology, click on “SAP Logon 7xx” and “Save And Capture Page”. If no pages are visible please click on the refresh icon right to Applications.
On the next pop-up you can now capture the screen of the SAP Logon application.
The technology should be UIAutomation again. If no pages are visible please click on the refresh icon and choose “Window – SAP Logon” and klick “Save and Capture”.
After capturing an application, you need to set the criteria required for the software to recognise it.
The “Captured Data” tool window of the Explorer perspective panel shows the properties of the application that can be used as criteria.
These properties are collected when the application is first captured. What properties are captured depends on the application technology and corresponding connector: only properties used by the connector are captured correctly.
The Criteria tool window lets you edit the criteria of the application that will be used by the connector to recognise an application at runtime
In the next step you declare the SAP Logon page. As you can see in the upper left corner “pWindowsSAPLogon76” is marked in red. This shows that you have not assigned criteria which can used by the bot to recognise the page.
To declare the page you can us the captured data. In this case you make a double-klick on “Value = SAP Logon 760” and you can see the value in the criteria area. The status of the page changes to green.
Now you have to declare which system you want to use. To do this you have to click on the system name and a frame appears around the field with the system name. Again you have to select the recognition criteria in this case for the field. Please use “ControlType = Text” and “Value = SID”. with this criteria the bot can recognise the correct system even if more systems will added to the Logon Pad.
With this step you have finished the capturing and the declaration of the SAP Logon.
Capturing and Declaration of the SAP GUI
Now we you repeat the capturing and and declaration procedure for the SAP GUI page where you can enter user and password. The major change here is that you have to select “SAPGUI” in the Technology drop down list.
Click on “Save and Capture” and you can start with the declaration of the fields. In this example you will declare Client, User and Password.
First you have to declare the page “pSAP” as shown in the picture below.
Second you declare the fields on the page. Please use the criteria as as shown in the following pictures.
Now you have finished capturing and declaration.
Building the Workflow
A workflow refers to an automation sequence. It can describe the control of a single application or the coordination of several apps.
When you design a workflow, you describe the implementation of the automation sequence in functional terms:
The sequence of the screens and the actions to perform on each screen
The data to collect and return
The other actions to implement (manage files, data…)
For this purpose, the Desktop Workflow Designer provides:
The applications, pages and items declared in the Explorer perspective
A context structure for storing data
A set of functional activities (Get, Set, Click, and so on)
A generic comment activity for describing functional requirements
Now you can start to build the workflow. To do this click on the workflow icon to switch to the Desktop Workflow Designer and right mouse click on GLOBAL to create a new workflow.
The workflow you created is empty except the Start activity which is mandatory for all workflows. On the right side you see two important areas of the workflow perspective, the Properties and the Activities. To launch the SAP Logon application you search in the activities list for the application start activity.
You can use drag and drop to move the activity into the workflow. Then you draw a connection from the “Start” icon to the application “Start”. In the Properties” area you can choose the application and you can edit the display name and the description.
Next step in the workflow is to use the captured pages. Therefor you click in the “Activities” area on the right side on “Pages”. You can see now the two pages you have captured at the beginning. You can move the pages to the workflow with drag and drop and connect the pages as described above.
Now you have to define what you want to do on the different pages. Therefor double click on the SAP Logon page. On this page you want to mark the system in a first step and in a second step you have to click on the “Log on” button. With a right mouse click on the system you will open a context menu, please select “Click on the item” and select the right item in Properties area under Activity. Do it again with the “Log on” button.
Now the bot is enabled to open the Log in page of the system SX3.
To finalise the workflow double click on the Login page and maintain the sequences of the necessary steps which the bot should execute. You need five activities on this page:
- Wait until…
- Set value in the Client field
- Set value in the User filed
- Set value in the Password field
- Keystroke to execute “Enter”
For the first four steps you can click on the related field and use the context menu. In the Properties area maintain “Item” and “Source Data” with the values for the fields. The picture below shows the “Client” field as an example. With the first step “Wait until…” you ensure that the field is available when the bot starts to set the value to the fields on the page.
For the last step search in the activities for “Keystroke” and use the activity under “Page”. You can drag and drop the activity to the steps in the Activities pane left to the captured page.
Last step here is to maintain the properties. For the Keystroke you have to select the page and enter a Key Sequence “e.SAPScripting.key._Enter_”.
The bot is now ready to test.
Test the Scenario
After saving your project click on the “Build” icon to finally generate the code and build the executable scenario. After the build process is finished you can start the Debugger (F5).
The debugger will execute some steps and stops with the last message below. Now you have to use the Desktop Agent to start the scenario.
To open the Desktop Agent click on the Desktop Agent icon in the system tray and select “Test SAP_Logon”. The scenario will be executed and the bot log in to the system.
Now you are able to use SAP Intelligent RPA to start your automation journey. You learned to capture pages with different techniques (UIAutomation and SAPGUI connector), declare fields on the pages, use the Workflow perspective to design the process, use keystrokes, to start the debugger and execute the process with the Desktop Agent.
Blog Post overview