Show TOC

 Adding External Key Figures to a Fact Sheet

 

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:

    Syntax Syntax

    1. </edmx:Reference>
    2. <edmx:Reference Uri="'any server'/HANA/ODATA/IWFND/RMTSAMPLEFLIGHT/$metadata">
    3. <edmx:Include Namespace="RMTSAMPLEFLIGHT" Alias="FLIGHT"/>
    4. </edmx:Reference>
    End of the code.
  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 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.

    End of the example.
  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}.

    Syntax Syntax

    1. <Annotation Term="CB_SALES_ORDER_SRVAnnotation.FlightCosts">
    2. <UrlRef>
    3. <Apply Function="odata.fillUriTemplate">
    4. <String>/HANA/ODATA/IWFND/RMTSAMPLEFLIGHT/FlightCostsQuery( P_ExchangeRateType='M',P_TargetCurrency='{Currency}')/Results?%24select%3DCriticalAmountInDisplayCrcy</String>
    5. <LabeledElement Name="Currency">
    6.    <Apply Function="odata.UriEncode">
    7.      <Path>Currency</Path>
    8.    </Apply>
    9.   </LabeledElement>
    10. </Apply>
    11. </UrlRef>
    12. </Annotation>
    End of the code.
  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 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">.

    End of the example.
  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">.

Syntax Syntax

  1. <Annotation Term="UI.DataPoint" Qualifier="FlightCosts">
  2.      <Record>
  3.        <PropertyValue Property="Title" String="<%= otr(/SAPSRM/CH_WD_UI_BO/COST_OF_FLIGHT)%>"/>
  4.        <PropertyValue Property="Description">
  5.      <Record>
  6.            <PropertyValue Property="Label" String="<%= otr(/SAPSRM/CH_WD_UI_BO/FLIGHT_DESCRIPTION)%>"/> 
  7.            <PropertyValue Property="Value">
  8.              <Apply Function="odata.concat">
  9.               <String>Flight</String>
  10.                <Path>CARRID</Path>
  11.                 <String>Number</String>
  12.                <Path>CONNID</Path>
  13.               </Apply>
  14.             </PropertyValue>
  15.           </Record>
  16.         </PropertyValue>
  17.       <PropertyValue Property="Value" Path="@CB_SALES_ORDER_SRVAnnotation.FlightCosts/CriticalAmountInDisplayCrcy">
  18.       <Annotation Term="CQP.ISOCurrency" String="USD" />
  19.        </PropertyValue>
  20.        <PropertyValue Property="ValueFormat">
  21.        <Record Type="UI.NumberFormat">
  22.        <PropertyValue Property="ScaleFactor" Decimal="1"/>
  23.        <PropertyValue Property="NumberOfFractionalDigits" Int="2" />
  24.        </Record>
  25. </PropertyValue>
  26. </Record>
  27. </Annotation>
End of the code.

More Information

Adding Key Figures to a Fact Sheet

Extending a Search Model