cancel
Showing results for 
Search instead for 
Did you mean: 

fiori offline odata metadata

pvannest
Participant
0 Kudos

Hi,

We are using offline odata in our custom fiori client (prepackaged).

We have the following issue. When we open the client in offline mode, and click on our tile, we get an error that the metadata document for our service cannot be retrieved as there is no internet connection. This issue is triggered when the component is loaded and the manifest file is read.

I expected that the localuri (manifest file -> datasources -> settings) would then be used, but it seems not.

How can we circumvent this issue? Or am i missing something?

thanks

Peter

View Entire Topic
Virinchy
Active Contributor
0 Kudos

Hi Peter,

Please check the blog here to run the app with mock data, especially to perform the code changes performed in component.js

var sServiceUrl = mConfig.serviceConfig.serviceUrl; 

this._startMockServer(sServiceUrl);

oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true);

this._setModel(oModel);

The above lines always forces the app to run with mock data.

Recommendation is to check the device network connectivity status via cordova Network Information plugin available here and check if the device is online or offline and run the app accordingly setting the model to the Odata service or local file. (don't forget to add the plugin to the custom fiori client )

Regards

Virinchy

pvannest
Participant
0 Kudos

Hi Virinchy,

I will clarify my problem a bit further, as I guess my question was not clear enough.

We've built a fiori application and made this tile available offline (using prepackaging).

We also use the kapsel offline odata plugin to send and retrieve data only when there is connection. Everything works perfect except when we first open the tile when the network status is offline. When we open the tile, the application is triggering a metadata request to the server. As there is no connection at that time, we get an error.


I expect this request is triggered when the component is initialized. How can we circumvent this?

thanks

regards

Peter

Virinchy
Active Contributor
0 Kudos
 Everything works perfect except when we first open the tile when the network status is offline. When we open the tile, the application is triggering a metadata request to the server. As there is no connection at that time, we get an error.

Did you specify what should happen when user tries to perform operations/open app when offline explicitly, other than prepackaging and adding the offline plugin. The application is still triggering metadata request to server because it is still expecting the data from server rather than local database.

Generally for offline apps, the actions performed by user when the device is offline is stored in a local database and synchronized to SAP when online . The calls to server are redirected to the local db instead of SAP server.

Regards

Virinchy