Show TOC

Configuring Data Sources and ModelsLocate this document in the navigation structure

Overview page applications present information provided by an OData service and annotation files.

OData services and annotations are configured in the "sap.app"..."dataSources" section in the application manifest file. Each OData data source should be mapped to a SAPUI5 model, which is then referenced by the cards and the global filter configuration. Annotation files can be embedded in the OData metadata, or they can be referenced in the OData dataSource section.

Each OData type dataSources section must be exposed as an SAPUI5 model in the "sap.ui5"..."models" section. In addition, you should define a model for the i18n.properties file with i18n as the model name. If you want to use translated values in an annotation file, you must also provide an additional model for the i18n.properties file with @i18n as the model name. In the annotation file, you can reference a translation property in an annotation file using the following format:

{@i18n>@PropertyName}

For example, <PropertyValue Property="Label" String="{@i18n>@GeneralInfoFacetLabel}"/>, in the i18n.properties file, you should have a property with @PropertyName as the key. For example: # XTIT: Title @PropertyName=Property value.

Example

Sample Code
 "sap.app": {
    ...
    "dataSources": {
        "ZCD204_EPM_DEMO_SRV": {
            "uri": "/sap/opu/odata/sap/ZCD204_EPM_DEMO_SRV/",
            "type": "OData",
            "settings": {
                "annotations": [
                    "localAnnotations_1"
                ],
                "localUri": "localService/ZCD204_EPM_DEMO_SRV/metadata.xml"
            }
        },
        "localAnnotations_1": {
            "uri": "annotations/localAnnotations_1.xml",
            "type": "ODataAnnotation",
            "settings": {
                "localUri": "annotations/localAnnotations_1.xml"
            }
        }
    }
    ...
},
...
"sap.ui5": {
    ...
    "models": {
        "i18n": {
            "type": "sap.ui.model.resource.ResourceModel",
            "uri": "i18n/i18n.properties"
        },
        "ZCD204_EPM_DEMO_SRV": {
            "dataSource": "ZCD204_EPM_DEMO_SRV",
            "settings": {}
        },
        "@i18n": {
            "type": "sap.ui.model.resource.ResourceModel",
            "uri": "i18n/i18n.properties"
        }
    },
    ...
}
Data Exposed by OData Services

Both transactional and analytic overview page cards use data exposed by OData services. This can be any service that supports the following SAP annotations:

  • The properties within the entity type which have been annotated with sap:semantics="aggregate" should have either of the following annotations:

    • sap:aggregation-role="measure": Property represents a measure whose values will be aggregated according to the aggregating behavior of the containing entity type..
    • sap:aggregation-role="dimension": Property represents the key of a dimension
  • For each property, use the annotation sap:label to set the short readable text suitable for labels and captions on the UI. The property represents the key of a dimension.

  • For each dimension, use the annotation sap:filterable="true" | "false" to specify if the dimension can be filtered. Furthermore, the property can be annotated with the sap:filter-restriction attribute, if a filter restriction exists. The attribute can take the following values:

    • single-value: Only a single "equal to" clause is possible.
    • multi-value: Multiple "equal to" clauses separated by OR are possible.
    • interval: At most one "greater than or equal to" and one "less than or equal to" clause, separated by AND. Alternatively, a single "equal to" clause.
  • sap:semantics: This can take several values in the context of a property. The main values we support are:

    • unit-of-measure: Indicates that the property value refers to a unit of measure (preferably ISO). This value is used when displaying the unit of measure alongside the KPI value in the card header.
    • currency-code: Indicates that the property value represents the ISO currency code. This value is used when displaying the currency code alongside the KPI value in the card header when the KPI is currency based.
    • yearmonthday: Indicates that the property value represents the calendar year, month and day as string following the logical pattern YYYYMMDD. This is required by OVP Analytic cards that want to display time based information as time in the x-axis.
  • sap:unit: A path expression that identifies a property in the context of the entity type containing the currency code or unit of measure for a numeric value. This is used in conjunction with the sap:semantics to identify the property we would need to refer to in order to determine if the entity type represents an unit of measure or a currency code. For example, mounts in a currency or absolute measures must be represented as simple properties with an appropriate numeric Edm type, preferably Edm.Decimal. These numeric properties should refer to a string property containing the ISO currency or unit of measure with the sap:unit attribute.

    • <Property Name="OrderedQuantity" Type="Edm.Int16" sap:unit="OrderedUnit" />
    • <Property Name="OrderedUnit" Type="Edm.String" sap:semantics="unit-of-measure" />
    • <Property Name="Price" Type="Edm.Decimal" Precision="10" Scale="3" sap:unit="Currency" />
    • <Property Name="Currency" Type="Edm.String" sap:semantics="currency-code" sap:text="CurrencyText" />
    Note For more information about path expressions, see OData Version 4.0 Part 3: Common Schema Definition Language (CSDL) Plus Errata 02Information published on non-SAP site at the OASIS site.
  • sap:text: This would represent the value to be used for display purposes for an actual instance of the property. In the example below, it highlights the use of the values "India" and "Germany" instead of the abbreviation "IN" and "DE", respctively, for display purposes.

    In the metadata document:

    • <Property Name="Country" Type="Edm.String" sap:text="CountryText" />
    • <Property Name="CountryText" Type="Edm.String" />

    Actual data from backend:

    • <d:Country>IN</d:Currency>
    • <d:CountryText>India</d:CurrencyText>
    • <d:Country>DE</d:Currency>
    • <d:CountryText>Germany</d:CurrencyText>
Note

Details about the above listed annovations can found in the article SAP Annotations for OData Version 2.0Information published on SAP site on the SAP Community Network.