Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Best approach to build an offline store for collections with $expand and delta queries?

Hello dear SMP 3.x Experts. I have a tricky question, about combining of two of the greatest features from SMP, offline and delta queries. I hope some of you guys can help me to solve the scenario that I'll describe below:

I am in the implementation of a project using SAP Gateway 2.0 SP 12, SMP server 3.0 SP 09, and SMP SDK 3.0 SP 10.

We have a business requirement to work in a mobile device with a main list of clients (master) belonging to the user of the application or salesperson, and when the user click one item, a form is shown for to edit data about the client (detail) including inserts for some related business objects like addresses and telephones (detail-detail). All that must work offline.

We tried to cover the requirement configuring the Kapsel local store like below:

"definingRequests" : {

                "Customers" : "/CustomerSet?$filter=ownerSalesPersonId eq '" + salespersonId + "'"+"&$expand=AddressSet,PhoneSet"

              }


The configuration works ok, resolving the requests online and offline. But we have an issue related to delta queries, and that is because when we made a GET request to SAP Gateway using $expand (in the refresh process), the GET_ENTITY_SET_EXPAND is executed, but not the GET_ENTITY_SET_DELTA. Therefore, the ABAP developers from Gateway have not chance to do the corresponding delta tracking.

We try to take advantage of the constraints defined between the entities Customer and Address, and not use $expand in the local store definition. However, this force us to download all the universe of Addresses from the backend, or to add the salesperson ID to the Address collection. We think this is not the optimal design. The alternative definition is shown below:


"definingRequests" : {

                "Customers" : "/CustomerSet?$filter=ownerSalesPersonId eq '" + salespersonId + "'",

                "Addresses" : "/AddressSet",

                "Telephones" : "/PhoneSet"

              }


So, the question is. What is the recommended local store definition, if we need a complex set of collections with a main collection filtered by some property, and some other dependent collections related using constraints in the OData Model, and when we also need to use delta queries for the main collection. A draft of the OData modeling is shown below:


Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question