In the SAP ecosystem, real-time access to business data is crucial for timely decision-making. SAP HANA Live enables operational reporting directly on transactional data by leveraging advanced data modeling techniques like CDS Views and Virtual Data Models (VDM). To make this rich data accessible to front-end applications and analytics tools, SAP uses OData Services—a standardized, RESTful protocol for querying and updating data.
This article discusses the essentials of implementing OData services for analytical reporting in SAP HANA Live, covering design considerations, development steps, and best practices.
OData (Open Data Protocol) is an open standard for building and consuming RESTful APIs. It allows clients to query and manipulate data through HTTP requests, supporting operations like filtering, sorting, paging, and metadata discovery.
In SAP HANA Live, OData services expose CDS Views as APIs that can be consumed by SAP Fiori apps, SAP Analytics Cloud, third-party BI tools, or custom applications.
Design a Consumption CDS View that defines the analytical data model.
Use annotations to make it ready for OData exposure:
@OData.publish: true
@Analytics.query: true
define view Z_AnalyticalSales as select from sales_order {
key sales_order_id,
customer_id,
sales_amount,
sales_date
}
Include necessary analytical annotations (e.g., @Analytics.dataCategory, @Semantics.amount.currencyCode) to support rich metadata.
Z_AnalyticalSales_CDS).$filter, $orderby, $top, and $expand queries.@Consumption.filterable, @Consumption.sortable.@AnalyticsDetails.query annotations for complex analytical queries and drill-downs.@AccessControl.authorizationCheck: #CHECK).$top, $skip) and select only required fields.A client can query sales orders with high sales amounts and order them by sales date descending:
GET /sap/opu/odata/sap/Z_AnalyticalSales_CDS/AnalyticalSalesSet?$filter=sales_amount gt 1000&$orderby=sales_date desc&$top=10
The result is a JSON payload with the top 10 sales orders filtered and sorted in real-time.
Implementing OData Services for analytical reporting in SAP HANA Live unlocks the power of real-time data insights with seamless integration to SAP Fiori, BI tools, and custom applications. By carefully designing CDS Views, leveraging annotations, and following best practices, SAP professionals can deliver high-performance, secure, and user-friendly analytical solutions.