cancel
Showing results for 
Search instead for 
Did you mean: 

Overview Page - Analytical card "Units" for Overview Page with XSOData - What am I missing?

MattHarding
Active Contributor
0 Kudos

If you use build.me or look at https://experience.sap.com/fiori-design-web/ui-components/analytical-card/ for what an Analytical Card header can look like; it would seem you can display a KPI with it's respective unit. Also, looking at the UI5 help, it seems to get this unit, you can either add this semantic info to the metadata, or add it as an annotation:

https://sapui5.netweaver.ondemand.com/#docs/guide/0d6c1d5f9e1e4aab950f7b528c59fa5d.html

This leads to a series of questions; which all comes down to: "How to I get the unit next to the KPI" (the EUR below)...

Question 1: When I add the semantic "amount with unit of measure" to my HANA Calculation view, the associated XSOData service metadata (which has ODATA4SAP annotations added); doesn't add the sap:unit="{reference UoM Property}" annotation. Is this not supported like this?

Question 2: Assuming I don't add the sap:unit annotation, the annotation modeler on WebIDE doesn't seem to support adding the Units manually. Is this a bug, or can I only do this by adding the annotation manually?

Question 3: If I manually add the annotation to the metadata in the localservice within the WebIDE project, I can then create the annotation; but running this with mock data still shows no Unit of Measure. What precisely is needed to get the UoM showing in the analytical card KPI area?

Thanks for any help you can provide,

Matt

MattHarding
Active Contributor
0 Kudos

BTW - Looking at the actual code which gets the Unit, the following is returning null for path:

if (oEntityTypeProperty["Org.OData.Measures.V1.Unit"]) {
var oUnit = oEntityTypeProperty["Org.OData.Measures.V1.Unit"];
// This is the line which is null
if (oUnit.Path) {
	result = result + " {path: '" + oUnit.Path + "'}";
} else if (oUnit.String) {
	result = result + " " + oUnit.String;
}
}

MattHarding
Active Contributor
0 Kudos

Quick update, I've got the Unit of Measure displaying if I manually add the Path to the Annotation.xml file (as opposed to through the annotation modeler which adds the "Unit" annotation, but not the Path). However this only works in mock up mode where it's using my manually edited metadata file.

In other words, if I can get the semantic definition added to the XSOData Metadata file, then I can manually get this working by updating the annotation file outside of the annotation modeler.

MattHarding
Active Contributor
0 Kudos

As pointed out on Twitter by Jocelyn Dart (thanks Jocelyn), the above example actually shows a currency (and not an amount with unit of measure); but my question is focused on Unit of Measure scenarios.

Accepted Solutions (1)

Accepted Solutions (1)

MattHarding
Active Contributor
0 Kudos

So figured out how to get this working for XSOData but not sure how to make it work with annotations alone if you haven't added the semantic info to your metadata (which is okay for me at the moment but may be an issue if I want to do a Card for a Gateway odata service).

In the calculation view on HANA, you need to add the following semantics to your columns:

Note - Unfortunately, it doesn't look like Overview Cards support fixed unit of measures, hence the calculated column for UoM which also needs the semantic "Unit of Measure" added. Note - Because I tried a fixed constant first, I ran into heaps of trouble with the HANA WebIDE not taking my changes which is why it didn't work.

BTW - Not sure why I can't add Quantity with Unit of Measure to Counter (a count measure)...but another calculated field would solve that for me.

With this information in place, you don't actually need to annotate this field at all, and you'll find your KPI tile displays with units (!):

Answers (2)

Answers (2)

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert

Hi Matt, Re Question 1... my understanding is that ABAP CDS currently supports more annotations than HANA CDS ...

https://help.sap.com/abapdocu_750/en/abencds_annotations_sap.htm

Rgds,

Jocelyn

MattHarding
Active Contributor
0 Kudos

Thanks Jocelyn. Definitely seeing the investment in CDS taking over from everything else for Fiori Elements (including Gateway and XSOData services) - Shame really since so many of us are stuck with ERP and HANA without these features for quite some time yet.

At least with XSOData I could get this working as expected (was worried there for a bit).

Cheers,

Matt

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Matt

Very glad you worked it out.

You are quite right re the investment needed in CDS ... not just Fiori Elements but all the Fiori frameworks are basing themselves on CDS

Just noting that ABAP CDS is available from NetWeaver 7.40 Sp5 which does still cover many customers on ERP or Suite on HANA. It's always worth checking your NetWeaver release/sp

https://blogs.sap.com/2014/10/10/abap-news-for-740-sp08-abap-core-data-services-cds/

There's also a wiki on CDS: https://wiki.scn.sap.com/wiki/display/ABAP/CDS+-+Core+Data+Services

Also if you feel like blogging on your OVP experiences we have a collaborative wiki for Fiori Elements at: https://wiki.scn.sap.com/wiki/display/Fiori/Fiori+Elements

Cheers

Jocelyn

MattHarding
Active Contributor

Thanks Jocelyn. Note - CDS is a thing since 7.40 SP5, but OData enablement comes much later (especially if you want annotations) - Not sure what version it becomes usable as a datasource - or whether SAP will invest in CDS on HANA to allow exposing Calculation Views via CDS (currently very limited functionality on HANA from my research related to creating new CDS tables from what I can tell).