S4HANA – Generic Delta Enablement for ABAP CDS views which can be used for BW extraction.
Overview:
Generally SAP provided extractors are enabled with delta capability with different delta type like AIM, ADD, ABR. As per SAP roadmap ABAP CDS views are going to be used for BW data extraction but currently standard/custom CDS views are not matured to handle delta till S4HANA 1511 SP02.
SAP has released set of new annotations in S4HANA 1610 version. In this blog we are going to see how to use these new annotations which can enable the generic delta capability in SAP provided or custom ABAP CDS views.
Step 1: For Demonstration purpose we are creating a new CDS view based on standard CDS view I_SalesDocument, directly you can enhance your standard CDS but make sure there is no impact due to your change.
Step 2: Provide your CDS view technical name and description
Step 3: Select the view template which you require, for illustration purpose I am using the first template.
CDS Model should bring data from standard CDS view I_SalesDocument, till now all the activities and annotations are common to all the versions. To enable any CDS view with delta capability then use the newly published annotations which are highlighted in (Green).
Pre-Requsities:
- Date or Time stamp field presence in the table.
- Should select the delta pointer field also as part of your extraction.
- Before enabling CDS view with delta ensure the field can able to bring delta records for both creation and change.
- Maintain proper representative key and key definition for your CDS view otherwise you will face syntax errors.
On successful activation your CDS view is now enabled with generic delta capability.
Step 4: Now start to build your data model in BW here we are going to develop the data model in BW7.5 through eclipse modeler.
Extraction will happen based on the created CDS view hence replicate the CDS view under ODP-ABAP CDS Views.
Step 5: Select the required data source (CDS View) from the list to proceed further.
Now your data source is replicated successfully in BW.
Step 6: Once the data source is replicated open the data source in eclipse and ensure the delta process is as shown below.
I have noticed other delta type as ADD but here we are not going to focus about this delta type.
Activate the data source.
Step 7: To stage the data in BW create ADSO from eclipse modeler.
Step 8: Maintain the key fields and data fields.
Step 9: Create transformation and DTP from eclipse modeler.
Step 10: Though it is ODP for testing purpose created an Info-package and ran it as Init with data transfer for the first time load.
PSA request and load details.
Step 11: Lets take one Sales document # to ensure delta is working as expected.
Load the data from PSA to ADSO.
ADSO output for the selected sales document #
Step 12: Now go to VA02 T-code in S4HANA system to change the sales document #.
Here we have changed only the Sold To Party number from 10100100 to 10100001.
Step 13: Now execute the infopackage for delta, extraction is bringing only the delta records.
Load the data to ADSO.
ADSO output.
Delta record is reflecting in ADSO output.
Observation: These two new annotations are working perfectly for any creation/modification postings but it is not bringing delta when there is any deletion or cancellation. Hope SAP will provide or enhance the annotation to handle this situation.Working to identify is there any alternate approach to handle this.
Conclusion: Now we can leverage the generic delta capability in ABAP CDS views which is not possible in earlier S4HANA versions.While selecting the delta field make sure the selected field is the right field for delta. Also be cautious that current annotations are not capable to handle Delete/Cancellation postings so before enable any CDS view with delta capability consider the current annotation limitations.
Nice Work, thanks Muruga MuthuKrishnan. Is there any specific advantage of using cds views as source instead of regular generic datasoures which we build traditionally ? Do you have any idea on standard business content extractors which are based on cds views ? thanks
I didn't investigate about the specific advantage but my understanding is
As per my understanding Universal Journal extractor use CDS views and rest are optimized. We may expect standard CDS views based extractor in future.
Nice blog! appreciate your work!
Very helpful! Just a typo on delta column LastChangeDateTime:
@Semantics.systemDate.lastChangedAt: true -> @Semantics.systemDateTime.lastChangedAt:true
Good one