Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Dr_Joerg_Rett
Advisor
Advisor


Data provides confidence because it is objective and backs up new ideas with solid evidence.” states Ina Felsheim in her blog post Turning data into value: Are you close?. If you’re facing challenges in your business process, it might be the right moment to look for alternatives, such as another supplier or a different material. But how can you get information about issues requiring your attention and where is the data that serves as solid evidence as mentioned by Ina? The answer to the first question is Intelligent Situation Handling and the answer to the second is data context. 

You may have already read the blog post Situation Handling: How to analyze situations using Monitor Situations (4/5) and seen that you can monitor your business processes using Situation Handling. You might recall the line, "You will see that analytics is getting to be even more powerful, and automation becomes possible, by extending tracked data with data context." You may ask yourself

What is data context?

In the blog post mentioned above, you’ve already learned about tracked activity data. Remember, when a situation instance is created, that is an activity. Let’s call the information about this activity, such as the activity type, timestamp, status, and so on, activity data. You might also recall that a situation instance belongs to a situation type which represents a business use case. One example is the procurement use case "Quantity Deficit in Supplier´s Delivery" as described in the blog post Situation Handling: Selected use cases in different application areas (2/5). There, the business object which identifies the situation instance is the purchase order item. The anchor object key is made up of the purchase order number and the item number.


You will find this information as part of the activity data in the Anchor Object Key column as shown in the image above. You can imagine an anchor object as an instance of a business object for which a situation instance has been raised. The image above shows a sequence of activities for item 10 in purchase order 4500004856 as displayed in the Monitor Situations app.

So, the activity data tells you when an activity occurred for a business object and its status at that time.

Wouldn't it be nice to know more about the state of that business object and related business objects at the time of occurrence?

That’s when data context enters the picture. Data context contains information about the state of the involved business objects at the point in time when an activity occurs. In the business use case mentioned above the data context shows the missing quantity, which material, who the supplier is, and so on. Let’s take a closer look at the tracking mechanism of Situation Handling in the picture below.


The tracking mechanism collects situation data and business data and stores it as activity data and data context. In this sense, the data on the left is complemented by the data on right.

Now that you understand what data context is, the next question is,

How can you activate the capturing of data context?

As you’ve already seen, the capturing of data context is coupled with the creation of activity data. First, you need to select the Monitor Instances checkbox in the Manage Situation Types app as shown in the post Situation Handling: How do I configure situation types? (3/5). If the use case, or more technically speaking, the situation template supports the capturing of data context, a second checkbox becomes available. You can select it to activate Capture Data Context.


Don’t select the Enable Situation Automation checkbox unless you have implemented an automation solution, such as SAP's Intelligent Situation Automation service on SAP Business Technology Platform.

Ok, so now you understand how you can start collecting data context but,

What can you do with the data context?

Once a situation has occurred, you can ask yourself these questions:

  1. Do I need to adjust the situation type configuration to create a higher or lower number of situation instances with respect to urgency and importance?

  2. Can I adjust the business process to avoid future situations?

  3. Can I (partially) automate the resolution of this type of situation instance?


Either way, it all starts by analyzing the situation and business data and searching for common characteristics.

Let’s go back to the sample use case "Quantity Deficit in Supplier´s Delivery". Imagine you’re collecting data context for each business situation that occurs. You feed the data into your favorite tool for analysis, where one of the fields in this data is the ordered material. In the image below I have simply used a common spreadsheet. You create a stacked column chart for the number of situation instances per ordered material. Now you can see that the number of situation instances (light blue column) has increased for material SG23 since 3.11.2021.


After some investigation you might find that there’s a problem with material SG23. You’ll probably decide to adjust your business process by replacing this material with a substitute.

Or you might want to define a rule that triggers an action based on the type of material that the data context contains. Well, this is how Intelligent Situation Automation deals with the situation and how it automates the process as shown in the post Intelligent Situation Automation – The next big step in Digital Transformation.

Everything is based on the collection and provisioning of data context. Now as you’ve heard about the use case “Quantity Deficit in Supplier´s Delivery” the question is,

Which use cases are delivered with a data context definition?

On SAP Help Portal you will find a tabular list with Use Cases for Situation Handling which shows all available use cases for Situation Handling. You can now filter for use cases whose data context is defined as shown in the image below.


The links in the Situation Template column take you to the page that describes the template. On that page, under the heading “Situation Monitoring”, you can find a section about data context. There you’ll see the business objects fields contained in the data context, as well as the CDS views from which the data is taken. Speaking of which,

What is the content of the data context?

You can follow the link to the previously mentioned use case “Quantity Deficit in Supplier's Delivery on SAP Help Portal as described above. There you’ll find five tabular lists related to the CDS views that contain the data context.

Search the tabular lists for trigger object CDS view I_POSITNCONFQTYDEFICIT and you’ll see the MATERIAL field. Further up on that page, you’ll also find the fields from the anchor object CDS View I_PURCHASEORDERAPI01. On this page, the two entities, trigger and anchor object are represented by the respective CDS views. For now, you just need to remember that the data is grouped by source views.

Now that you’ve learned about the content of the data, you’ll probably want to start collecting it.

Where can I consume data context?

Data context is provided through an API called “Business Situation – Read” using GET /A_SitnDataContext. You can familiarize yourself with the response by taking a look at the  SAP API Business Hub. You will see that the header of the response has the following structure:


You’re already familiar with some of the keys in the header from the activity data. Let’s take a look at a screenshot from the Monitor Situations app.


A row in the Monitor Situations app maps to the following header of the API response:
"CreationDateTime":		"/Date(1639642748000+0000)/",
"SitnInstceAnchorObjectKey": "450000910600010",
"SitnInstceTriggerObjectKey": "450000910600010",
"SitnInstceStatus": "OP",
"SitnInstceActyType": "IC",
"SitnDefinitionID": "Z_SIT_DEMO_QUANTITY_DEFICIT",
"SitnDefTemplateID": " PROC_POITEMCONFQTYDEFICIT ",

Now you can compare some of the key – value pairs. The header-key “SitnInstceActyType” from the API response maps to the “Description of Activity Type” from the Monitor Situations app. The image below shows the coding of the values. In the API response shown above, the fixed value “IC” stands for the description “Instance Created”. As a rule of thumb, the fixed values for activity types are often composed of the initial capital letters found in the description (see image below).



The header-key "SitnInstceStatus" from the API response maps to the “Status” from the Monitor Situations app. The fixed value “OP” stands for the description “Open” (see the image above). If you convert the CreationDateTime value from epoch time (Timestamp) to Date it changes to Thursday, December 16, 2021, 8:19:08, which we can see as the Activity Date/Time.

You’ve now seen what the header-data looks like. The next question is,

What does the business data look like?

The business data found under the header key “SitnDataContext” is provided in JSON format. For example:
{
"SituationDefinitionID": " Z_SIT_DEMO_QUANTITY_DEFICIT ",
"SitnTemplateID": "PROC_POITEMCONFQTYDEFICIT",
"SitnDataContextFormatVersion": 1,
"Anchor": { … },
"Trigger": {
"Items": [{
"I_POSITNCONFQTYDEFICIT": {
"CONFIRMEDQUANTITY": 0.0,
"MATERIAL": "TG11",
"MATERIALNAME": "Trading.Good 11,PD,Reg.Trading22",
"ORDEREDQUANTITY": 21.0,
"PLANT": "1010",
"PURCHASEORDERITEMCATEGORY": "7",
"PURCHASEORDERQUANTITYUNIT": "ST",
"PURCHASINGDOCUMENT": "4500009106",
"PURCHASINGDOCUMENTITEM": "00010",
"PURCHASINGGROUP": "006",
"PURCHASINGORGANIZATION": "1010",
"SUPPLIER": "0010411020",
"SUPPLIERCONFIRMATIONCATEGORY": "LA"
}
}]
}
}

You can now use your favorite tool to document, compute, and analyze data. The final question is,

Where else can you view the data context?

Another option is using the Intelligent Situation Automation service on SAP Business Technology Platform (SAP BTP). There, on SAP BTP Fiori launchpad, you’ll find the Analyze Situations app.


As with the Monitor Situations app in SAP S/4HANA and SAP S/4HANA Cloud, you can also filter for the situation type in the Analyze Situations app on BTP.

You’ll get a list of situation instances for the situation type.


By clicking on a situation instance, you can drill deeper and see some data context information.


In the Data Context section under Trigger Object, you can see the material, for example, TG11. To see the complete set of data, choose View in the Details column.

That was a lot of information. So, how about

A short summary of data context

In this blog post you have seen that data context can be captured once you’ve activated the tracking of activity data. Using the Manage Situation Types app, you learned how to activate the capturing of data context. You understand that besides adjusting the configuration of situation types, you also have the option to analyze and automate your business processes. In the use case “Quantity Deficit in Supplier´s Delivery", you saw that time series data for materials was analyzed as an example. You learned which other use cases are enabled for data context capturing and where you can find information about them. You saw some data context content, which API you can use for consumption, and an example of data context in JSON. Finally, you learned that you can also view data context in Intelligent Situation Automation.

Want to learn more?

More blog posts about Situation Handling and Intelligent Situation Automation are available:

For more information, see SAP Help Portal for Situation Handling in SAP S/4HANA Cloud and Situation Handling in SAP S/4HANA. We welcome your valuable feedback.