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: 
patrik_spiess
Participant
Situation Handling in SAP S/4HANA and SAP S/4HANA Cloud detects exceptional circumstances and displays them to the right users.

I'm the lead UI developer within the Situation Handling team for end-user facing apps and I'm excited to present a new feature in the Situation Handling extended framework to you. Together with the team from SAP Fiori elements, we're introducing a new, simplified way of displaying situations right in your business apps. You can enable a great user experience for your end users with low effort. Read through this tutorial-style article which explains the details and points you to further resources that you can use as a blueprint for your successful implementation.

With the extended framework of Situation Handling, you can display situations in apps based on SAP Fiori elements for OData version 4. You can do this without any front-end development, just by extending the app’s OData service.

What you'll get is a new button, the situation indicator, in tables and object page headers whenever there's a situation for the business object. By clicking the button, you'll get a preview of the situation. From this preview, you can go to the situation page with the situation details and see the proposed actions that can help you resolve the situation. This is what the end user experience looks like:


Animation of the User Experience of Situations in an SAP Fiori Elements App


The example shows the Situation Demo app (see SAP Help Portal and SAP Fiori apps reference library). You can explore its UI service, using it as a blueprint for enabling your own app.

To enable situation indicators, you just need to do three things:

  1. Refer to a particular ODataV4 situation entity set in the app’s UI service and

  2. Establish a link to the situation object modelled as an anchor object within the extended framework for Situation Handling. This link is based on SAP Object Types (SOT) and SAP Object Node Types (SONT) that are referenced app’s service and the situation object model.

  3. Finally, extend your app's service definition.


Customers and partners can model all these steps. This is described below in detail.

Note that this method works only if you’re using the extended framework for Situation Handling and the app is based on SAP Fiori elements for ODataV4. Any other combination (like the standard framework for Situation Handling or SAP Fiori elements for OData V2 or freestyle apps) will not work like this.

Step-by-Step Implementation Guide


Step 1: Link Your Situation Object Structure with an SAP Object Type (SOT) and an SAP Object Node Type (SONT)


You need to assign the situation object’s structure to an SOT and an SONT in the "Manage Situation Objects" app. (Refer to our blog Custom Situation Cases: Model Your Own Situation Objects).

Let's take our demo situation object 'Flight' as an example. It uses the SOT/SONT "BusinessSituationDemoFlight".


Configuration of the SOT and SONT in App Manage Situation Objects


Make both assignments in the Structures section. The SOT and SONT that you assigned will be used in the next step.

Step 2: Extend Your App’s CDS View


For each exposed entity that is a situation anchor object (the business object that is affected by a situation) and for which you want to indicate situations, do the following:

First, extend the entity’s CDS view by adding the following privileged access annotation:
// added privileged access for association to Situation Service 
@AccessControl.privilegedAssociations: [ '_SAPSituation' ]

Then, extend the definition of the entity itself:
define view entity C_YOUR_ENTITY {
  // add the association to the situation
   association [0..1] to I_Sitn2InstceCountAPI as _SAPSituation
// joining on SAP Object Type of your anchor object
    on  _SAPSituation.SitnAnchorObjectSOT = 'YourSAPObjectType'
    // and SAP Object Node Type of your anchor object
    and  _SAPSituation.SitnAnchorObjectSONT = 'YourSAPObjectNodeType'
    // and the property that holds the anchor object key
    and _SAPSituation.SitnInstceAnchorObjectKey =
    $projection.YourAnchorObjectKeyProperty
   ...

  // further down in the view, expose the joined association as
   // a navigation property. the name of association is not fixed,
   // but it must be the same as in the privilegedAssociations
   // annotation from above internally.
// SAP Fiori elements will identify this association by detecting
// the annotation
// @ObjectModel.sapObjectNodeType.name: 'BusinessSituation'
   // from the view I_Sitn2InstceCountAPI
   _SAPSituation,
   ...
}

To see a complete example of an extended view, take a look at the C_SITN2DEMOFLIGHTTP view in your development system.

Step 3: Extend Your App’s Service Definition


In addition, you need to extend the OData V4 service definition by exposing the following additional entity sets:
@EndUserText.label: 'Your Label'
define service YOUR_SERVICE_NAME {

  // Example Application Part (the entity sets you already have)
  expose C_SITN2DEMOFLIGHTTP_DEMO as Flight;
  expose C_SITN2DEMOBOOKINGTP_DEMO as Booking;
  expose C_Sitn2DemoCarrierTP as Carrier;
  ...      

// Additional entity sets required for Situation Service
  expose I_Sitn2InstceCountAPI       as SituationIndicationCount;
  expose I_Sitn2InstanceAPI     as SituationInstance;
  expose I_Sitn2InstceAttributeAPI   as InstanceAttribute;
  expose I_Sitn2InstceAttribValueAPI as InstanceAttributeValue;
  expose I_Sitn2InstceTextAPI         as SituationInstanceText;
}

To see a complete example of an extended service definition, you can refer to the demo service C_SITN2DEMOFLIGHTSRV in your development system.

Conclusion


In this article, I demonstrated how you can show situations in your own apps for SAP S/4HANA. Showing situations directly in the apps is a great addition to just delivering them as notifications to end users when a situation occurs. The end users see them right away in the business context while they carry out their daily tasks, because the situation buttons appear directly on line items of tables and on object pages. They are reminded that there is a situation for the business object they are working on, even if the notification is long forgotten or has been overlooked.

If you want to know more about front-end topics in the Situation Handling framework, subscribe to my profile and watch for new blog posts.

I'd love to hear about your experience with this approach and encourage you to give feedback in the comments below.

To get to know all about the Situation Handling framework, subscribe our blog feed and check out all the blog posts about this clever framework that makes SAP S/4HANA more proactive.

There's also a questions and answers feed for you to review and subscribe to anytime.
2 Comments