Skip to Content
Technical Articles

SAP Intelligent RPA – Advanced Recognition Capability “MustExist Method”

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”

16 Comments
You must be Logged on to comment or reply to a post.
  • Hi Peter

    I used the MustExist method to recognise pages with the same criteria on page level, but still could not identify the second page。please help us to solve this issue.


    Best regards,
    Edwards

    • Hi Edwards,

      the field "Amount" is not unique. You have to select a filed which appears either on the first or on the second page but not on both. Mark for example the field "Quantity" on the first page as must exist.

      Br,

      Peter

  • hi Peter,

    i set field:"Business Partner Created As" as  MustExist on the page of WB01Sec but the second page: WB01Thi  still is red,is there any false step i did ? can you pls help me to correct it? thanks

     

     

     

     

  • Hi,  Peter

    I have a question regarding the capture of a web page, which does not allow capturing the options.

    The page was declared Web

    What may be happening. ?
    There is any limitation or any requirement that the WEB pages must have ?

    I add an image

     

     

    does not allow you to select any option.

    Take the full frame.

     

    Best regards.

    Ricardo

     

     

    /
  • Hi, Peter! Thank you for this cool blog post!

    But i have some issue with “Must Exist” option.I appreciate if anyone can help. (Use UIautomation technology)

    1. Add first page
    2. Add second page with the same captured data
    3. Add unique item for first page  – it is green now
    4. Click on second page and expect that page become green, but error appear  (Criteria for first and second page are the same)

  • Hi Peter

    Thanks for the informative blog. Are all these methods available in the Cloud Studio?

     

    I have been trying to use the Must Exist Method in SAP GUI 760 and Cloud Studio without any luck.

    The idea is to try and create a user automatically. I thought this would be an easy demo to show to others. 🙂

    The Maintain Users screen contain different Tabs Address, Logon Data etc etc.

    I declare 2 screens(tabs), Address, Logon Data, not yet the Roles tab.

    I declare my required elements on the 2 screens and Save.

    The Address screen gets the green tick. The Logon Data screen gets the red x.

     

    Thinking it is unique:

    I declare the "Function" GuiLabel in the Address screen - Set to Must Exist

    I declare the "New Password" GuiLabel in the Logon Data screen - Set to Must Exist

    The Logon Data screen gets the green tick. Until I save my application, then it goes red x again.

     

    Probably just me not understanding the concept of the Must Exist method and maybe how DOMs work.

     

    • Hi Werner,

      try the following in the Cloud Studio:

      Goto the application area, under Declared Application click on the first Maintain User screen, click on the three dots behind the screen and select 'AddCapture to Current Screen'. Repeat this for each tab and delete all other screens.

      You get different capture for the same screen named capture, capture1 etc.

      You can use this different screens in the Automations e.g. with the set activity and move between the screens by clicking on the tab. The system should recognise on which tab you are.

      No must exist needed.

      I think this should work.

      Br,

      Peter

      • Hi Peter

        🙂 🙂 🙂

        Thank you very much. Yes it did work. I am now able to click between the diff. tabs. I actually tried the Multi Capture before but could not get it working for some reason. Maybe I was to hasty.  Doesn’t matter. it is working now. Without “Must Exist” of course.

        I also found your Answer to someone else regarding the GUI Grid View, so that enabled me to Get the column keys and I could add an authorization role in the Roles tab and pane with set Cell Value.

        For the initial password I added an input parameter type Password. When I test the automation it requests the initial password at start.

        Next up is getting the ComboBox working for the Title of the user then maybe reading multiple user data from a spreadsheet and creating the list of users.

        Thanks again for your quick advise.

        Werner

        Almost forgot. I couldn't get the Save button working. It is recognized during testing but click or mouse click does not work on the Save button. Used the Keystroke on screen _Ctrl_S_ as a workaround.

         

  • Thank you, Peter!

    This was nice, but Root and ancestor topics are not clear to me. And what is Set_as_reference_item?

    How ancestor is different from Pattern? How Ancestor is done, with what menu_items?