Workflows involving SAP operations fall into their own category of automation processes, as they involve the use of common reusable components. It is recommended to automate the SAP login process and break it down into two workflows:
- One that opens the SAP GUI and selects the server connection by using the Open Application and Click activities.
- One which regards the SAP login, includes Type Into activities to write in the username and credentials for the server connection, and a Click activity to select the login button.
SAP operations often involve populating a high number of rows in SAP tables, which can be done by taking the information from a newline-separated string and pasting it all at once in the SAP table. However, this approach is only applicable to the visible rows on the screen. The dynamic solution to populating all the rows in the table, including the ones that aren’t visible, is to use an If activity that would take the SAP Table Id as input and increase the
rowCount until the element no longer exists. The activity counts the number of rows visible at once in the SAP GUI, adds the data from a string to the visible rows and uses the PageDown hotkey to get a new batch of empty rows to fill in the table.
Rows count is dependent on the size of the SAP window, so it’s recommended to maximize it from the beginning.
Other commonly used SAP automation workflows include the posting of payments from different SAP screens, login and data migration from SAP to other business software applications, searching and extracting specific information from SAP, or generating reports and spreadsheets.
Frequently, when creating SAP workflows, the need to identify and work with various UI elements arises. Most of the SAP GUI Elements allow for API interaction, meaning that Simulate Click and Simulate Type input methods may be used for entering data.
In some cases, the Simulate Type input method does not work if the text box doesn’t support a higher number of characters. As a result, an error is thrown. To avoid this, text should be truncated when it is too long.
The Double Click activity can be used for navigating through branches in SAP, but it does not work if the Simulate Click method is enabled. One workaround is using the Double Click activity with the default Hardware Events settings or to check for another way of performing the same action, using a regular click on the element correlated with an anchor. One good practice is to use buttons instead of hotkeys to navigate, especially in menus.
In some cases, tables aren’t fully loaded from the SAP server, which means that only a number of lines can be scraped from the screen. One good approach is to extract data in a loop together with sending page-down to the table until the currently scraped information is the same as before.
When dealing with table rows and columns, infinite loops in a Try Catch activity are recommended, especially when trying to read a table with an unknown number of rows. Read each row in an infinite loop until the operation fails and the Try Catch throws an error set in the workflow.
For reading special elements, use the Get Attribute activity, which shows hidden information.
Since some SAP automations require the Robot to go through multiple server connections, it is recommended to use the SAP page title to verify that the Robot landed on the desired page during a particular workflow.
Moreover, SAP messages from the status bar are a good source of information in case of warnings, when the workflow cannot be continued. In some cases, SAP-generated warnings may be removed by clicking on the Enter button.
Another good practice recommendation is to use the SAP login reusable component at each transaction to prevent memory leaks or catching issues that can make SAP crash.
In some cases, the SAP GUI may freeze when communicating with the server, which in turn, causes the Robot to freeze as well. Therefore, all interactions with SAP should be timeboxed and put in a Parallel activity, that has a delay with the expected running time and an action like closing the SAP process.
Throwing an exception instead of killing the SAP GUI generally doesn’t work, as the activity may freeze as well and wait for the SAP action to finish before being able to throw the exception.