Show TOC

How to Work with Delta Tokens for Incremental UpdatesLocate this document in the navigation structure

Context

Some applications using OData may need to cache data on client. The reason for this could be either that the application should work in off-line mode, or because the application is looking for ways to improve the performance by caching the data which changes very rarely.

This is possible by making the service understand and implement delta token in SAP Gateway.

A service enabled for delta token will generate opaque “delta link” URL. The link is returned on the last page of a result. Clients can use the link to get newly added, deleted, or changed records. Tombstone represents the removed rows in a deltatoken query response.

To achieve Delta token handling with GWM, proceed as follows:

Procedure

  1. Go to SAP Service Reference and open App.config file.
  2. Check for <add key="EnableDeltaToken" value="Enabled"/>.
    Note Ensure that the Delta token is Enabled.

serviceContext.AtomDeltaToken will give you an instance of AtomDeltaTokens. This object contains both the List of AtomTombStone and DeltaToken.

  1. Store the Delta token in your application persistence.
  2. Add the query option to the service context to make a call for delta changes, or deletions since the delta token: serviceContext.SubCollection.AddQueryOption("!deltatoken", deltaquery)