Skip to Content
Technical Articles
Author's profile photo Gregor Wolf

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.

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Alejandro Sensejl
      Alejandro Sensejl

      Hey Gregor Wolf,

      what is the tool you used to create that diagram in section "How to get there" → "Architecture"? 🤩

      Cheers,
      Alej

      Author's profile photo Gregor Wolf
      Gregor Wolf
      Blog Post Author

      HI Alej,

      it's called Excalidraw. You can check it out directly at https://excalidraw.com/. But also have a look at their GitHub Repository at https://github.com/excalidraw/excalidraw. It's MIT Licensed.

      Best regards
      Gregor

      Author's profile photo Matthias Wild
      Matthias Wild

      Changing the world with SAP Stammtisch discussions - step by step. Thanks for sharing Gregor! I'm sure this will become a popular SAP Inside Track topic as well 🙂

      Author's profile photo Smutny Ondrej
      Smutny Ondrej

      Hi Gregor Wolf

      great blog and great project ! Thanks for sharing.

      I'm elaborating similar idea around OSS notes since beginning of 2021, to simplify our HRSP analysis process and evaluate the impact on HCM country components.

      I was wondering if you have some hints, how to identify the OData service URL behind SAP Support Launchpad? I can see you succeeded to get OSS incident service.

      I was trying to checkout "My Notes" application on launchpad, but without any success to identify the OData service sitting behind it.

      Thanks a lot

      Regards

      Ondřej

       

       

      Author's profile photo Gregor Wolf
      Gregor Wolf
      Blog Post Author

      Hi Ondřej,

      sorry for the late reply. The best tool to find out if there is an OData Service behind an application is to start the developer tools of you browser before you start the application and switch to the Network tab. I've tried this with the Notes Application i.e to access Note 3000000 and found the following:

      Metadata

      https://dispatchersupportportal.hana.ondemand.com/SMP_NG_WEB/odata/svt/snogwsnnf/$metadata 

      Entity Sets
      https://dispatchersupportportal.hana.ondemand.com/SMP_NG_WEB/odata/svt/snogwsnnf/?$format=json 

      Header

      https://dispatchersupportportal.hana.ondemand.com/SMP_NG_WEB/odata/svt/snogwsnnf/Header(Number=3000000,LanguageKey='E')?$format=json

      Doc

      https://dispatchersupportportal.hana.ondemand.com/SMP_NG_WEB/odata/svt/snogwsnnf/Doc(Number=3000000,LanguageKey='E')?$expand=Longtext%2cCorrectionsInfos%2cAttributes%2cLanguages%2cAttach%2cSideCau%2cSideSol%2cManualActions&$format=json

      For My Notes check out:

      https://launchpad.support.sap.com/services/odata/svt/snogwsmynotes/$metadata?sap-language=en

      and

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

      CU
      Gregor

      Author's profile photo Peter Widmer
      Peter Widmer

      HI Gregor Wolf ,

       

      thanks for this very helpful blog!

       

      I took over all of the annotations more or less 1:1 (suiting my entity and attribute names), but when using the VSCode Fiori Elements app generator, I receive the following error after connecting to my local OData service:

      The OData V4 service you have provided is not suitable for use in an Analytical List Page application. The service must contain aggregate based entity sets for this floorplan.

       

      Of course, I added all of the annotations to the entity. Are there any workarounds available?

       

      Many thanks in advance,

      Peter

      Author's profile photo Gregor Wolf
      Gregor Wolf
      Blog Post Author

      Hi Peter,

      have you tried if the VSCode Fiori Elements app generator is still working with my project?

      Best Regards
      Gregor

      Author's profile photo Peter Widmer
      Peter Widmer

      HI Georg Wolf

      first things first - thanks for your quick answer!

      That is exactly the point. I used your repo and tried to create another ALP, it works like a charme without complaining.

       

      Due to our architecture in the project, unfortunately, we have quite a long chain of projecting entities across several services until I can reach it in the final service to be exposed on the UI. Could that be a reason? Do the annotations might get "lost" in the nested structure? But I even tried to add the annotations on different levels (even one before the actual consumption takes place), and stilll no success.

       

      Best regards,

      Peter

      Author's profile photo Gregor Wolf
      Gregor Wolf
      Blog Post Author

      Hi Peter,

      what helped for me was always to simplify as much as possible so you would be able to compare the resulting Metadata with it's annotations.

      CU
      Gregor

      Author's profile photo Peter Widmer
      Peter Widmer

      Yes, I proceeded with that, too.

       

      And found that in each and every situation, I am missing the sap:aggregation-role="dimension" and sap:aggregation-role="measure" annotations in my metadata file. That's where I keep investigating.

       

      Best,

      Peter