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: 
Jerome
Advisor
Advisor
Since the release of the 2112 version of SAP Intelligent RPA, a bunch of new activities came out. And in today's blog post, I want to talk about some of them which are designed to help you handle some specific situations.

In the What's New page of the core SDK in our documentation, we find the following :



What does this mean ? First, let's see what can be these specific situations I was referring to.


Let's assume that I am working on my favorite application for my daily tasks. And I'm lucky, because I have a bot to help me do the huge amount of tedious & repetitive tasks. But I cannot have a bot do all my job, some of my tasks are quite specific and cannot be automated.

So we have the following situation:

  1. I am working on my favorite application

  2. My bot needs to launch my favorite application as well to perform its tasks

  3. I do not want my bot to interfere with my current tasks


Now the question is : How can I make sure that the bot will not use MY application to do ITS job?

 

How does it work ?


To understand what we are going to achieve here, let me give you some details about the way it works internally.

First, we have the following:


This is what a human sees: multiple windows of the same application. The content of the window might be different, but it's not my point. My point is that, from a human perspective, there is literally nothing in the application that could help us know the differences between them. So (and I know you have probably already done that) you re-order the windows according to their use. Ex:

Your first tab in Chrome/Edge is meant to perform task A. The second tab is meant to perform task B. Etc.

The bot works in a similar way:


We have an array, where each element of this array is an identifier of one instance of the application. So in fine we can know the identifier of the first tab in Chrome/Edge, etc.

Important note: There is no way to reorder items in the array. Each time a new instance is created, an item is added in the array. When the application is closed, the item is removed from the array (and so, the position of all the following items in the array change!)

Another extremely Important note: By default, the bot always pilots the last item in the array. In other words, the bot will always work with the latest application that was opened.

 

How to use it ?


Multiple instances running at the same time


Let's assume we are working with a web application. In our automation, with the activity Start Screen come the following parameters:


The one I want to talk to you about is bEvenIfExist:

  • when set to false (default value), the agent will NOT open a new tab if the application is identified in an already opened tab

  • when set to true, the agent will open the application in a new tab (it will be a new instance), no matter what.


Note: this parameter also exists for the activity Start Application which can be used for UI Automation application.

Identify the instances


If you have an instance of the application already running before the execution of the Start Screen activity, you will end up with 2 instances.

Yeah ok. 1+1=2, thanks for the lesson, genius


Hold on, now comes the fun part. In the list of available activities, let's look for the word "instance". Here is what we find:


Get Application Instance Count returns the length of the array I was referring to.

Get Application Instance (Index) returns the identifier at the position set as input parameter (the index)

Select Application Instance allows you to select the instance of the application the bot will work with.

Is that right?


If you do not trust me, have a look at the documentation (here, here and there)!

 

So if the bot starts a new instance of the application, its identifier will obviously be the last item in the array. And by selecting the application instance using that identifier, your bot will not interfere with the instance of the application you were working with. Got it? Here is what we should have to be sure the bot works with the latest instance:















Get Application Count



Get Application Instance (Index):



Select application Instance:


Remember ! In an array (or list, or collection), the index starts with value 0. So if n is the length of the array, the last item position is n-1.

 

By default, if you decide not to handle any of this, the bot will deal with the latest item in the array. That's to say, the latest instance that was opened.

So let's imagine the following situation (and as an image is worth a thousand words...):


If the user opens a new instance of the application during the wait, the second time the bot will write some value, it will be in the latest instance, i.e. the one that was just opened by the user. In other words: for each action that is performed, the bot will select the last instance and execute the action in it.

 

Some examples


One application is already opened, the bot starts a new one


In this case, the bot will focus on the latest instance, that is to say the one opened by it. But we recommend to get the instance identifier, just to make sure you'll be able to retrieve this info if other instances are created for some reason.

Two applications are already opened, the bot uses one


The bot will use the latest that was opened. See use case above, at it is the exact same one.

The bot needs to pilot two different instances at the same time


For this case, I'd recommend to get the identifier for each instance, at the beginning of the automation. Provide some useful name for these variables as they will be reused. And when I need to switch from one application to the other, I would use the activity Select Application Instance and provide the needed variable as input parameter.








 

Conclusion


So what do we have?

We have a way to identify instances of an opened application. We have a way to retrieve the identifier of these instances. And we have a way to make the bot work with these specific instances.

What do you NOT have?

You have no more excuse to make the bot interfere with the application YOU were working with.

Last, there is a dedicated video about this topic : check it out ! Also, a sample in the Learning catalog of the Bot Store should come very soon. Stay tuned!

 

Find more information on SAP Intelligent RPA:


Exchange knowledge: SAP Community | Q&A | Blog

Learn more: Webinars | Help Portal | openSAP

Explore: Product Information | Successful Use Cases

Try SAP Intelligent RPA for Free: Trial Version | Pre-built Bots

Follow us on: LinkedInTwitter and YouTube