Skip to Content
Technical Articles

Build a Robotic Smart Analytic Application in SAP Analytics Cloud

Normally, people think that an analytic app can only run at the frontend. However, this is not the case. In this blog post, I am going to showcase an example regarding an application that was built by SAP Analytics Cloud and runs as a scheduled job at the backend. This application runs as a robot for 7×24 hours to monitor the business, trigger alerts based upon exceptions, generate actionable proposals, and automatically execute transactions when the criteria of the business rules are met. My hope is that this example inspires you when you have similar use cases.

To begin, let’s first look at the demo:

DEMO SUMMARY

In this demo, the application is scheduled to run at the backend. The application monitors the prices of raw materials for a small bakery, which has 4 products and 6 variations of raw materials. The application will send out an alert when the rise of material price severely impacts the margin. Automatically, the application will generate two proposals to maximize the margin and stay within the production capability (4900 minutes) constraint:

  1. To change the vendors for raw materials
  2. To change the production plan and adjust the number of product pieces

In the demo, I wrote a simplified algorithm: proposal 1 picks the materials vendors that offer lowest prices, proposal 2 keeps vendors stable because you may have long contracts with them but adjust the production plan to gain biggest margin. In a real-world scenario, surely you need to consider more factors affecting a business and you can rely on experiences, smart predict features, and machine learning to create the best strategy.

In the meantime, two separate SAP Analytics Cloud Planning versions for production plan and purchase plan are automatically created for each proposal. The business user can either decide to:

  • Set a business rule for the robot to select one proposal and run it automatically
  • Manually pick one of the proposals
  • Perform a what-if simulation by adding new business constrains

Regardless of which approach the user selects, the production and purchase plan will be updated.

Although it is not shown in the demo, in a real-world scenario, the purchase order can be directly created via an OData connection to the transactional system or via a custom widget using SAP API Business Hub (see blog post https://blogs.sap.com/2021/02/04/quickly-integrate-sap-analytics-cloud-with-other-systems-using-custom-widgets). This is an automatic, closed-loop business scenario.

IMPORTANT FEATURES USED IN THIS DEMO

1. SCHEDULE PUBLICATION FOR AN ANALYTIC APPLICATION 

You can schedule a publication for publishing and distributing analytic application views via email in a PDF format at a predefined time or frequency.

 

2. NOTIFICATION API

The notification API sends notifications to the application consumers in Notifications Panel and through email, mobile notification as well. While the scheduled job runs, you want to be notified once a certain business rule is met, like the quantity sold of a particular product is below 50M.

Notification Panel:

E-Mail:

 

THE NOTIFICATION PANEL INCLUDES:
  • Title
  • Body content (support common HTML format like i/b/u, a, br, hyperlink)
  • Action button to open the Application
THE APPLICATION DEVELOPER CAN ALSO CONFIGURE:
  • Recipients (with the support of value helper)
  • View mode of the application at run time
  • URL parameters in key-value pairs
  • Send email or not
  • Send the notification to SAP Analytics Cloud’s iOS Mobile App or not

The API is defined as below:

 
enum ApplicationMode {
 Present,
 Embed,
NotificationOptions {
title: string,
content?: string,
receivers?: string[], // default: current application user
mode?: ApplicationMode,          // default: Present
parameters?: UrlParameter[],     // array, no optional single URL parameter
isSendEmail?: boolean,            // default: false
IsSendMobileNotification?: boolean // default: false
}
Application.sendNotification(notification: NotificationOptions): boolean

Sample use case:

/*
*/
 Example: Will send both notification and e-mail to user (Jack).
 Notification title is 'notification title'. Notification content is "notification
 content".
 var param1 = UrlParameter.create("bookmarkId", "17889112-4619-4801-8954-
 637818290511");
 Application.sendNotification({
 "title": "notification title",
 "content": "notification content",
 "receivers": ["Jack"],
 "mode": ApplicationMode.Present,
 "parameters": [param1],
 

SUMMARY

Once an analytic application is able to run as a scheduled job at the backend for 7×24 hours, you would be able to achieve many interesting use cases that were not possible prior.

Enjoy your exploration with SAP Analytics Cloud!

 

For questions, please visit your community topic page about SAP Analytics Cloud or post your question here.

2 Comments
You must be Logged on to comment or reply to a post.
  • Hi Jason,

    Thank you for sharing this article! I have seen you posted something similar last year (https://saphanajourney.com/sap-analytics-cloud/resources/robotic-smart-analytic-app/) with the same conclusion:

    "Once an analytic application is able to run as a scheduled job at the backend..."

    Is this feature now available? Our business demand behind this would be that we do not send scheduled reports at certain points in time but rather when new data has been released. We would include a indication by a timestamp in the query and once this timestamp has changed send out the reports.

    Best Regards
    Marcel

  • Hi Marcel,

    The schedule a publication feature is available: https://help.sap.com/viewer/00f68c2e08b941f081002fd3691d86a7/release/en-US/86c2d7d88b134e45907453612c4f559a.html

    If you do not want to send scheduled reports at certain points in time but on the fly, you can try this:

    1. Use a timer widget in an analytics application to regularly check the timestamp
    2. Call the API Application.sendNotification to send notification

    But two prerequisites not sure your business demand could accept:

    1. You need to always keep the app open
    2. Add your custom Email server under SAC System->Administration->Notification->Email Server Configuration

    thanks,

    Jason