After looking at Enterprise Data Glue – OData in the Enterprise World, we now look at a common request of how OData can be used to extract data from an ECC system to another target. In this example, we are going to look at how an extractor is enabled for OData and how delta records can be fetched in an OData feed. This blog does not cover the consumption of the same – the consumption could be handled in a separate middleware or the target system in itself.
Extracting delta records via OData from SAP
For the purpose of demonstration, let’s see how ODP 0CUSTOMER_ATTR is consumed via OData and delta changes are captured.
Expose ODP as OData using SAP Gateway Service Builder:
The generated service has 2 entity sets, EntityOf<ODP> and DeltaLinksOfEntityOf<ODP> and URL for accessing the service usually looks like https://<Host>:<Port>/sap/opu/odata/sap/<Service Name>/<EntitySetName>
Extract Delta records using the OData service
Delta extraction can be performed by using the delta enabled entity set DeltaLinksOfEntityOf<ODP> along with the necessary request headersThe delta initialization along with dataset is requested using the entity set EntityOf<ODP>. This is similar to “Init with Data transfer” concept in extraction via info-package in BW. Delta initialization request will provide the initial dataset based on the query parameters along with a deltatoken, which is the key for subsequent delta load at the fag end of the request response.
Here is how the initial request header and response would look like:
The deltatoken received in the above request response is then used in subsequent delta request to fetch delta records. Sample of delta request header and response:
“Results” array would contain the actual data as shown below.
The deltatoken received at the end of delta request can further be stored and used to request next delta data. Please view the video below for a demonstration of how this works:
Read more blogs from Business Intelligence category here.