• Solutions
  • Services
  • Sectors
  • Sharing
  • About Us

S/4 HANA and SAP Datasphere: Gaining Additional Insights into Technical Details of CDS Views 

Purpose

Are you looking for information on how existing CDS views are structured from a technical perspective in your S/4 HANA source system? Do you want to identify how to (re-)use them more effectively to enable business reporting requirements in Datasphere? Then you’ve come to the right blog! 

In this blog, we provide a step-by-step approach to use scattered system information on CDS views and their components in S/4 HANA, in Datasphere, allowing you to accelerate your analysis process when new business reporting requirements arise. 

Use Case

Your company uses an S/4 HANA system as one of its primary reporting sources in Datasphere. Business reporting requirements may arise from: 

  • Enhancements related to an existing S/4 HANA Embedded Analytics report or application used by the business. 

  • Migrating or rebuilding legacy requirements with existing CDS structures as starting point. 

  • Generic inquiries about where specific data originates within CDS views. 

To illustrate these three points, the ‘Material Stock at posting date’ Query will be used as an example.  

Initial questions (1): ‘I need S/4 HANA inventory reporting in Datasphere, just like…’ …It was possible with the SAP BW Business Content 2LIS_03 (BF, UM, BX) extractors. 

The S/4 HANA setup for Inventory reporting differs significantly from the traditional ECC landscape. Some data is now stored in ‘new’ tables (e.g.  MATDOC), while certain features, such as using a 2LIS Extractor with a Replication Flow towards Datasphere, may not function as desired. 

However, after exploring Embedded Analytics content, via the following blog, the business team discovered the ‘Material Stock at posting date’ Query which closely resembles their previous BW report: 

The requirement is to combine this data with other non-SAP data already available in Datasphere. However, since the Query includes an Input Parameter, it cannot easily be replicated towards. Datasphere using delta-enabled processes. So, how can we obtain the necessary information? 

Initial questions (2): ‘I need an overview similar to the SQL Dependency Analyzer, but…’ 

…Without having to access the backend system (e.g. via Eclipse) and with more flexibility such as Input Parameters and additional metadata of the CDS view (e.g. field types). 

The ‘C_MaterialStockByKeyDate’ data definition was identified for the ‘Material Stock at posting date’ report. Using the SQL Dependency Analyzer the following dependency tree was generated: 

A similar overview, but with additional details in a more user-friendly format (e.g. tabular representation), is now the end goal. 

Information (1): S/4 ‘Dictionary’ sources to use 

To generate such a usable SQL Dependency Analyzer-style overview, the following technical sources can be investigated: 

 

Due to new additions in the CDS concept, such as the ‘define view entity’ (in addition to the traditional ‘define view’) within the Data Definition, some table relations are incomplete (e.g. the DDLDEPENDENCY table for CDS views with ‘define view entity’ does not have a DDLDEPENDENCY-OBJECTTYPE = ‘VIEW’ entry, only = ‘STOB’).   

For the C_MaterialStockByKeyDate example, this leads to: 

Where the CMATSTOCKBYKDATE ‘OBJECTTYPE’ = ‘VIEW’  can be used in e.g. the DD27S table: 

But, the I_MATERIALSTOCK_2 can not be used in a similar way, as it has no ‘OBJECTTYPE = ‘VIEW’ entry. To resolve this, more complicated CDS views using Left Outer Joins and Table Functions are available to generate the complete dependency list. 

For the sole purpose of generating the Hierarchy structure within Datasphere however, DDCDS_BOE_VIEWSTACK_INFO_UNION is sufficient and can be extracted as follows: 

This gives all the information for the complete dependency list: 

While other perspectives, such as DDCDS_LIST_DIRECT_BASE_ENTITY, could also achieve this, they might contain unnecessary or overly complex logic and information. 

 

Information  (2): Honorable mentions 

The following technical objects are noteworthy as enhancements, but not necessarily required for the hierarchy object dependency determination: 

Datasphere Developments  (1): Data sources and Logic 

Firstly, as mentioned in the ‘Information (1)’ section, for the hierarchy determination, the DDCDS_BOE_VIEWSTACK_INFO_UNION will be extracted into Datasphere. For some additional information, two other sources (mentioned in Information(2)) will be replicated in a similar way, namely; 

  • I_DATAEXTRACTIONENABLEDVIEW 

  • DDCDS_ENTITY_HEADER 

Using a Replication Flow: 

*Remark: if you encounter issues with this process, please have a look at Transaction Code CNV_NA_DI to see if all the latest Datasphere/Data Intelligence related notes have been implemented in S/4 HANA, to resolve earlier issues while loading CDS views with Replication Flows (e.g. the ‘partitioning failed’ loading error). 

Secondly, a SQLScript Table Function with WHILE loop is created to generate the hierarchy: 

  • Declare types and input parameter, and initialize the hierarchy’s: 

  • A WHILE loop to iteratively build the relationship: 

  • Generate the final output in tabular format: 

This function is combined with the additional metadata sources and consumed in an Analytical Model to get the following for the ‘Material Stock at posting date’ S/4 HANA CDS view (C_MaterialStockByKeyDate): 

Giving the following output: 

Key Takeaways: 

  • Use Cases: identifying S/4 HANA CDS View data structure and origins. 

  • Technical Insights: CDS view dependencies, SQL analysis, and key tables/views. 

  • Datasphere Implementation: Details extracting CDS structures, leveraging SQLScript Table Functions, and automating hierarchy generation. 

This blog helps streamline CDS view utilization in Datasphere for better business reporting. 

 

And many more… 

If you would like to know more about standardizing the usage of S/4 HANA CDS views within its Datasphere context? Please contact Nico van der Hoeven (+31651528656). 

Are you a Friend of McCoy?

As an innovation partner, we want to continue inspiring you. That's why we gladly share our most relevant content, events, webinars, and other valuable updates with you.