Skip to Content
0
Former Member
Jul 03, 2013 at 11:02 AM

SAPUI5 Blackberry 10 issue

53 Views

I'm currently experimenting with SAPUI5 by using the following example I was able to get a simple application working on mobile devices

http://scn.sap.com/community/developer-center/front-end/blog/2012/12/07/building-a-crud-application-with-sapui5-and-icf-restjson-service--part-1

I developed an application focused for Mobile devices and in my "HANDLE_REQUEST" method I handle a few different "verbs" I have "GET" "NEW" and "SEND". I then tested on different devices.

Apple: These devices works the best with UI5

Android: The application works 100% but loads funny sometimes

My problem however is currently as follows on Blackberries

For Blackberry devices it seem the "VERB" is always "GET" and it does not pass any parameters to SAP. Has anyone else experienced the same issue? Is there something different I need to do in the JSON model?

Thanks for your help

Christiaan

Some Sample code:

Calling of the model:

var oLocalModel = new mobileModel;

var oParameters = {

"pernr" : somePernr

};

oLocalModel.loadDataNew("../../../sap/m5data", handleSuccess, handleError, oParameters, true, 'SEND', true, undefined);

The model:

jQuery.sap.require("sap.ui.model.json.JSONModel");

sap.ui.model.json.JSONModel.extend("mobileModel", {

loadDataNew : function(sURL, fnSuccess, fnError, oParameters, bAsync, sType, bMerge, bCache) {

var busyDialog = new sap.m.BusyDialog({

title : 'Connecting to Server'

});

busyDialog.open();

var that = this;

if (bAsync !== false) {

bAsync = true;

}

if (bCache === undefined) {

bCache = this.bCache;

}

this.fireRequestSent({

url : sURL,

type : sType,

async : bAsync,

info : "cache=" + bCache + ";bMerge=" + bMerge

});

jQuery.ajax({

url : sURL,

async : bAsync,

dataType : 'json',

cache : bCache,

data : oParameters,

type : sType,

success : function(oData) {

busyDialog.close();

if (!oData) {

jQuery.sap.log.fatal("The following problem occurred: No data was retrieved by service: " + sURL);

}

that.oDataOrig = {};

that.oDataOrig = jQuery.extend(true, {}, that.oDataOrig, oData);

that.setData(oData, bMerge);

that.fireRequestCompleted({

url : sURL,

type : sType,

async : bAsync,

info : "cache=false;bMerge=" + bMerge,

});

if (typeof fnSuccess === 'function') {

fnSuccess(oData);

}

},

error : function(XMLHttpRequest, textStatus, errorThrown) {

busyDialog.close();

jQuery.sap.log.fatal("The following problem occurred: " + textStatus, XMLHttpRequest.responseText + "," + XMLHttpRequest.status + "," + XMLHttpRequest.statusText);

that.fireRequestCompleted({

url : sURL,

type : sType,

async : bAsync,

info : "cache=false;bMerge=" + bMerge,

});

that.fireRequestFailed({

message : textStatus,

statusCode : XMLHttpRequest.status,

statusText : XMLHttpRequest.statusText,

responseText : XMLHttpRequest.responseText,

});

if (typeof fnError === 'function') {

fnError({

message : textStatus,

statusCode : XMLHttpRequest.status,

statusText : XMLHttpRequest.statusText,

responseText : XMLHttpRequest.responseText

});

}

}

});

},

});