Show TOC

Adding External Key Figures to a Fact SheetLocate this document in the navigation structure

Use

To integrate an external key figure to your fact sheet, you pass the key figure from an OData service provider for external key figures to the DataPoint term in your annotation file by changing the relevant property value.

Activities

To integrate an external calculated key figure, you change the annotation file as follows:

  1. Add an edmx reference to the external data provider system. Enter the URL to the OData service that retrieves the metadata to the OData service providing the key figure. Additionally, a namespace and an alias must be assigned, for example:

    </edmx:Reference> <edmx:Reference Uri="'any server'/HANA/ODATA/IWFND/RMTSAMPLEFLIGHT/$metadata"> <edmx:Include Namespace="RMTSAMPLEFLIGHT" Alias="FLIGHT"/> </edmx:Reference> 
  2. Declare a term name.

    The term name must be added within the schema section. The term name must point to the relevant result type of the OData service, such as a Entity, Entity Set, or Property.

    Example

    <Term Name="FlightCosts" Type="FLIGHT.Flight" />

    In this example, the term name FlightCosts points to the Entity Set FLIGHT.Flight of the corresponding OData service.

  3. Define an annotation referring to the OData service that provides the key figure, such as an SAP HANA Live OData service.

    The annotation consists of the annotation file’s alias and the newly defined term. The URL to the external data provider query must be embedded with the tag <UrlRef> and entered as <String>.

  4. Optionally, you can retrieve values from the fact sheet OData service to restrict the OData service provider query for external key figures.

    Use the function odata.fillUriTemplate.

    Values that are referenced from a labeled element of the annotation file must be marked with braces, that is: <Queryparameter>= {LabeledElement}.

    <Annotation Term="CB_SALES_ORDER_SRVAnnotation.FlightCosts"> <UrlRef> <Apply Function="odata.fillUriTemplate"> <String>/HANA/ODATA/IWFND/RMTSAMPLEFLIGHT/FlightCostsQuery( P_ExchangeRateType='M',P_TargetCurrency='{Currency}')/Results?%24select%3DCriticalAmountInDisplayCrcy</String> <LabeledElement Name="Currency">    <Apply Function="odata.UriEncode">      <Path>Currency</Path>    </Apply>   </LabeledElement> </Apply> </UrlRef> </Annotation> 
  5. In the annotation file, search for the term <Alias>.DataPoint, or add a new DataPoint term as described in the following example.

  6. Copy the complete annotation section that contains the <Alias>.DataPoint description.

  7. Change the necessary properties.

    The key figure from an external data provider can be addressed with @+ ‘<annotation> ’ + ‘/’+ <Key Figure>

    Example

    <PropertyValue Property="Value" Path="@CB_SALES_ORDER_SRVAnnotation.FlightCosts/CriticalAmountInDisplayCrcy">.

    In this example, the key figure CriticalAmountInDisplayCrcy is addressed with @CB_SALES_ORDER_SRVAnnotation.FlightCosts/CriticalAmountInDisplayCrcy">.

  8. Save your changes.

Example

You add an external key figure to the annotation file. The key figure is passed to the DataPoint term as follows:

  • With a title that is as an OTR text /SAPSRM/CH_WD_UI_BO/COST_OF_FLIGHT.

  • With a description that is structured as follows:

    • A label coming from an OTR text /SAPSRM/CH_WD_UI_BO/FLIGHT_DESCRIPTION.

    • A value that is concatenated from the fields CARRID for the airline, and CONNID for the flight number.

  • With the key figure CriticalAmountInDisplayCrcy that is addressed with @CB_SALES_ORDER_SRVAnnotation.FlightCosts/CriticalAmountInDisplayCrcy">.

<Annotation Term="UI.DataPoint" Qualifier="FlightCosts">      <Record>        <PropertyValue Property="Title" String="<%= otr(/SAPSRM/CH_WD_UI_BO/COST_OF_FLIGHT)%>"/>        <PropertyValue Property="Description">      <Record>            <PropertyValue Property="Label" String="<%= otr(/SAPSRM/CH_WD_UI_BO/FLIGHT_DESCRIPTION)%>"/>             <PropertyValue Property="Value">              <Apply Function="odata.concat">               <String>Flight</String>                <Path>CARRID</Path>                 <String>Number</String>                <Path>CONNID</Path>               </Apply>             </PropertyValue>           </Record>         </PropertyValue>       <PropertyValue Property="Value" Path="@CB_SALES_ORDER_SRVAnnotation.FlightCosts/CriticalAmountInDisplayCrcy">       <Annotation Term="CQP.ISOCurrency" String="USD" />        </PropertyValue>        <PropertyValue Property="ValueFormat">        <Record Type="UI.NumberFormat">        <PropertyValue Property="ScaleFactor" Decimal="1"/>        <PropertyValue Property="NumberOfFractionalDigits" Int="2" />        </Record> </PropertyValue> </Record> </Annotation>