Implementation and Activation of Embedded Analytics with SAP S/4 HANA
Analytics in context of SAP S/4 HANA
Below is the complete portfolio of analytics as shown in figure1:
Figure1 Complete Solution to Run, Analyse and Manage Business
By mixing the use cases for Embedded and Strategic Analytics, the full range of either real-time and fine granular data to high level and multiple source data can be realized. Both concepts of Enterprise Data Warehousing and real-time analytics can be merged, reports and analyses being mashed up and reported in a single report, dashboard or other visualization.
Few SAP Analytics Solutions are mentioned below:
- Embedded BW
- Hybrid of Embedded Analytics and Standalone BW/DWH
- Analytics in S/4 HANA (S/4 HANA Embedded Analytics) – Which will be discussed in this blog.
Embedded BW
SAP BW is automatically included in SAP ERP systems since SAP NetWeaver 6.40. The SAP BW technology that exist inside such an ERP system is called as Embedded BW. Embedded BW supports technically all BW native functionality including SAP BPC processes. Embedded BW is used to support certain business Processes in SAP Business Suite and in SAP S/4HANA example Integrated Business Planning for Finance. From the outside perspective, the product that is sold to and installed at a customer is SAP Business Suite/ SAP S/4 HANA.
In general SAP strongly recommends to use Embedded BW only for SAP standard Scenario. Beyond these cases, rules and limitations apply:
- SAP strongly recommends not to use Embedded BW for Data Warehouse Scenario. While SAP recommends to go for BW/DWH system as global data integration layer. Data from each sub-system are gathered into this integration system.
- Amount of data persisted in Embedded BW should not exceed 20% of the overall data volume of the system. This applies to Extraction from own Suite or S/4 HANA system, Integration of data from external applications or Data from planning applications.
- License Implications: Use of BPC requires a separate license.
- Security/Authorization Aspect: Embedded BW relies on a separate authorization concept. Authorizations from Suite/ S/4HANA do not apply but need to be mapped if required.
- Client Distribution: SAP Recommends a separate Client for Embedded BW. Firstly, for organizational reasons to streamline the process of development and administration. Secondly, whenever the data is physically replicated from another SAP application (on same system) to Embedded BW it is advisable to have a separate client.
Hybrid of Embedded Analytics and SAP BW/4HANA
Combination of embedded analytics and EDW cases and data
- Accelerated inclusion of SAP S/4HANA data into the global reporting platform
Leveraging SAP BW/4HANA you can natively integrate the embedded analytics models and data in SAP S/4HANA with those of an EDW, e.g. to compare real-time actuals with historical snapshots, planning results (from BPC), or external data. SAP BW/4HANA is the innovation platform for EDW. Although integration is also already possible with SAP Business Warehouse powered by SAP HANA, all new enhancements regarding the integration of SAP S/4HANA and SAP BW will be implemented in SAP BW/4HANA. Figure2 shows Hybrid Model.
Figure2 Hybrid Model
SAP S/4 HANA Embedded Analytics
The main way to consume embedded analytics is not through BW/embedded BW but through either the multidimensional reporting client in Fiori, Smart Business KPI’s and directly through SAP BOBJ solutions on top of the transient provider which is generated in the Analytical Engine WITHOUT involvement of the embedded BW.
SAP Best Practices for Analytics in SAP S/4HANA
SAP Best Practices for analytics with SAP S/4HANA provides a comprehensive portfolio of analytical content based on SAP S/4HANA. It provides guidance on how to get started with SAP S/4HANA embedded analytics and how to integrate with best in class analytical platform and solutions from SAP for example: SAP Analytics Cloud, or SAP Cloud Platform.
Further details can be checked in SAP Note 2271853 – SAP Best Practices for analytics with SAP S/4HANA
Below are some terms used in context of analytics.
Virtual Data Model (Referred as VDM)
Figure3 Virtual Data Model
SAP provides a virtual data model comprised of CDS views; it represents the complete SAP business application data structure. These CDS views are accessed by both transactional and analytics interfaces, by SAP BW extractors, and by external SAP Business Objects BI clients. For non-disruptive upgrades to SAP S/4HANA and to protect customer investments, SAP also provides CDS views as compatibility views for the aggregates and indices tables (of previous SAP Business Suite applications).
Key Components of embedded analytics architecture:
Analytical Engine
The embedded SAP BW system is responsible for OLAP functions and services for other SAP BW functionalities (like planning and the SAP HANA application process designer). It also compensates for functionalities (pivoting, hierarchies, aggregations, and formula execution) not (yet) available in SAP HANA.
Upon activating consumption CDS views, a transient provider or transient SAP BEx query is created in the embedded SAP BW system. SAP Business Objects BI tools (like SAP Business Objects Design Studio) use these transient providers to query data from the consumption CDS views.
Interfaces
SAP S4/HANA analytics provides data access using OData, SAP HANA Info Access, and Business Intelligence Consumer Services (BICS) interfaces, depending on the client tools. The frontend applications use mostly OData as the communication protocol inside the SAP Fiori interface. There are some exceptions, such as SAP Lumira, SAP Design Studio, and enterprise search, which uses SAP HANA Info Access protocols because they don’t yet have OData implementations.
These interfaces are used to enable real-time data access for VDM consumption and interface views. Let’s go over the interfaces and their uses:
- OData
OData is an open protocol that allows for creation and consumption of queryable RESTful APIs in a simple and standard way. OData can be used to build RESTful APIs without worrying about the technical aspects of Internet communication (e.g., request and response headers, status codes, HTTP methods, URL conventions, media types, payload formats). This protocol is used by HTML5/SAPUI5-based applications, such as SAP Fiori apps. - SAP BW InA
The SAP BW InA interface is simple interface to access the SAP BEx query definitions. This interface is being replaced in favor of the BICS interface, which is used by SAP Business Objects BI tools. - SAP HANA Info Access (InA)
The SAP HANA InA interface is a search engine interface to deal with large amounts of unstructured textual data, such as customer reviews, incident logs, and patent details. It is capable of simple keyword searches, linguistic searches, error-tolerant searches, to handle typos (”tadabase” will find database); semantic searches (”cat” will find pets); phrase searches (”white house” will find white and house in sequence); and pattern searches (”poly*” will find polymer and polycarbonate). - BICS
BICS is the SAP BW data access layer for SAP BEx tools. BICS connectivity is the recommended way for SAP Business Objects BI tools to connect to transient queries or transient providers generated for consumption CDS views on the SAP-embedded SAP BW analytic server.
The following is a sample list of SAP Business Objects BI tools and their preferred interfaces:
- SAP Fiori: OData
- SAP Design Studio (as SAP Fiori app): BW InA
- Enterprise search: SAP HANA InA
- SAP Design Studio (standalone): BICS
- SAP Business Objects Analysis edition for Microsoft Office: BICS
- SAP Enterprise Performance Management (EPM) Add-in for Microsoft Excel: BW InA
- SAP Business Objects Analysis for OLAP: BICS
Figure 4 shows End to End Development Models involved.
VDM CDS View Relationship:
Figure5: View Relationship
Important Annotations for S/4 HANA Embedded Analytics:
VDM annotations
@VDM.viewType: BASIC or COMPOSITE or CONSUMPTION or EXTENSION
#CONSUMPTION: A VDM consumption view consumes other VDM views but is not available for reuse by other views.
#COMPOSITE: A VDM view built on one or more basic and composite views. It is often deformalized or a specialization of other views or a convenient composition that is often reused.
#BASIC: Basic Views form the lowest layer of VDM and encapsulate the database table. They form an (almost) redundancy-free and normalized semantical model of suite application data.
#EXTENSION: View containing the key and all extension fields of an extension context.
ObjectModel annotations
Define structural and transactional aspects of the business data model.
@ObjectModel.dataCategory: #TEXT or #HIERARCHY
#TEXT: This view contains language-dependent text, such as a name or description.
#HIERARCHY: This view contains a definition of an external hierarchy.
@ObjectModel.foreignKey.association: <foreignKeyAssociation>
This is used to define a field with foreign key association (to an entity that provides a list of values for that field).
@ObjectModel.text.association: <textAssociation>
This is used to define a field with a text association (to an entity which provides language-dependent name or descriptions for that field).
Analytics annotations
Used by the analytics manager for multidimensional reporting to perform data aggregation.
@Analytics.dataCategory: #FACT or #DIMENSION or #CUBE or #AGGREGATIONLEVEL
#DIMENSION: Master data, including association to attributes, texts, and hierarchies. This view provides the dimension information in multidimensional analytics and can also be used separately as an analytical data source.
#FACT: Transaction data should have at least one measure. Provides data for analytics in a normalized format and is typically used for extraction of data but not for direct analysis.
#CUBE: Represents a star schema—that is, transaction data with associations to all elements of master data. Transaction data containing all the relevant fields for data aggregation.
Note: A cube is based on only one #FACT view and one or more #DIMENSION views.
#AGGREGATIONLEVEL: View for analytical planning.
@Analytics.query: blank (=true), true, false
This view defines an analytical query that is executed by the analytical engine. The analytical engine can process specific features like restricted measures, formula aggregation, and exception aggregation. Analytical query views reside in the consumption layer.
Note: An analytical query view doesn’t carry an analytical data category.
@Analytics.dataExtraction.enabled: true, false
Specifies that a CDS view is suitable for data extraction. The view can be used for data extraction in a data warehouse.
@Analytics.planning.enabled: true, false
This annotation is used to define input-enabled analytic queries for planning.
Field-level annotations
Used by the processing engines for data processing, analytics, and data consumption.
@Semantics.unitOfMeasure: true
Identifies a unit of measure.
@Semantics.currencyCode: true
Identifies a currency.
@Semantics.quantity.unitOfMeasure: <UnitOfMeasureField>
A quantity field, identified by its reference to unit of measure field.
@Semantics.amount.currency: <CurrencyField>
An amount field, identified by its reference to currency field.
@DefaultAggregation: #SUM, #MAX, #FORMULA
Defines a measure together with a default aggregation like #SUM or #MAX or #FORMULA.
Authorization annotations
Used to manage security aspects of views.
– @AccessControl.authorizationCheck: #NOT_REQUIRED or #CHECK
#CHECK value for nonprivate views requires an authorization check by a DCL.
#NOT_REQUIRED: An authorization check is not needed.
EndUserText Annotations
Enable an intuitive consumption of the data model in User Interfaces
#EndUserText.label: ‘LabelName’
Defines a human-readable text that is displayed besides input fields or as column headers.
Example of various CDS Views
Details for Table SCARR
Figure 6 Structure of Scarr Table
Details for Table SFLIGHT
Figure 7 Structure of Sflight Table
Below is an example for BASIC view based on SFLIGHT model wherein Carrier, Connection Id, Flight date and Aircraft are shown.
#Basic View ZSFLIGHTVIEW
@AbapCatalog.sqlViewName: 'ZSFLIGHTVIEW'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.representativeKey: 'Carrier'
@VDM.viewType: #BASIC
@Analytics.dataCategory: #FACT
@EndUserText.label: 'SFLIGHT VIEW'
define view Z_ISFLIGHT_VIEW as select from sflight {
key carrid as Carrier,
key connid as ConnectionId,
key fldate as FlightDate,
planetype as Aircraft,
@Semantics.amount.currencyCode: 'Currency'
price as Price,
@Semantics.currencyCode: true
currency as Currency,
paymentsum as TotBooking
}
#Interface View ZCDSISCARR
@AbapCatalog.sqlViewName: 'ZCDSISCARR'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #BASIC
@Analytics.dataCategory: #DIMENSION
@EndUserText.label: 'Airline'
@ObjectModel.representativeKey: 'CarrID'
define view ZCDS_I_SCARR as select from scarr {
key carrid as CarrID,
carrname,
@Semantics.url: true
url
}
S/4 HANA CDS Views are automatically exposed as ODP transient InfoProvider / BEx Queries.
Transaction code – RSRTS_ODP_DIS is to display the Transient providers. When you execute it, you will get the components of the object.
Figure 8a shows the step1 where you provide the ODP name or CDS View Name created.
Figure 8a Enter ODP Name and Execute
It’s divided into key part, Data part, Unit and Key figures. it is possible to define and execute a BW query directly on the Operational Data Provider. It is not necessary to replicate the data into BW. The BW query is defined and executed locally on top of a transient Info Provider, which is implicitly derived from the ODP.
Figure 8b is the output and structure is divided into key as CARRID, DATA as CARRNAME and URL
Figure 8b Transient Provider Information
Below is an example of interface view based on tables SFLIGHT and SCARR using the concept of association
#Interface View ZIFLIGHTSCARR
@AbapCatalog.sqlViewName: 'ZIFLIGHTSCARR'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Interface view for SFLIGHT and SCARR'
@Analytics.dataCategory: #FACT
@VDM.viewType: #BASIC
define view Z_I_FLIGHTSCARR
as select from Z_ISSFLIGHT_VIEW as _SFLIGHT
association[1..1] to ZCDS_I_SCARR as _scarr
on $projection.Carrier = _scarr.CarrID
{
@ObjectModel.foreignKey.association: '_SFLIGHT'
key _SFLIGHT.Carrier as Carrier,
_scarr.carrname as CarrierName,
_SFLIGHT.FlightDate as FlightDate,
@Semantics.url
_scarr.url as AirlineURL,
_SFLIGHT.Aircraft as AircraftName,
@DefaultAggregation: #MIN
_SFLIGHT.Price as MinimumPrice,
@DefaultAggregation: #SUM
_SFLIGHT.TotBooking
}
Same transaction: RSRTS_ODP_DIS
Figure 9 Transient Provider Information
Below is an example of consumption view which involves view Z_I_FLIGHTSCARR and exposed for query as well using the property @Analytics.query: true
@AbapCatalog.sqlViewName: 'ZCSFLIGHTSCARR'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Analytics.query: true
@VDM.viewType: #CONSUMPTION
@OData.publish: true
@EndUserText.label: 'Consumption view for sflight and scarr'
define view Z_C_SFLIGHTSCARR as select from Z_I_FLIGHTSCARR
{
@AnalyticsDetails.query.axis: #ROWS
Z_I_FLIGHTSCARR.AircraftName,
@AnalyticsDetails.query.axis: #ROWS
Z_I_FLIGHTSCARR.Carrier,
@AnalyticsDetails.query.axis: #ROWS
Z_I_FLIGHTSCARR.CarrierName,
@AnalyticsDetails.query.axis: #ROWS
@Consumption.filter: {selectionType: #SINGLE, multipleSelections: false, mandatory: true}
Z_I_FLIGHTSCARR.FlightDate,
Z_I_FLIGHTSCARR.MinimumPrice,
@DefaultAggregation: #SUM
Z_I_FLIGHTSCARR.TotBooking,
Z_I_FLIGHTSCARR.AirlineURL ,
@EndUserText.label: 'Discount booking'
@DefaultAggregation: #FORMULA
( Z_I_FLIGHTSCARR.TotBooking * 2 )as DiscountBooking
}
Above CDS view is automatically exposed as ODP transient provider which can be further checked in RSRT as BEx query. You can check the corresponding query by adding 2C as prefix to CDS i.e 2CZCSFLIGHTSCARR.
Figure 10a Enter Query Name in RSRT and Execute
Date is variable here as seen in Figure 10b
Figure 10b Enter Flight Date
Output : In the below figure 10c, Airline URL has been considered as free characteristic, Key figures as Columns and other characteristics as Rows
Query Designer
CDS views are automatically exposed as transient providers, and these transient providers are further available in BEx Query designer for further customization / design of queries. Naming Convention for transient providers starts with 2C*
In Query Designer search for InfoProviders starting with 2C* and you will find the corresponding InfoProvider like in the figure below.
Figure 11 Search for Query Name
Now you can play around and create your own query using same BEx Functionalities as shown in Figure12.
Figure 12 Query Designer View
OData as the interface
General FIORI UI5 Applications consumes OData in principle. Main Sources of OData are CDS Views, ABAP Logic and BW Queries. CDS view can be published to OData with annotation. ABAP logic to OData with transaction code SEGW and BW queries to OData with BEX Query Designer.
OData: CDS Views can be exposed as OData with “Annotation” and consumed by Fiori KPI tile, APF tile etc.
Transaction /n/iwfnd/maint_service
Figure 13 Services in tx /n/iwfnd/maint_service
For all the consumption views with annotation @OData.publish: true corresponding OData Service is generated.
Click on Call Browser link as shown in Figure 14 and provide the logon credentials asked there. It will n the URL for the service
Figure 14 Tx /n/iwfnd/maint_service with call Browser link
GET
http://localhost:<port number>/<context path>
To check the service document add $metadata to the URL
Metadata provides information such as Entity type, key property, properties and Entity Set name.
Would return the service document for a metadata service used to interrogate the data Service:
Find below the screenshot for few Query Options: $top , $skip $select
Top and Skip Option
Select Option
View Browser : This is used to find suitable views matching a business requirement and display its content for analytical queries in Design Studio
With this app, you can search, browse, and tag analytical and non-analytical queries.
OData Service which should be activated
For more Details, check the link https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/#/detail/Apps(‘F2170’)/S9OP
Z_C_SFLIGHTSCARR
Figure 15 : Consumption View created as seen in View Browser Fiori Application
Figure 16: Fields Available in Consumption View
Below are the annotations used in Consumption View
Figure 17: Annotations used in Consumption View
SAP HANA Live and S/4HANA Analytics concepts
With SAP Business Suite powered by SAP HANA, SAP started blending transactions and analytics allowing operational reporting on live transactional data. A migration from SAP Business Suite on HANA to S/4 HANA required a technological reorientation of existing reporting applications. A route from HANA live in SAP Business Suite on HANA to Analytics in SAP S/4 HANA.
SAP HANA Live comes with pre-build content (similar in concept like SAP BW content), in form of SAP HANA calculation views for real-time operational reporting. The content is represented as a VDM – virtual data model, which is based on the transactional and master data tables of SAP Business Suite powered by SAP HANA (including ERP, CRM, GRC, etc.). SAP HANA Studio is the SAP HANA application where the calculation views for these VDM are developed and maintained.
With SAP S/4 HANA the same concept is supported in form of SAP ABAP Managed Core Data Services new data structure for real-time operational reporting. Here also the content is represented as a VDM – virtual data model based on the transactional and master data tables of SAP S/4 HANA. Core Data Services (CDS views) are developed, maintained and extended in the ABAP layer of the S/4 HANA System. The system generated SQL-Runtime-Views in SAP HANA are used to execute the data read and transformation inside the SAP HANA Database Layer.
SAP’s focus is to create a Virtual Data Model using Core Data Services (CDS views) as to support (and replace all other standard ABAP-related standard) operational reporting in the context of S/4HANA.
VDM’s are technically based upon CDS views starting from S/4 HANA 1511 instead of HANA views. Before SAP S/4 HANA 1511, HANA views directly on HANA DB layer were used as foundation for Analytics. With NetWeaver 7.4 SP8, CDS views can be technically utilized as depicted in Figure.18.
Figure 18: SOH, S/4 HANA Simple Finance vs. S/4 HANA 1511
Figure 19 illustrates difference between ABAP CDS and HANA CDS Views
Figure 19: ABAP CDS vs. HANA Views
Path for Adaption of SAP HANA live Content to operate in SAP S/4 HANA Environment
Yes, the VDMs used in SAP HANA Live can be adapted to the new SAP S/4HANA data structures, but they will still require a separate security profile for SAP HANA. In addition, customers that have created their own custom calculation views for SAP HANA Live should adapt them to the new data structures for use in SAP S/4HANA environments. Few Supporting notes which clearly highlights that strategic decision is taken to switch the technology from Calculation View to CDS Views with SAP S/4 HANA
- 2270360 – S4TWL – Calc View-Based Reporting (HANA live)
- 2318151 – Removal of HANA Live for PLM OData service artefacts
- 2270359 – S4TWL – Invoice and Goods Receipt Reconciliation (HANA live)
Best Regards,
Megha Gandhi and Esha Rajpal
(Authors)
Hi Megha, Is there a roadmap/release date for Graphical Editor for ABAP CDS views?
Thanks