This blog is intended for creating custom CDS view. CDS views are open (i.e., the CDS views definition can be deployed on any database supported by the SAP system).
What is a CDS view
Core Data services are new next-generation modeling object from SAP. In short words, it will be the one-stop place for all the modeling with embedding DDL (Definition), QL (Query) and DCL (Control). It works with Code push down approach with database doing the heavy lift.
You can find more about CDS in below SAP link. CDFS has two flavors. 1) ABAP CDS which behave as full ABAP native object defined in ADT. 2) HANA CDSW which is more native to Hana database modeling.
More about CDS concepts -
ABAP CDS - https://help.sap.com/viewer/f2e545608079437ab165c105649b89db/7.51.1/en-US/4ed2245c6e391014adc9fffe4e204223.html
HANA CDS - https://help.sap.com/doc/29ff91966a9f46ba85b61af337724d31/2.0.00/en-US/SAP_HANA_Core_Data_Services_CDS_Reference_en.pdf
*Below blog is intended for ABAP CDS modelling
CDS view types
We have three main types of CDS View (Few others for Extensions)
Basic view – First level of CDS virtual model which is mostly one on one replication of database table. Basic views can be Dimension type or Fact type. The basic view will be mostly private and avoid user consumption for BI
Composite view - Composite view have joins/associations between Fact and Dimension basic views. Composite views are like cubes. we can define aggregation types and calculations in Composite view
Consumption view – Query views on top of composite view with all the end user semantics and can be consumed in any BI tool including Firoi apps
Setting up Eclipse and ADT
Step 1 – Login to Eclipse and start ABAP Prospective
Step 2 – Create a new ABAP project for the desired backend system
Step 3 – Add the package where the objects will be stored as a favorite so it can be easily accessible
Creating a Basic view on ACDOCA table
Navigate to Core data services under the above added package.
Step 1 – select new from the context menu on core data services and give a relevant name as per naming standards
If the change management is turned on, it will prompt to select a transport. After selecting the transport request, a pop-up with predefined templates are available to kick-start, select “Define view”
Click finish. The template will come up with standard annotations and please update the code with relevant names and add table fields names.
Key annotations :
Validate the code and activate.
Check data preview.
Creating a Composite view
Composite views are intermediate views where typically all the semantics and calculations are done.
Step 1 – Create a new CDS view same as basic view ( ABAP annotations will define the view type)
(Optional = select annotation type template for predefined code skeleton)
Below is the Composite view definition with Associations and data category is Cube. Data extraction annotation will also adds extends CDS view as an extractor in ODP
Finally, create a Consumption view/ Query. Below annotation will create Odata and Transient Bex for BI consumption.
Key annotations :
@odata.publish: True – creates a OData service for UI / Fiori consumption
@analytics.query: True – Creates a Transient Bex for BI consumption
Once the consumption view with analytics query annotation is activated we can check the transient query in RSRT T code
Bex query naming: 2C
Consuming in Fiori Query Browser App
Navigate to SAP Gateway system and activate the OData services for the above CDS View
Login to Fiori Launchpad
Pre reqs – Query Browser app and Security setup is done
Consuming from Analytics – Cloud
Create a Live/Import connection ( You can use the existing one if you want)
Create a Model and consume the Transient Query (2C)
Planning models can be created on Transient Bex planning queries with required Annotations.
Please reach out to us, Let Tek -Analytics take care of S4 Analytics strategic planning and development for you :)
- Karthik Addula