Delta Table Extraction
The following article shows how to load data incrementally (daily) from an SAP Table based on date fields. The depicted example scenarios use the table VBAK (SAP Sales Document Header), which has two date fields:
- ERDAT for creation date
- AEDAT for update date
Extract Data using a Date Parameter
The depicted example extracts data that was created or changed after a specific date. The date is provided as a parameter at runtime.
- Create a new Table extraction.
- Look up a table you want to extract data from, e.g., VBAK.
-
Open the WHERE clause tab of theTable extraction type and enter the following criterion:
This criterion extracts data if one of the following conditions is true:
- The data was created (ERDAT) after the date provided by the parameter
@LastDate
and it has not been changed (AEDAT). - The data has changed (ARDAT) after the date provided by the parameter
@LastDate
.
- The data was created (ERDAT) after the date provided by the parameter
-
Click [OK] to confirm your input.
-
Open the Run Extraction menu and navigate to the Custom tab for runtime parameters.
- Enter a value for the runtime parameter
@LastDate
in the formatYYYYmmDD
. - Click [Run] and check the results.
Daily Data Extraction
The depicted example extracts data that was created or changed the day before. The depicted example uses script expressions to query the current date.
- Create a new Table extraction.
- Look up a table you want to extract data from, e.g., VBAK.
-
Open the WHERE clause tab of the Table component and enter the following criterion:
(ERDAT >= '#{ DateTime.Now.AddDays(-1).ToString("yyyyMMdd") }#' AND AEDAT = '00000000') OR AEDAT >= '#{ DateTime.Now.AddDays(-1).ToString("yyyyMMdd") }#'` <br>
This criterion extracts data if one of the following conditions is true:
- The data was created (ERDAT) the day before the current date and it has not been changed (AEDAT).
- The data has changed (ARDAT) the day before the current date.
-
Click [OK] to confirm your input.
- Run the extraction.
The extraction can be scheduled every night at 1p.m. or later to extract all changes of the day before. Providing extraction dates is not necessary.