Read the blog from Steve Clayton, Senior BW Consultant at NTT DATA Business Solutions as he takes a look at enhancing BW datasources based on ODP_CDS
Enhancing BW Datasources Based on ODP_CDS – Useful for Datasphere too!
The need to enhance SAP Standard Datasources is a familiar requirement for a BW consultant. Traditional SAPI datasources are routinely enhanced using custom appends and exit/badi ABAP code or for Logistics datasources additional pool fields can be added via the LBWE LO cockpit.
While SAPI DataSources remain the mainstay of most BW systems, ODP_CDS Datasources have become more widely available. ODP_CDS is also widely used by SAP Datasphere and is at the heart of its SAP delivered Content.
I have recently found myself using ODP_CDS based extraction in both BW and Datasphere contexts. And I’ve found myself faced with that same familiar task – How do I enhance an SAP Standard DataSource? Same old question, slightly difference techniques.
Here’s how it can be achieved.
Data Extractor Extension using the Fiori App Custom Fields and Logic
The Custom fields and logic App is used for custom field enhancements (Z fields in old money). If a Z field has already been developed and belongs to the same Business Context as the extraction CDS view, the Custom Fields and Logic App can be used to make it available in your DataSource.
Let’s take DataSource 0C_BILLINGDOCITEMBASICDEX_1, which is based on CDS extraction view C_BILLINGDOCITEMBASICDEX_1 as an example.
Transaction SCFD_REGISTRY on the S4 system can be used to identify the Business Context that the Extraction CDS view belongs to (SD_BILLINGDOCITEM).
Use the Business Context in the Custom fields and logic App to find Custom Fields that can be included in your DataSource.
Select the desired custom field and navigate to the UI’s and Reports section. Use the “CDS View Description” from SCFD_REGISTRY (Data Extraction for Billing Item Basic) to find the corresponding entry. Enable Usage for this line. Save and Publish.
This generates 2 CDS Extension views. One for the main CDS extraction view (C_BillingDocItemBasicDEX_1) and one for the Association Extension CDS view (E_BILLINGDOCUMENTITEM) referenced on the Support of Custom Fields tab of transaction SCFD_REGISTRY.
The first view extends E_BILLINGDOCUMENTITEM which acts as a hook back into table VBRP giving a direct path for including additional fields.
@AbapCatalog.sqlViewAppendName: ‘ZZ1_BFA9672D8D27’
extend view E_BILLINGDOCUMENTITEM with ZZ1_KOG7E7IFO4FCZHS5RBIOMCALBU
{
Persistence.ZZ1_TESTEXTRACTAPPEND_BDI as ZZ1_TestExtractAppend_BDI
}
If you look at E_BILLINGDOCUMENTITEM it is a basic select on billing item table VBRP. Extension Associations equivalent to this are commonly used in many CDS views.
define view E_BillingDocumentItem as select from vbrp as Persistence {
key Persistence.vbeln as BillingDocument,
key Persistence.posnr as BillingDocumentItem
}
The second view extends the main extraction view C_BillingDocItemBasicDEX_1, via the first extension view.
@AbapCatalog.sqlViewAppendName: ‘ZZ1_783ADAFAD8A2’
extend view C_BILLINGDOCITEMBASICDEX_1 with ZZ1_4HYM4U74XYJM3IO2EQOIWB5VOM
{
_ExtensionItem.ZZ1_TESTEXTRACTAPPEND_BDI as ZZ1_TestExtractAppend_BDI
}
A quick data preview of the Main CDS View shows that the new field is now included for extraction.
There are limits to this Key User Extensibility App approach.
Standard SAP fields cannot be added using the Custom Fields technique. If you are lucky, you might be able to use the “Data Source Extensions” option within the Custom Fields and Logic App.
But this will only work on Extensible CDS views which support this feature. Settings for this are configured under the Support of Data Source Extensions tab on transaction SCFD_REGISTRY.
The SD Billing Item CDS view does not support this, and it is absent from other Extraction enabled CDS views that I have checked.
If the Custom Fields and Logic App can’t be used, the CDS extensions will need to be manually developed in Eclipse. Which we will come back to in section Data Extractor Extension using Eclipse.
But let’s finish off the extension process for our Z field by updating the ODP_CDS DataSource definition on the BW system.
In eclipse, open DataSource 0C_BILLINGDOCITEMBASICDEX_1. On the Extraction tab choose Exchange.
Keep the existing Operational Data Provider and choose Next. New Fields available in the underlying CDS views and changes to existing fields will be presented. The new CDS extension field is listed at the end. Finish to implement the changes.
Check the DataSource to see that the CDS extension field is now included. Activate.
Now incorporate the new field into the BW data model by updating data targets, transformations etc…
Data Extractor Extension using Eclipse
If the fields you want to include in your Extraction cannot be added using the Fiori Apps, it will be necessary to add them manually using Eclipse.
A recent example I have worked on involved the extraction of Purchase Order Header data. The requirement was to simply add the field EKKO-FRGKE (Release Code) to CDS view C_PurchaseOrderDEX so that it could be extracted to a BW system and incorporated into an existing data model.
Taking a first look at C_PurchaseOrderDEX in the Eclipse editor you can see that it includes the extension association E_PurchasingDocument.
This allows us to follow the same extension technique that the Custom Fields and Logic App employed on the Billing Item example. Only this time we are creating the CDS extension views manually. As before, 2 extension views will be required.
First the Extension Association. To be on the safe side an appropriately named Alias should be used for the field that you want to include. A prefix of ZZ will give the extension some protection from possible problems that could occur during upgrades/support packs should SAP decide to include the field in a future release.
@AbapCatalog.sqlViewAppendName: ‘ZZEMMPURDOC’
@EndUserText.label: ‘Additional Fields for Data Extraction’
extend view E_PurchasingDocument with ZE_PurchasingDocument {
Persistence.frgke as zz_frgke
}
Then the main extraction CDS extension
@AbapCatalog.sqlViewAppendName: ‘ZCMMPURORDDEX’
@EndUserText.label: ‘Extension for C_PurchaseOrderDEX’
extend view C_PurchaseOrderDEX with ZC_PurchaseOrderDEX
{
_HeaderExtension.zz_frgke
}
There are currently no SAP provided ODP_CDS DataSources for Purchase Order data. So to complete the task create a custom ODP_CDS DataSource on CDS view C_PurchaseOrderDEX.
Note on API State
It is worth reading up on API State Extend (Contract C0). Extensions are not supported for CDS views which do not have this setting. That’s not to say you can’t create extensions if this isn’t set. C_PurchaseOrderDEX which I have used here is not C0 released. Just be mindful that it would be wise to check extensions like this during upgrades. Using the ZZ alias name for any fields will protect your developments to an extent.
Useful blogs and reference material
As referenced in OSS Note 3005736.
CDS view extension – long activation times
Next Steps
If you are interested in learning more about data extraction in BW using CDS, please get in touch