Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
peterengel
Advisor
Advisor
One of the major tasks in process automation with SAP Intelligent RPA is the capturing and declaration of pages and items. In this blog post I describe how to use the "MustExist Method" to recognise pages with the same criteria on page level.

Capturing the pages


For this blog post I captured the "Customer Line Item Browser". With this brwoser you can analyse customer accounts in your SAP system.



After the execution of the report you get an overview of the line items of a specific customer or a group of customers.



To capture the pages I used the SAPGUI technology. To declare the first page I use the Text = Customer Line Item Browser and Type = GuiMainWindow as criteria. The page wil now recognized.



On the second page I try the same, but the page will not be recognized:



Now I have to find a unique recognition criteria for each page. To solve this problem I use one of the advanced recognition capabilties.

Advanced Recognition Capibilities


If the screen that is to be controlled does not have unique, distinguishing properties, you can use an advanced declaration or recognition method. The available methods depend on the technology.

MustExist method


The MustExist method is available in all technologies. It consists in detecting one or more components that are present in the screen to be controlled but not in any other. These components are declared as items on the page and their MustExist parameter is set.


Using this method, a screen is recognized as a page if:





  • The screen matches the page criteria




  • All MustExist items are found on the screen




MustNotExist


The MustNotExist method is only available for the WEB and UI Automation technologies. It consist in detecting one or more components that are not present in the screen to be controlled but are present in others: These components are declared as items on the page and their MustNotExist parameter is set.


Using this method, a screen is not recognized as a page if one of its MustNotExist items is found on the screen. To declare a MustNotExist item on a page:





  • Add to the page a capture containing the component to be declared




  • Declare the item from this capture and set its MustNotExist parameter





Root Item method


The Root Item method is available for UI Automation and the SAPGUI connector. It is used to declare subpages as follows:


  • In the parent page, declare an item that targets the desired root component




  • Set this item as root item in the subpage parameters





This method allows you to use advanced item declaration methods to target the root component.






Ancestor method


The Ancestor method searches upwards in the hierarchy to find an ancestor component with a set of properties that make it unique. This ancestor component can't be part of an ascending hierarchy that is incorrectly recognized. With this method, you need to:





  • Declare an item that targets this ancestor component




  • Set this item as an ancestor of your item when you set item parameters




The target component will be searched in the descendance of the ancestor component.


Consider this use case:


In the following DOM, you want to target second leafnode (in orange):






The two leafnodes are the same, so, if you don’t use the Ancestor method, the first leafnode will always be recognized, not the second. You cannot use node (id=1) as ancestor, because it is ancestor of both of the leafnodes and the first leafnode will be recognized. So I must use subnode (id=3) as ancestor so that the second leafnode is recognized.








Labelled By Method




The Labelled by method consists in finding another component:


  • That is at a fixed distance (CX,CY) from the targeted component




  • That has unique, distinguishing properties




This component is typically a label component located near the target component. But it can be any other component, anywhere on the screen. With this method, you need to:





  • Declare an item that targets this label component




  • Set this item as Labelled by when you set item parameters (see Item Definition).




Desktop Studio stores as a criterion the distance between the targeted component and the label component. This distance is calculated in a unit independent of the screen resolution. The target component will be searched for between the components located at this stored distance from the label component.






 Items Pattern method


The Items Pattern method consists in recognizing a set (pattern) of related components, rather than a single component. These components must be linked together by a parent-child relationship. One of these components is the target and will be addressed in the SAP Intelligent RPA project.


This method is useful when the target component has no (or insufficient) unique, distinguishing properties. The order in which pages are declared is significant. When the connector detects the opening of a screen, it searches for the first declared page whose criteria match. If you need to declare a generic page with broad criteria, you must declare it after declaring the rest of the pages. This ensures that screens are correctly recognized as generic pages.






Use of the "MustExist Method" to get an unique identifier


In my case I use the "MustExist Method" to get an unique identifier. To use this method I have to identify one item on each page which is not available on the other page. On the first page I select the item "Save as Variant.." In the properties of the item I set the "Must Exist" flag.



If I now switch to the second page the recognition status of the page switches to green.



Both pages have now an unique identifier and can be recognized by the system during the execution of the bot.

Conclusion


You learned which Advanced Recognition Capabilities exist and how to use the MustExist method and you are now able to capture and declare every page with SAP Intelligent RPA.

Blog Post overview













1.

SAP Intelligent RPA - How to Capture SAP Logon and SAP GUI



2.



SAP Intelligent RPA – Advanced Recognition Capability “MustExist Method”




17 Comments