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: 
marcin_jakubik
Advisor
Advisor
Business Activity Monitoring, aka BAM, is a great way to pass information from your bot to the Intelligent RPA Factory and then create custom reports.

For example, when you run bots using Intelligent RPA, you automatically get information on the number of jobs that are running, or the status of connected agents. But this is all administrative information. If you want business information, ie. the data about what your bots are actually doing, you need BAM!

BAM examples:

  • I want to measure how long my bots spend scanning email.

  • I want to know how often my bots spend using a certain page in a certain application, like creating purchase orders.

  • Or, I want to know how many purchase requests were accepted as a percentage total.


These are all custom requests that you can answer using the BAM feature of Intelligent RPA.

To use BAM


To use BAM you need to add an activation statement in your code, and then add a BAM statement whenever you want to measure something.

  • Click File > Edit Project, then on the Library tab, select the library called Monitor.

  • Then add the following lines to your bot script:
    // 1. activates business activity monitoring (BAM)
    ctx.monitor.startLocalCacheParsing(ctx.monitor.DelayType.LocalCacheParseVeryShortDelay);

    // 2. starts a timer with ID "MyBot"
    ctx.monitor.initProcessNotification("MyBot", "Bot Started", 5000, 15000);

    // 3. measures the timer called "MyBot"
    ctx.monitor.sendProcessNotification("MyBot", "Step 1", "OK", "Step 1 complete");​


  • Copy and paste line 1 in to the Global.events.start.on function in the Script editor.

  • Add line 2 in your script where you want to start a timer.

  • Add line 3 to measure the timer later on.


That's it. Now when your Bot reaches the Step 1 complete command, Intelligent RPA will record how long your Bot took between the two steps.



Measuring again


You'll probably want to measure more than one step. In that case, just insert more sendProcessNotification commands and the Bot will record how long it takes to get to each one.
ctx.monitor.sendProcessNotification("MyBot", "Step 2", "OK", "MyBot Step 2 complete");
ctx.monitor.sendProcessNotification("MyBot", "Step 3", "OK", "MyBot Step 3 complete");
ctx.monitor.sendProcessNotification("MyBot", "Step 4", "OK", "MyBot Step 4 complete");
// ...

As long as the first parameter (here "MyBot") is the same as one in the initProcessNotification command, your Bot will count the time it took to get to each statement.

In this way, you can insert timers to check how long any tasks takes your Bot to do. Or you can time how long it spends on a certain screen, or in a certain application, etc.

What you get


At the end of your Bot's run, you'll get a report in Intelligent RPA Factory with all of the measurements from all the Bots.

In the Factory, go to Monitoring > Export, select Business Activity Data and click Download CSV.

This report is conveniently available in CSV format that you can open in Excel and filter, build graphs on or otherwise analyze.

Example


Here is an example of a report that you could get from a Bot, timing the various steps it made in an automated Shopping Cart scenario.



Going further


There are other commands available in BAM, including counters and simple messages. Both of these may be useful depending on what kind of information you want to report on in your business case.

References


Read about BAM in detail in the official Intelligent RPA documentation:
2 Comments