For business that use S/4HANA as their ERP system, it contains Virtual Data Models (VDM). These VDMs are built with ABAP CDS Views delivered by SAP under branding Embedded Analytics.
In addition to direct access to these CDS Views, customers can also create new CDS views to be used for real time operational reporting as Transient providers in embedded BW system inside the S/4HANA system.
We will create a CDS View on SFLIGHT table in the S/4HANA system.
- Create a CDS view on the SFLIGHT table, the CDS View should be allowed for analytics
- A CDS view with analytics annotation CUBE creates a transient provider in S/4HANA system. Using the embedded BW system, you can create a query.
- Create a Analysis Office workbook on top of this query
With this exercise you will understand how to use CDS views for real time operational reporting without a separate BW system.
Step 1: Create CDS View
a) access the ABAP development perspective in Eclipse
b) choose New-> Abap Project and double click on your S/4HANA system
c) Logon with your credentials and choose Finish
d) In your new project, expand catalog to find the package under which you wish to create.
e) Use context menu of this package and choose new-> Other Abap Repository Object. Then choose Core data Services -> Data definition. Choose Next.
f) Enter the name and description ZSFLIGHT and choose Next
g) Select the radio button to create new transport request. Enter a description and choose Finish.
h) Replace all the code with the code shown below:
//Code for CDS view ZVSFLIGHT
@Analytics: (dataCategory: #CUBE)
define view ZVSFLIGHT as select from sflight (
carrid as Airline,
connid as FlightConnection,
fldate as FlightDate,
price as FlightPrice,
currency as Currency,
planetype as AirlineType,
seatsocc as NumberOfOccupiedSeats
where carrid = 'DL'
i) Activate this CDS view using match stick icon
j) Return to SAP HANA Admin Console perspective. Expand the catalog, then the schema for your S/4HANA system. Use the context menu option Filters on the views folder and filter on the SQL view name ZSVIEWFLIGHT, the system created when you activated your CDS view.
Double click on the view to open it, then choose create statement to review the generated SQL code.
k) A CDS view with the analytics annotation CUBE creates a BW transient provider in our S/4HANA system. Using the embedded BW system, you can create a query.
Step 2: Create a query
a) Open the BW modeling perspective in eclipse. In the project folder choose -> New query
b) Use the generated transient provider name 2CZSVIEWFLIGHT. Give name and description to the query. Choose Finish.
Note: The 2C is the naming convention SAP choose for these transient providers.
c) Access the infoprovider tab and then choose sheet definition
d) Drag some fields to rows and some to columns. Save your query and see the data preview.
Note: The CDS view has hard coded filter as airline ‘DL’. With more complex CDS views, you can have user parameter to select the airline.
Step 3: Create Analysis for Office excel on top of this query.
a) From the windows start button, select Analysis for Office and choose analysis tab in the tool bar at the top.
b) Select Datasource, choose skip to login to Business Objects Enterprise.
c) In the select datasource dialog box, choose S/4HANA system and log into with your credentials
d) In the search screen at the bottom, select query radio button, give your query name and choose magnify glass icon, then select query by double clicking on it. It should open in workbook. There is no need to save the workbook.