Monday, 27 April 2020

CDS based data extraction – Part III Miscellaneous

Back to the CDS view extraction..

After the Overview in part I and Delta deep dive in part II, I would like to spend the final blog on some miscellaneous points regarding CDS view based extraction.

Hierarchy extraction


The topic of hierarchy extraction deserves a small section, as some things have changed here in contrast to the classical extractors. You will need to make some changes to your hierachy bearing characteristics in order to work with the hierarchy CDS views. This is due to the fact that the node texts are not delivered by the actual hiercharchy CDS view, but a separate one.

We’ll use the Cost Center hierarchy as example. You will need the following three CDS views for getting the complete picture for a cost center hierarchy across:

◉ Cost Center Hierarchy Node (I_COSTCENTERHIERARCHYNODE)
◉ Cost Center Hierarchy Node Text (I_COSTCENTERHIERARCHYNODET)
◉ Cost Center Text (I_COSTCENTERTEXT)

You will need to equip a characteristic Cost Center, ZCOSTCTR in our case, with two additional external characteristics in the hierarchy:

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

One characteristic for the Cost Center Hierarchy ID (ZCOCTRHID) type CHAR40.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

One characteristic for the Cost Center Hierarchy Node Text (ZCOCTRHNT) type CHAR50, compounded to the Cost Center Hierarchy ID

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

The hierarchy transformation between a DataSource based on CDS view Cost Center Hierarchy Node (I_COSTCENTERHIERARCHYNODE) and the cost center characteristic needs to be mapped as follows (Segment 0003):

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

The hierarchy node texts will be delivered via a DataSource based on CDS view Cost Center Hierarchy Node (I_COSTCENTERHIERARCHYNODE) and loaded into the characteristic Cost Center Hierarchy Node Text (ZCOCTRHNT)

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

The cost center texts will be delivered via a DataSource based on CDS view Cost Center Text (I_COSTCENTERTEXT) directly into the cost center characteristic as usual:

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

Just for completenes, please note that the two additional characteristics needed as external hierarchy characteristics can have different lengths according to a particular hierarchy characteristic (e.g. GL Accounts, Profit Centers etc.). Please make sure to check them in the respective hierarchy node CDS view first.

Testing CDS view extraction


With classic extractors the Extractor Checker S-API (transaction RSA3) is your friend on source system side. No need replicate a DataSource to BW side etc. Bad news, you cannot use RSA3 to test your extraction enabled CDS views.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

How can you test CDS view extraction? The good news, you can use report RODPS_REPL_TEST.

Before sharing the details, please consider the warning on top (Warning: Not Simulated): Initializing a delta and/or running a delta extraction with the report will trigger a real subscription in the ODQ frame work. This is no dummy run.

When starting the report RODPS_REPL_TEST you will need to fill the fields as shown in the screen shot below.

The ODP Name equals the @AbapCatalog.sqlViewName again and is suffixed by the data category classification in the CDS view:

◉ $P for master data attributes
◉ $T for texts
◉ $H for hierarchies
◉ $F for facts/transaction data
◉ $E for other/without dataCategory

After you are done with testing please make sure to press Reset Delta so your ODQ subscription can be cleaned.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

One speciality for the hierarchy extraction test. For being able to see the extracted hierarchy data you will need to check the hierarchy segement that you would like to see, i.e. use F4 value help for Projections

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

While in RSA3 you can navigate to the different segements via a drop-down

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

in RODPS_REPL_TEST you can double-click on the figures to jump to these segment entries.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

Units, Currencies, Fiscal Year Variants via CDS


In SAP BW and SAP BW/4HANA you will most likely also want to work with the units of measurement, currencies, currency conversion rates and fiscal year variants as they are maintained in your SAP S/4HANA system. In the on-premise world, this means a right click on your source system, choosing options

◉ Transfer Exchange Rates
◉ Transfer Global Settings

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

This is the same for a SAP S/4HANA Cloud source sytem in the ODP_CDS context:

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Certification, SAP ABAP Exam Prep

In case you do not see these menu entries for your SAP S/4HANA Cloud source system, please check SAP note 2792996.

Alternatively after implementing the SAP note you can call up the reports RSIMPCUST (currencies, units of measurement and fiscal year variants) and RSIMPCURR (exchange rates) and trigger the replication manually or scheduled via process chain.

No comments:

Post a Comment