Hi!
In this post I would like to consider creation of generic data extractor with delta supported option. Logic of data preparation will be in CDS view with special annotations.
I am using S/4HANA 1610 with NW 7.51 for creation a demonstration examples.
Step-by-step procedure:
I.I am using standard CDS
I_SalesDocument of SD application component as a starting point. Analyzing it in HANA Studio ABAP perspective we could see main source table is VBAK.
II. Create new CDS view for data extraction to SAP BW (ODP_CDS source system). I am not included all standard fields here, just some for demonstration.
@AbapCatalog.sqlViewName: 'ZDS_ISALESDOC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'CDS for Extraction I_SalesDocument'
@Analytics:{dataCategory:#DIMENSION ,
dataExtraction.enabled:true}
@Analytics.dataExtraction.delta.byElement.name:'LastChangeDateTime'
@Analytics.dataExtraction.delta.byElement.maxDelayInSeconds: 1800
define view Zds_I_Salesdocument as select from I_SalesDocument {
key SalesDocument,
//Category
SDDocumentCategory,
SalesDocumentType,
SalesDocumentProcessingType,
CreationDate,
CreationTime,
LastChangeDate,
@Semantics.systemDate.lastChangedAt: true
LastChangeDateTime,
//Organization
SalesOrganization,
DistributionChannel,
OrganizationDivision,
SalesGroup,
SalesOffice,
//Pricing
TotalNetAmount,
TransactionCurrency,
PricingDate,
RetailPromotion,
PriceDetnExchangeRate,
SalesDocumentCondition
}
Notes:
- For extraction we need annotation @Analytics.dataExtraction.enabled: true. Prerequisites are annotations @analytics.dataCategory #CUBE, #FACTS, or #DIMENSION (our case) or @ObjectModel.dataCategory #TEXT, or #HIERARCHY.
- For making delta option works we also need some annotations:@analytics.dataExtraction.delta.byElement.name This is the element that should be used for filtering during generic delta extraction.
This element can either be a date (ABAP type DATS) or an UTC time stamp.
@Analytics.dataExtraction.delta.byElement.maxDelayInSeconds
There is always a time delay between taking an UTC time stamp and the database commit. This annotation specifies the maximum possible delay in seconds. The default is 1800 seconds.
For more details about these annotations see documentation here.
An additional annotation to support the detection of deleted records is planned, but not yet available.
- In our case delta field is LastChangeDateTime which is originally located in VBAK and have UTC time stamp data type.
III. That's it for CDS view part. Now go to
SAP HANA BWMT perspective, create a DataSource in ODP_CDS source system, check that Extraction tab contains delta option AIM. Activate it and test data extraction.
IV. For demonstration of delta work I will use familiar method of loading with PSA and data packages: FULL, INIT with data load, DELTA.
Testing procedure will be following:
1. Start INIT package with data transfer. Check PSA.
Number of record is the same as number of record in CDS view data preview.
2. Check initialization in Scheduler - Initialization Options for Source System on Info-package selection.
3. Go to
VA02 in S/4 HANA to change information in Sales Order (SO). I changed quantity and should see difference in Net price of SO.
Before 300 EUR
After 350 EUR
4. Start delta package in BW. Check PSA, at least 1 record should be there in second data request (delta). Do not forget that our delta process is AIM.
Only one delta record is there with Net Value is 350 EUR of SO Number equals 2.
5. You could optionally go to
ODQMON t-code in
S/4 HANA system and check ODP queue here.
We have 2 Requests here: first for initialization, second for delta extraction.
Conclusion
We have walked through a step-by-step path from new CDS view creation to delta extraction to SAP BW system.
Thank you for attention!