Skip to Content
Author's profile photo Karthik Arjun

OFFLINE Data Storage

Hi,

As we know SAP Next transformations are SAP Fiori/UX design approach. The main agenda for this transformations are to reduce more number of clicks in SAP Screen and Code Once RUN on ANY DEVICE.

Scenarios:

– Tablet/Mobile

– WareHouse Area

– Wifi Health : weak

– Assume my user id have thousands of records. If I am calling all the time to hit GW services, my application performance will move to Bad health. So what to do?

Sol: OFFLINE DATA

Here is the solution to solve this problem. While rendering SAP UI5/Fiori application (view) we should call services at one time and use below code to store all user details into local memory ( Not in application memory).

var filePath = “MyFileName.JSON”;

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(FS) {

     FS.root.getFile(filePath, {create:false, exclusive:false},

         function(fileEntry) {

             fileEntry.file(function(file) {

          var reader = new FileReader();

          reader.onloadend = function(e) {

          funCall(this.result);

          };

          reader.readAsText(file);

          });

         }, fail);

  }, fail);

function fail(){

  var objJSON = null;

  funCall(objJSON);

  }

Based on create:false/true flag, we can read or create new file from/to local memory.

This way will helps you to do offline functionality 🙂 .

Thanks,

Karthik A

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Interesting, need to check and test.

      Thanks.