CDC data extraction Lessons Learned, Tips & Tricks – Part 2 

Introduction 

This blog series is about warnings and error messages that you may encounter with using CDC delta even though pretty good documentation, and how to work around them.  

In part 1 of the series we looked at a warning you might run into when using automatic CDC. This second part is about some warnings and errors messages you might face when using CDC with manual mapping of table to view elements, because of table joins in the CDS view.  

CDC & Table Key – Manual CDC Mapping 

In case of joins in the CDS view we must expose and map the key fields of the main table as well as the foreign key fields in the on-condition(s) of the involved join(s) via annotation @Delta.ChangeDataCapture.mapping.  

First a “simple” example 

In the following „simple“ example, we extract purchasing data from table EKPO. Of course, we could use automatic CDC here as we only have one underlaying table, but for the sake of simplicity and to clearly highlight a few sources of error, we start with the simple example first, and use “manual CDC mapping” via annotation.  

The following error message you might run into: 

The field ‘aedat’ is not a key field in table EKPO but included in CDS view key and mapped in CDC mapping.  

In this simple example only actual table key fields (EKPO) are included in CDC mapping. Field ‘aedat’ is still included in CDS view key but not mapped in CDC mapping any more.  

In contrast to the last example, here we have field ‚aedat‘ in CDC mapping, but it is not part of CDS view key anymore. 

Result 

Delta extraction does not work due to the incorrect CDC definition. No delta package can be created in BW, and direct delta extraction via DTP fails. See part 1 of the series

Explanation and solution  

If the CDS view key is different from the key of underlaying main table or the CDC mapping is not defined correctly, the CDC delta extraction will not working.  

In order to make manual CDC extraction work, make CDS view key same as underlaying table key, or key of main table in case of joins, and map view and table fields in CDC mapping annotation accordingly .   

Now a more “advanced” example 

In the following example we need production planning (PP) data, to be extracted from table AFRU joined with tables AFVC and AFKO.  

Here, the key fields of all tables involved in the join were incorrectly defined as CDS view keys as well and have also been mapped in the CDC mapping annotation for main table. 

Explanation and solution  

Same issue as with the “simple” example above. If the CDS view key is different from the key of underlaying main table, CDC delta extraction will not work.  

In order to make manual CDC extraction work for join based CDS views, make view key same as key of underlaying MAIN table of the join.  

In CDC mapping annotation you have to map only the key fields of the main table for MAIN table, and for all JOINED tables the foreign key fields used in the on-condition(s) only.   

Interested in more possible sources of error, pitfalls and points to be considered when using CDC delta extraction? Stay tuned, next blog post with more hints, tips and tricks will come next week. 

Related Blogs

×