Skip to Content
Technical Articles

Discovering SAP Fiori Elements Analytical functions by implementing SAP Support Message Reporting

It’s quite a while since my last post here in the SAP Community. If you want to keep track of what I do in development please follow my GitHub activities.

How it started

On 25. Feb. 2021 Jakob Flaman posted this on Twitter:

Just thinking how to analyse our #SAPSupport on SAP OSS messages. Is there a Analytics Dashboard around or CDS ?. Sometimes it would help to see the “sleeper” and why are they “sleeper” 🙂

The next day we started to dig into this during the vSAPWorkSpace. Jakob posted this update:

At #vSAPWorkSpace we were checking the me.sap.com site to explore the #SAPOSS structure. We looked for a KPI like “number of contacts of a incident”. With some inspiration we found the OData source to extract the json 🙂 It was awesome Thx

You can have a look at what was achieved so far by browsing the GitHub repository at this point in history. Basically we’ve identified the OData Service behind the SAP Support Launchpad that powers the Incident reporting. It is reachable when you have an S-User via:

https://launchpad.support.sap.com/services/odata/incidentws/?$format=json

Following the OData Standard the Service Metadata can be read from:

https://launchpad.support.sap.com/services/odata/incidentws/$metadata

But using this service in an own application isn’t directly possible due to the needed authentication. So I suggested to replicate the data and wrap it into a new application. There comes my beloved SAP Cloud Application Programming Model in short CAP into play. With the Service Metadata (EDMX) at hand you can quickly setup a Mocking App Service. As a result you get a replica of the original service that you can fill easily with example data that you download from the original service.

How it continued

I’ve added a first analytical list page and data load from the SAP Support. Find details in this GitHub History. Thanks to the post Adding a Donut Chart on top of CAP service by Mio Yasutake it was a simple step to an Overview Page containing multiple charts:

Overview%20Page

Overview Page

How to get there

Architecture

Implementation details

For analytical functions in Fiori Elements the prerequisite are analytical annotations in the service metadata. I’ve achieved that by re-using the external entity and annotating it. Check the commented source below:

using {incidentws as external} from '../srv/external/incidentws.csn';

// persist the re-used external enity
@cds.persistence.skip                            : false
@cds.persistence.table
// analytical annotation
@Aggregation.ApplySupported.PropertyRestrictions : true
// reuse the imported data model
entity MessageHeaderSet : external.MessageHeaderSet {
  // add aditional field that is always filled with 1 to calculate the 
  // number of messages in aggregations. This is our analytic measure
  @Analytics.Measure   : true
  @Aggregation.default : #SUM
  numberOfMessages : Integer default 1 @(title : '{i18n>numberOfMessages}');
}

// Annotate analytic dimensions
annotate MessageHeaderSet with {
  @Analytics.Dimension : true
  PriorityTxt @(title : '{i18n>PriorityTxt}');
  @Analytics.Dimension : true
  Status      @(title : '{i18n>Status}');
  @Analytics.Dimension : true
  StatusTxt   @(title : '{i18n>StatusTxt}');
  @Analytics.Dimension : true
  SystemId    @(title : '{i18n>SystemId}');
};

For simplification I’ve based the search helps on the content of the main entity. A view is defined to retrieve the distinct values. In addition a Entity is needed to provide the needed structure:

// View with distinct values for search help
view PriorityTxtView as select distinct PriorityTxt from MessageHeaderSet;

// Entity for search help is filled with custom logic
@readonly
@cds.odata.valuelist
entity PriorityTxtVH {
  key PriorityTxt : external.MessageHeaderSet : PriorityTxt;
};

This custom handler code fills the value help (VH):

  srv.on ('READ', "PriorityTxtVH", async req => {
    return SELECT.from(PriorityTxtView)
  })

With the value helps in place the annotations for Fiori Elements can be added. I.e. the definition for a column chart:

  Chart #PriorityTxt               : {
    ChartType           : #Column,
    Dimensions          : [PriorityTxt],
    DimensionAttributes : [{
      Dimension : PriorityTxt,
      Role      : #Category
    }],
    Measures            : [numberOfMessages],
    MeasureAttributes   : [{
      Measure : numberOfMessages,
      Role    : #Axis1
    }]
  },

To use that as a visual filter the chart needs to be defined in a Presentation Variant:

  PresentationVariant #PriorityTxt : {
    Visualizations : ['@UI.Chart#PriorityTxt', ], 
  },

This Presentation Variant is referenced in the Value List definition for the Field:

  @Common : {ValueList #PriorityTxtVisualFilter : {
    $Type                        : 'Common.ValueListType',
    CollectionPath               : 'MessageHeaderSet',
    PresentationVariantQualifier : 'PriorityTxt',
    Parameters                   : [{
      $Type             : 'Common.ValueListParameterInOut',
      LocalDataProperty : 'PriorityTxt',
      ValueListProperty : 'PriorityTxt'
    }]
  }}
  PriorityTxt @(ValueList.entity : 'PriorityTxtVH', );

The result in the Analytical List Page looks like that:

Analytical%20List%20Page%20with%20Visual%20Filter

Analytical List Page with Visual Filter

How it’s going

On Thursday 4th of March 2021 the SAP Stammtisch Vienna invited to their Virtual Stammtisch. Jakob Flaman also joined and we showed the current achievement. Andreas Blättler also joined and asked for an easy deployment option. So I walked through the process on how to package a CAP Application in a Docker image. You can find this image now as gregorwolf/sap-support-message-reporting on Docker Hub. This enables now also a deployment to Kyma.

During another SAPWorkSpace we thought about the further steps. The most challenging one is the MessageAlogSet Entity which provides the list of status changes for a particular incident. The MessageAlogSet is very similar to the Event Data described by Gonzalez Lopez de Murillas in the paper Process mining on databases (PDF). So if you have expertise in this field we’re happy if you join forces with us to get more insight into the SAP Incident Process.

5 Comments
You must be Logged on to comment or reply to a post.