SAP Intelligent Robotic Process Automation 2.0: SAP GUI Table Control (1/2)
In this blog post you will learn how to fill data in a table based on SAP GUI Table Control. These controls are used in transactions like ‘Create Sales Order’ or ‘Create Purchase Order’. I will show you to capture such a page and which items you have to declare.
The final automation will use data which I get from an Excel file with the activity ‘Excel Cloud Link’. In another blog post I will describe how to the activity with dynamic Excel sheets.
To learn how to extract data from a GUI table control read this blog post SAP Intelligent Robotic Process Automation 2.0: SAP GUI Table Control (2/2)
This blog post is based on the 2103 release of SAP Intelligent RPA.
Capture the Screen
To build the example we capture the screen ‘Create Standard Order: Overview’.
To execute the following activities on this screen we declare the elements Sold-to-Party, Reference, Material, Quantity, Enter button and the Save button.
We set the the header data Sold-to-Party and Reference, then we have a loop on the output parameter of the ‘Excel Cloud Link’ setting the Material ID and the Quantity. In the next step we click on the Enter button followed by a wait for the table control and a ‘Scroll Down’ by one row.
After we have used each row of the Excel sheet we save the sales order, get the status from the status bar and show this status in the log.
To declare an element we click on the field, give the element a name and click on the button ‘Declare Element’.
The ‘For each’ Loop
Important in this use case is the loop parameter ‘currentMember’ which contains the content of actual row. This parameter will be used define the input value for the set activity. To create this expression we use the expression editor.
As we work on a table the target definition of the activity contains also an index which we set to 0 as the index in the SAP GUI table control starts with 0.
Now you can ask why do we set a fix index as we expect to work with more than one position? The answer is simple and based on the behaviour of the SAP system itself. We do not know how many rows are visible in the table control. With fullscreen mode and my desktop resolution I get 13 rows. If I have more than 13 positions I have to add rows which results in an index which starts with 0 again and we cannot use the loop index from the ‘For each’ control to define the row in the table.
To overcome this issue we click the enter button after filling the data for each position and use the scroll down activity to scroll down one row. With this action every position will be filled in a table row with the index 0. The target parameter of the scroll down activity is the complete table.
Now we have learned how to insert data in a SAP GUI table control without knowing how many rows we will have. This example will be useful in many scenarios we have when we implement automations with SAP Intelligent RPA.