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: 

Introduction


In the previous blog, the general overview of the Business Situations in SAP HANA Operational Process Intelligence has been given.


In this blog, I describe the insights of the detection mechanism of the Business Situations. Understanding this mechanism will make it easier to design the Business Situations for any kind of business in the most efficient and reliable manner.


The blog is split into two parts: In the first part, the detection mechanism of the Business Situations is described in general. And in the second part, there comes a particular example of how the mechanism behaves under different circumstances.

General Information

There is no doubt that the detection mechanism is the heart and soul of the Business Situation. Its purpose is to keep track of the instances of the Business Situations which have ever existed in the system.

The key part of the detection mechanism is the Business Situation detection procedure. This procedure is configured by the Solution Expert while designing a Business Situation. Its purpose is, at any point in time, to return a list of the objects which uniquely identify the instances of the Business Situation which are detected right now. The results of the detection procedure are exploited to create instances of the newly emerging Business Situations as well as to avoid creating duplicates of the business situations which have already existed in the system.

This is how it works. When executed, the detection procedure returns the list of the objects which uniquely identify the instances of the Business Situation which are detected right now. The system tries to find the corresponding records in the database. New instances are only created for those objects that have not been found in the system.

It is important to mention that the data source accessed by the detection procedure of the Business Situation is not limited to the scenario context data foundation. It can be based on absolutely any information or calculation in the HANA database and can be as sophisticated as you like.

Following the Detection Mechanism of the Business Situations Step by Step

Let us follow the system in detecting the instances of the Business Situation step by step. To do this let us consider one of the example Business Situations introduced in the previous blog:

NameTypeDetection ConditionAction
Lack of ProductThreatThe supply of a product is at 20% of its average daily consumption.Order the corresponding product.

Detection Procedure of the Business Situation

As already mentioned, the detection procedure of the Business Situation provides an answer to the question: "Which instances of the Business Situation can be detected right now?"

Therefore, an obvious suspect for the identification of the instances of the example Business Situation would be the product which supplies are in danger. However, in this case, lack of some product today and, for instance, two weeks ago will be considered as one instance of the Business Situation. So, the new instance for today will not be created. To avoid this, the date when lack of a product is observed should also be a part of the output of the detection procedure in addition to the product as such. So, the output of the detection procedure of this Business Situation will consist of the product and the date when lack of it is observed:

Output of the Detection Procedure
ProductDate

First Run

Before the detection mechanism is executed for the first time there are no records in the database which uniquely identify the existing instances of the Business Situation. Let us assume that the first time the detection mechanism is executed on the 9th of October 2014. And there is lack of bananas and tomatoes detected. These products together with the current date are returned by the detection procedure of the Business Situation. The mechanism tries to find corresponding records in the database. As the database is currently empty, the new records are created for all the values returned by the detection procedure:

Initial Database RecordsOutput of the Detection ProcedureUpdated Database Records
ProductDate
ProductDate
Bananas09.10.2014
Tomatoes09.10.2014
ProductDate
Bananas09.10.2014
Tomatoes09.10.2014

Next Run: New Instance

While the output of the detection procedure remains unchanged the database records also remain the same. Let us assume that at some point during the same day the detection procedure returns also onions in addition to bananas and tomatoes. The system compares these results with the records which currently exist in the database and creates a new record for the onions only:

Initial Database RecordsOutput of the Detection ProcedureUpdated Database Records
ProductDate
Bananas09.10.2014
Tomatoes09.10.2014
ProductDate
Bananas09.10.2014
Tomatoes09.10.2014
Onions09.10.2014
ProductDate
Bananas09.10.2014
Tomatoes09.10.2014
Onions09.10.2014

Next Run: New Instances for the Next Day

Assuming that the situation has not changed during the day let us have a look at how the system interprets the event when the day changes. We assume that at the beginning of the next day there is still lack of bananas, tomatoes, and onions observed. In this case, the new records will be created for all of these products, as the records which refer to the 10th of October 2014 do not currently exist in the database.

Initial Database RecordsOutput of the Detection ProcedureUpdated Database Records
ProductDate
Bananas09.10.2014
Tomatoes09.10.2014
Onions09.10.2014
ProductDate
Bananas10.10.2014
Tomatoes10.10.2014
Onions10.10.2014
ProductDate
Bananas09.10.2014
Tomatoes09.10.2014
Onions09.10.2014
Bananas10.10.2014
Tomatoes10.10.2014
Onions10.10.2014

Next Run: Solved Issues

Let us now assume that at some point during the 10th of October 2014 the supplies of the tomatoes and onions are renewed. This means that the detection procedure does not return the tomatoes and the onions any more and its output contains only one record which refers to bananas. As the corresponding record already exists in the database, the detection mechanism does not perform any changes:

Initial Database RecordsOutput of the Detection ProcedureUpdated Database Records
ProductDate
Bananas09.10.2014
Tomatoes09.10.2014
Onions09.10.2014
Bananas10.10.2014
Tomatoes10.10.2014
Onions10.10.2014
ProductDate
Bananas10.10.2014
ProductDate
Bananas09.10.2014
Tomatoes09.10.2014
Onions09.10.2014
Bananas10.10.2014
Tomatoes10.10.2014
Onions10.10.2014

Next Run: New Instances

As the last step of this example, let us consider the following case. The system detects that in addition to bananas there is also lack of apples and peppers observed. As in the previous step, the record for bananas is not taken into account, since it already exists in the database. The new records will only be created for apples and peppers.

Initial Database RecordsOutput of the Detection ProcedureUpdated Database Records
ProductDate
Bananas09.10.2014
Tomatoes09.10.2014
Onions09.10.2014
Bananas21.09.2014
Tomatoes21.09.2014
Onions21.09.2014
ProductDate
Bananas10.10.2014
Apples10.10.2014
Peppers10.10.2014
ProductDate
Bananas09.10.2014
Tomatoes09.10.2014
Onions09.10.2014
Bananas10.10.2014
Tomatoes10.10.2014
Onions10.10.2014
Apples10.10.2014
Peppers10.10.2014

Please, stay tuned for the upcoming blogs of the series dedicated to the process of designing Business Situations in the SAP HANA Studio with SAP Operational Process Intelligence plugin, and the interactions of the Scenario Operator with Business Situations in space.me.

Special thanks to Waldemar Geppart, Birgit Heilig, Harshavardhan Jegadeesan, and Alan Rickayzen for your help and support!

4 Comments