SAPUI5 Apps – Offline with Neptune
The world is moving towards an online reality, but offline is still a requirement for several mobile projects. Customers in the shipping industry are often limited to a satellite connection once or twice a day, field service workers often work in conditions without network access and for some apps like travel expense it is crucial that you don’t need to roam to be able to enter your data and even images while abroad.
So we decided to improve our already existing capabilities with a UI5 model based solution. It was delivered with service package 1 of our 2.20 release, and the performance of the end result totally exceeded all of our expectations.
You now have the option to choose local storage or webSQL, and if you need even more local data you can also add a Phonegap/Cordova plugin that will give you capabilities up to 2 TB (not that your device has that amount of storage capabilities in the first place).
Now for the Neptune Developer, you only need to decide which internal tables and structures to store locally and we have of course provided you with helper scripts that should make development of offline handling of data easier than ever before.
Now let me try to describe the way our framework has evolved from a standard web server approach much like the one you are familiar with from the SAP Business Server Pages (BSP):
Here the server side coding was often stateful and had issues with session timeouts and loss of network connection.
After the emergence of SAPUI5 and a proper Model View Control framework, we changed to a new architecture with the state being handled by the client and only JSON data passed between the server and client.
In our latest Support Package we took it one step further and added a choice to store these models in local cache or in the client webSQL database.
In the Neptune Application Designer you can simply choose the type of local cache you want in the attributes of an object bound to SAP data:
Neptune functions have been added to these objects to make coding a lot simpler:
- model+objectName -> JSON Model Object
- setData and getData commonly used to change the data content in the model
- ModelData.Find(obj, key, val);
- ModelData.Delete(obj, key, val);
- ModelData.Update(obj, key, val, rec);
- ModelData.UpdateField(obj, key, val, updKey, updVal);
- ModelData.Add(obj, rec);
We have tested this framework with larger datasets (1 Million Records) – no problem regarding the performance on the device.
So, if you are in need of offline functionality in your Neptune Apps, don’t hesitate to upgrade to the latest SP and be amazed by the performance of the framework, I know I am.
Like to test it out, try our Sales Order app from our experience site.
Ole Andre Haugen