Overall flow for Custom object-based situations and roles involved is very well explained in this SAP flow diagram
In this blog post we will see how Custom Situation Object can be created along with some hurdles faced while creating the same. In this we will cover the ADMIN role - as admin we can model the situation objects using Fiori app "Manage Situation Object". Then using app "Manage Situation Scenario"; you can map situation objects to a situation scenario.
Let's get started with the first block i.e. creating Custom Situation Object.
Manage Situation Object :Situation Object collects all the application artifacts to model the custom Situation. I had created Custom Situation Object on one of my Custom CDS views having Sales data used in Custom Fiori app. But for learning about all options possible - we should refer SAP FLIGHT example and I will also be using SAP FLIGHTS CDS View in this blog to leverage all features offered by Manage Situation Object app. Give the Situation Object name and click on create as the first step
In next screen enter the details about Situation Object as shown below
General Information: Give the name and description for the Custom Situation Object
Additional Translations (Optional): You can maintain the translations here
Value Help Services (Optional): This step is optional. Here you can link one or more value help services that provide the semantic data needed for the structures. You can only use V2 Odata here and this Odata will be used later in application "Manage Situation Types - Extended", and in that when you will define conditions on the fields of your structures, you will be able to choose values from the value helps that you have maintained here for better usability. Now click on Create after giving the Value Help Service ID
So, in the next section of "Value Help Services" page, you must maintain the entity sets and the properties (fields of the CDS view in case the entity set is a CDS view) which you want to use. These properties should have annotations maintained related to value help (for example: @Consumption.valueHelpDefinition).
Use Fiori app 'View Browser' to check the annotations E.g. as shown below for field Carrier ID
Below Entity set and property are added in the Property tab based on the Value Help CDS view
4. Structure: In this we define the object (CDS View) that can be affected by a situation or that triggers the situation. You can use your own Custom CDS view / SAP released CDS views. Give the Structure ID and click on Create
Under Structure we have 4 tabs as shown below
General Information: Here you give the CDS View name, here we have given FLIGHT CDS view
Semantic Keys: They uniquely identify situation object example Sales Order number, or it can be combination of fields like for flights its airline, connection, and flight date
Value mappings: Once these properties are defined in step 3, then the next step would be to map these properties to the fields of your Structures. For that we will go inside the page for "Structures" and do the mapping in the section "Value Help Mappings".
5. Events (Optional): Select all workflow events relevant for the object that are allow listed as business events. The events usually refer to activities such as created, updated, and deleted.
Event Category: can be BOR Object Type /ABAP Class and in Event Object you can selected the available Event Object and Event type (Created/Changed etc.)
6. Navigation Targets :In Navigation Targets, we specify the semantic object and semantic object action that describe the app. The details of semantic object for Fiori app are available in SAP Fiori Library .For example for Sales Order; semantic object = SalesOrder and Semantic Action = manage. In this case since we are using SAP flight example so we will use the Flight app navigation targets
Additionally you can provide parameters if you want to navigate to specific page in the app .
7. Callbacks (Optional): In Callbacks, we define the actions that can help to resolve the situation or its root cause. For each action you select the callback class and specify the parameters you need to perform the action. Again, this could be one ID or a combination of parameters. E.g for FLIGHT; cancel flight can be one of callback
Only available callback services can be used. As of now only few callback classes are available in 2 tier cloud as shown
8 . End User action: Once you have defined the Navigation Targets and Callbacks; you can assign them to the End User actions by selecting the type of the action and define name of button and description that are displayed to end user.
This will be used in My Situations-Extended app.
Now we have created a Custom Situation Object having all the objects required for FLIGHTS use case that will be used later to create Situations .
While creating Custom Situation Object; few of the observations:
Callback Classes: Currently in 2 tier cloud landscape; we have limited SAP provided callback classes that can be used, and we cannot extend/create our own callback class.
Value Help Services: They are optional and for better usability. You can only use value help services odata here. I could only find limited value help services in View Browser Fiori app that have ODATA as true. So looks like in cloud Custom CDS views are ruled out for Value Help services and standard ones are currently limited.
In coming days as we explore more; will update the blog with any latest findings as well. Now the next step is to create Situation Scenario using Situation object .