Technical Articles
Automating SAP GUI screens with low hierachies
Introduction & Problem Description
In this blog post, we will address the problem of automating SAP GUI screens with low hierarchies. Sometimes, when we automate applications like SAP ERP, we will face tables that look like the one in the picture below (transaction SM37):
Table with low hierarchy
At the first glance, this looks like a table that is easily automated with SAP Intelligent Robotic Process Automation like a GUI Table Control or a GUI Ctrl Grid View. However, when we capture the page, we can already spot part of the problem.
Capture of the page in the Cloud Studio
Capture of the page in the Desktop Studio
As visible in the screenshots, we have a huge amount of GuiLabel elements. The table you can see on the screen consists of these elements. When we want to read one of the columns and capture the element with occurs, we can see that we require a lot of tests to recognize the elements.
Huge amount of tests when capturing columns of the table
This huge amount of tests (222 tests for 8 lines) can lead to a bad performance during the bot execution, especially when the table has more entries.
Solution
To avoid this, we can use a different technique that does not require to read the table in SAP. Instead, we will read the table in Excel. To export the table in Excel, we have to press Shift+F4 and click through two pop ups.
To automate the process, we first capture the two pop ups. For the second pop up, it is important to know that depending on whether the user or a script is accessing a page, the pop up differs. To capture the pop up that is called when the script is executing, just start a script recording on SAP GUI before opening it.
The first pop up for the export
The second pop up for the export
Automation in the Desktop Studio
The automation in the Desktop Studio looks like this:
The overall flow in the Desktop Studio
In the first step, we execute the keystroke on the page Job Overview.
Implementation of the keystroke in the Desktop Studio
Then, the first pop up opens and we click on “Continue”.
Click on Continue in the first pop up in the Desktop Studio
Next, we wait until the next pop up is accessible and then we click on “Replace”.
Click on Replace in the second pop up in the Desktop Studio
As a result, the table is opened and saved in a Excel File.
The result in Excel
Automation in the Cloud Studio
The automation in the Cloud Studio looks similar to the one in the Desktop Studio.
The whole flow in the Cloud Studio
In the first step, we execute the keystroke on the page Job Overview.
The keystroke in the Cloud Studio
Then, the first pop up opens and we click on “Continue”.
Click on Continue in the first pop up
Next, we wait until the next pop up is accessible and then we click on “Replace”.
Wait for Replace and click on it
As a result, the table is opened and saved in a Excel File.
Conclusion
Automating SAP GUI screens with low hierarchies can be quite challenging when it comes to performance optimization. Usually, to optimize the performance, the recognition of the elements has to be improved. Unfortunately, with the structure of the table, this is not possible in the capturing process. In this blog post, we showed that it is possible in both the Desktop and the Cloud Studio when we use a small workaround with Excel.
Very good trick, well done!