Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
ssurampally
Active Contributor
14,623
As you already know ABAP CDS views are the foundation objects for S/4 embedded analytics space, so the entire ERP Virtual data model(VDM) is built on CDS., then these CDS view models can be consumed by Client applications like fiori and BI tools.

S/4 analytics is a very good use case, provided if the dataset is only from ERP/S4 system, because CDS view VDM is not designed for Enterprise Datawarehouse(EDW) purpose. However, there could be a scenario, 95% of the data is from the ERP/S4 system and 5% may be other SAP systems like CRM/Success factors or any Non-SAP system to be used for analytics purpose.  For that, we may have to get non-ERP data directly into underlying HANA database of S/4 System using one of the data provisioning techniques like SLT, Data Services, SDA/SDI., therefore these tables are going to be not available in S/4 ABAP layer, hence they can’t be accessed directly in S/4 ABAP CDS views. But it has to be for analytics on 100% consolidated data.

In this blog, I will explain, how to access the Non-ERP schema data in ABAP CDS views, for that CDS Table functions are used, this object was introduced with SAP Netweaver 7.50 version, gives flexibility to implement native SQL script with ABAP classes, more details on this object can be found in sap help documentation here.

The below picture shows the use case I am talking about,



S/4 ERP having the billing data for America region, Europe region data is in other non SAP system, so data extracted into HANA and it is available in Native Schema only. Now with the table function and AMDP class and method implementation, I can access the native HANA SQL objects to read data. Then this table function can be used in the VDM CDS view which already had the access to ERP America region data.

Both data sets can be consolidated in the CDS view, therefore, the final consumption view can be used as the infoprovider for analytical applications.

this above process can be done in 3 steps explained below.

Step 1: Creating a CDS table function with the structure required as return parameters. The code likes below,  the navigation for doing this can be found the SAP help documentation link provided earlier in this document.
@EndUserText.label: 'CDS for Non ERP data'
@ClientDependent: true
@AccessControl.authorizationCheck: #NOT_REQUIRED

define table function YCDS_NON_ERP
with parameters @Environment.systemField: #CLIENT
clnt:abap.clnt, company_code:bukrs
returns {
client : s_mandt;
customer : kunnr ;
bill_amount : netwr;
}

implemented by method ZCL_EXAMPLE_AMDP=>BILLING_EUROPE;

the class and implementation are quoted here in the CDS table function at the end, the class and method implementation is done in the next step.

Step 2:  Implementing AMDP Class and method, in this native SQL can be written to work HANA DB tables, views and procedures. In our scenario, my non ERP table is BILLING_EUROPE and it is in the HANA schema SSURAMPALLY., I am going to read the table and project the output to the table function as return value.  I can also pass the parameters, in this example client and Company are passed.
class ZCL_EXAMPLE_AMDP definition public.

public section.
interfaces IF_AMDP_MARKER_HDB.
class-methods BILLING_EUROPE for table function YCDS_NON_ERP.
protected section.
private section.

ENDCLASS.

CLASS ZCL_EXAMPLE_AMDP IMPLEMENTATION.

method BILLING_EUROPE by database function
for hdb
language sqlscript
options read-only.

RETURN SELECT mandt as client,
Customer,
Bill_amount
FROM SSURAMPALLY.BILLING_EUROPE
WHERE mandt = :clnt AND
comp_code = :company_code ;
endmethod.

ENDCLASS.

Step 3: then finally, CDS table function (YCDS_NON_ERP) defined in Step 1, will be consumed/used in the Consumption CDS view to consolidate Europe billing data with America.

This is a simple example I have taken to explain, however there could be a complex SQL code implementation in AMDP class to get the required data from Non ERP schema tables and consolidate with ERP schema data tables.

So therefore, though S/4 VDM is fully integrated and designed for S/4 ERP, Native SQL tables/views which got data from other SAP systems can still be easily integrated into VDM CDS Views using Table functions CDS.

I hope it is helpful..

Thanks

Sreekanth

 
5 Comments
Labels in this area