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
Nice blog Ole!
Please test out the link, the performance is great!
Let me be the usual spoilsport and point out that it's a really really bad idea to store business data and/or user credentials on mobile devices unencrypted.
Given the number of mobile devices lost in taxis and airports this has to be considered careless.
So: do your local databases offer encryption? If not, maybe the SAP SMP 3.0 KAPSEL plugins offer an alternative way: Getting Started with Kapsel - Part 1
Thank you for the feedback.
If you have sensitive/confidential data you should encrypt the data. Totally agree.
To achieve data protection with encryption you can use KAPSEL plugins or SAP Mobile Secure solution based on Mocana. We have tested out Mocana with Neptune Apps and the solution was easy to implement in matter of minutes.
Those that want can test Mocana from this site, with a free 30 day trial.
SAP Mobile Secure
Sounds great, as well as security the other issue of working offline is the syncing and dealing with conflicts when you are back on line again, are you providing methods to deal with the synchronisation?
This topic is very important regarding offline Apps. From my point of view this is not a technical issue, but a functional issue and how you design the App. Our framework will provide you with data syncing but not handle the conflicts.
For all offline Apps i would recommend a solid architecture and place the error handling on the users instead of a central operation organization. Creating an order in VA01 will instantly display what's wrong with the order, i mean you should use the same approach on the offline App. Using the standard BAPI's from SAP provide you with the Return table with all error messages. Display this content to the user and they will solve their own problems.
If you have 1000 users, and all have the possibility to change masterdata records then you will struggle with your offline scenario.
Creating new transactions like Notifications, Sales Order etc will never create conflicts. Also changing data that are assigned to you could work fine.
I reckon one day, probably a lot sooner than we think, someone will look at a comment like "naturally your mobile device does ot have 2TB of storage" and say "what in the world is he on about? Of course it does!"
So it's probably just as well you are catering for it already!
Offline apps provide a real value for our customers in a variety of areas. Even when WiFi is avaible it is often easier and more robust to run the offline applications. Especially in Warehouse Management we've noticed that WiFi coverage often doesn't reach all corners of the warehouse. Our offline UI5 applications developed with Neptune work great in these environments.