Replicate ABAP CDS Views from SAP S/4HANA Cloud to SAP Cloud Platform
With the release of S/4 HANA, 1711 customers can use ‘replicate CDS views’ app from SAP S/4HANA Cloud systems to replicate released CDS views from an SAP S/4HANA Cloud source system to an SAP Cloud Platform (SCP) target system.
This includes the underlying tables, data and to achieve seamless data replication to target SAP Cloud Platform systems. It also provides replication logs to effectively analyze the replications.
When data is replicated from SAP S/4HANA Cloud to SAP Cloud Platform, personal data is not protected by SAP Cloud Platform automatically. Customers are responsible for the SAP S/4HANA data made available on the HANA database of SAP Cloud Platform.
The app displays the list of available CDS views for replication.
You can choose to add or delete CDS views. In addition, you must publish to finalize changes in the target SCP system.
Choose to Add to replicate CDS views to the SAP Cloud Platform target system.
The status of the selected views is set to, To be Replicated.
To finalize the changes in the target system, choose Publish.
The status of the views changes to the following:
- Added views – Replicating.
- Deleted views – Deleting
To update the status of the views in process, choose (Refresh)
After successfully published to the target system, the status of added views changes to Replicated.
After the view is replicated to the target system, the SAP SLT framework keeps polling the tables to check for the latest data updates. This column displays the time when a table was last synced.
The replicated views can be seen in the target SCP system for the given schema.
Step-by-step guide to build an OData Service based on replicated CDS views from S/4 Hana
Once the replicated views are available in the target SCP system.
Create a schema for the wrapper view.
Right-click on the Catalog to save the schema>choose New>Schema in the context popup menu.
In the dialog enter the schema name.
Create a synonym for the router view in the wrapper schema as mentioned below.
CREATE SYNONYM “CDS_VIEW_REPLICATION_WRAPPER_VIEWS”.”I_PRODUCT” FOR “SCN_DEMO_TABLE_REPL_PUBLIC_VIEWS_CLIENT_100″.”I_PRODUCT”;
Create a package in the editor for creating the wrapper views and OData service to access in the Fiori application.
Right-click on the Content to save the package>choose New>Package in the context popup menu.
Right-click on the PACKAGE CREATED ‘CDS_VIEW_REPLICATION_WRAPPER_VIEWS’ to create the CDS.
Choose New>File in the context popup menu and create file name as I_Product.hdbdd.
Create the wrapper CDS as mentioned below.
Save and execute to access the data model.
Right-click on the PACKAGE ‘CDS_VIEW_REPLICATION_WRAPPER_VIEWS’ to create the xsodata.
Choose New>File in the context popup menu and create file name as I_Product.xsodata.
“CDS_VIEW_REPLICATION_WRAPPER_VIEWS::I_Product.I_Product” as “I_Product” key(“Product”) ;
Execute in the browser to test the OData service.