Skip to Content

Continuing my series on Fiori elements … you’ll find more blogs in the Fiori elements wiki.

A simple way to add a little emphasis and pizazz to your Fiori elements apps is to add status icons and semantic colors to a text field.  Here we show how to do this using a List Report column as the example.

When you want to attract your business users’ attention, UI.Criticality is one of the easiest annotations you can use to add some visual bling to your Fiori elements apps.  It’s a great option for adding a status icon and a little semantic colour to a simple text or date field.

In this example status icons and semantic colors have been added to the text property Overall Status.  The original property text values Paid, Cancelled, New, and Delivered have been transformed with a status icon and semantic color.

Accessibility note: Notice that we automatically apply a different color *and* a different icon rather than relying on color alone.  This means that even users with red-green color-blindness can easily distinguish the criticality of different statuses. You can find more background on this topic in the success criterion of the Web Content Accessibility Guidelines.

Tip: What do we mean by semantic color? Certain colors have intrinsic meaning in many countries and cultures. In business some of the most recognized colors are those often referred to as “traffic light” colors:

  • Red meaning stop or negative
  • Yellow meaning be careful or warning,
  • Green meaning go or positive

And we add a 4th Grey meaning neutral.

There are 3 easy steps to using the criticality annotation:

  • Know how the criticality value maps to status icons and semantic colours
  • Map the criticality value to your target field
  • Add the UI.Criticality annotation to your target field

Let’s get to it!

Understanding Criticality Values

There are 4 possible criticality values. These map to status icons and semantic colors as follows:

Criticality Value Meaning Colour Icon
0 Neutral Grey
1 Negative Red  
2 Critical Yellow  
3 Positive Green  

 

Map the Criticality Value to your Target Field

Often the simplest way to map your criticality value to your target field is to map it to a separate calculated field of the same OData Service entity.

For example, if you are using a ABAP CDS View exposed as an OData Service, you could map the values of a text property OverallStatus of the entity SalesOrder to a new field Criticality by adding a simple CASE statement in your CDS View such as this:

Tip: Always make sure you activate and test your OData Service before adding the new value to your Fiori elements app.

Add the Criticality Annotation to your Target Field

All you need to do now is to add the criticality annotation to your target field in your Fiori element app.  You can do this:

  • In a Metadata extension of your CDS View
    • The recommended approach
  • Inline in your CDS View
    • Possible but not recommended – an easy option for sandpit scenarios
  • In the local annotations file of your Fiori element app
    • Possible & a useful option if you don’t have access to change the OData Service or you are reusing an existing OData Service in a new app and don’t want to impact any existing apps

For example if your Target Field is set up as a UI.DataField of a Fiori element List Report app, you can add your criticality annotation in a metadata extension of the CDS View like this:

Or in the SAP Cloud Platform Web IDE you can add the criticality to your local annotations file using the Annotation Modeler to assign the Criticality property as highlighted in this example:

Or directly using the XML editor of your local annotations XML file like this:

Now just run your app!

 

Take your Fiori elements app to the Next Level

If you are interested in Fiori elements you might also like to look at some of our videos on Youtube such as:

If you want to find out more on how to use the Annotation Modeler, you might like to look at some of our Annotation Modeler in SAP Web IDE videos on Youtube.

If you are going to SAP Teched 2017 and Interested in learning more about Fiori elements you might like to attend these sessions:

  • DX201 What’s New with SAP Fiori Elements
  • S4H276 Build a List Report SAP Fiori App: ABAP Programming Model for SAP S/4HANA
  • S4H279 Build Transactional SAP Fiori App: ABAP Programming Model for SAP S/4 HANA
  • DX264 Overview Page in SAP Fiori Elements
  • DX266 SAP Fiori Elements – Analytical List Page

And you can find more information on Developing apps with SAP Fiori elements in the SAPUI5 SDK and on the ABAP Programming Model for Fiori in the SAP Help Portal.

Screenshots shown on:

  • ABAP Development Tools on Eclipse Neon
  • Web IDE Version: 170720 
  • SAPUI5 version 1.46.11

Brought to you by S/4HANA RIG

To report this post you need to login first.

10 Comments

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

  1. Yuri Norov

    Thanks, Jocelyn Dart Very usefull post!

    But I have one problem: when using BOPF DRAFT 2.0
    If you open object in change mode, then these fields always take the grey value (like criticality value = 0). In the “display” mode, everything displayed correctly

    Is this standard behavior?

     

    (0) 
  2. Joseph BERTHE

    Hello,

    Thanks for your insigth on it 🙂

    But…. I’ve pass over 3h to discover that this feature is not available in the analytical table. So I would like o ask you, why it is not the same ? In the analytical scenario, this feature should be very usefull ?

    Probably I missed something 😉

    Kind regards,

    Joseph

    (0) 
    1. Jocelyn Dart Post author

      Hi Joseph,

      It’s definitely available in the analytical table – I’ve seen this used.

      Why exactly do you think it’s not available?

      Rgds,

      Jocelyn

       

      (0) 
      1. Joseph BERTHE

        Hello Jocelyn,

        In fact, in my scenario, I have a CDS view which provide annotation (just the minimum). The main annotations iare supported by an annotation.xml file from my Fiori element List report.

        After reading your blog I set the right properties into the annotation’s file and I drive the list report with my CDS with this annotation :

        @DefaultAggregation: #SUM

        When I set that, the list report is an analytical table, and in that case, the icon/colors annotation does not work. When I remove it, the list report is a responsive table, and in this case it works.

        I’m wrong somewhere ?

        Regards,

        Jospeh

         

        (0) 
        1. Lukas Bender

          Hi Joseph,

          I came to the same result. Changing the list settings in the manifest.json to Grid oder Analytical leads to unavailability of semantic colors.

          The same happens when setting @Analytics.query: true. The service then gets its information from the query result, which is not capable to  display semantic colors.

          Might be a similiar reason for Grid/Analytical Table annotations first problem. Real pity. Would be awesome if this could be implemented. 

          Regards

          Lukas

          (0) 
          1. Jocelyn Dart Post author

            Hi folks, Good news is that this is coming in a future SAPUI5 release so keep watch on the SAPUI5 release “What’s New” updates.

            Rgds

            Jocelyn

            (0) 
  3. Ashutosh Kumar

    Hello Jocelyn,

    Is there any standard CDS example available which can be reffered for DATA POINT.

    I tried placing a Data point in Header Facet but its not working.

     

     

    (0) 
  4. Alexandre Doyen

    Hello Jocelyn,

    thanks for this nice post 🙂

    I try to do the same in my list report. Here I want a status description (with criticality and without icon).

    But I have a custumer rule to get description status who depend of two different fields. So I added some features in Class OO DPC_EXT and that works only when I add my fields in the list report (ui.lineitem). When I remove them I lost my criticality status because OData (I think) do not consume them and I have not this fields in my DPC_EXT.

    Do you know how hide this fields but get it OData request ?

    Thank you very much.

    (0) 
      1. Jocelyn Dart Post author

        Thanks Alexandre – I’ve added the blog series into the Fiori elements wiki https://wiki.scn.sap.com/wiki/display/Fiori/Fiori+elements

        Oh and a small note if you have future questions – please post them to answers.sap.com.  That makes it easier for everyone to find them and participate in getting the answer You can always use the Jocelyn Dart  mention option to let me know.

        (0) 

Leave a Reply