Skip to Content
0

sap offline app - Unable to delete Error records - Permission to update {Z*SRV_Entities} denied.

Aug 02, 2017 at 06:39 PM

110

avatar image
Former Member

Hi All,

We have a custom SAP offline app development for basic Order Management.

manifest.json snippet:

"dataSources": {
	"mainService": {
		"uri": "/sap/opu/odata/sap/ZPSMM_SCP_MOBILE_SRV/",
		"type": "OData",
		"settings": {
			"odataVersion": "2.0",
			"localUri": "localService/metadata.xml"
		}
	},
	..
},

Component.js >> init() code snippet:

init: function() {
	var oModel, appContext, sServiceUrl;
	
	//create odata model for kapsel application
	var param = {
		"json": true,
		loadMetadataAsync: true,
		useBatch: true
	};

	...

	oModel = new ODataModel(sServiceUrl, param);
	oModel.setDefaultBindingMode("TwoWay");
	this.setModel(oModel);
	devapp.appModel = oModel;
	
	..
	...
	..

}

In the scenario of an Sync conflict, the error archive "Synchronization Issues" pops up and shows the errors which is an expected behavior. But, User is unable to delete the error records and proceed.

Scenario:

1) Mobile: User1 updates an order (with 2 order-items) and clicks on Save

2) Online: User2 updates same order on desktop

3) Mobile: User1 clicks on Sync and receives an error archive popup

4) Mobile: User1 clicks dustbin icon to delete the error-archive but gets below error

The following problem occurred: HTTP request failed400,,{"error":{"code":-10163,"message":{"lang":"en-US","value":"[-10163] Permission to update \"ZPSMM_SCP_MOBILE_SRV_Entities\" denied."}}}

In the absence of a sync conflict, the sync works as expected.

***Standard / generated files (such as devapp, devlogon) have NOT been touched in this regard.

Would appreciate any ideas / suggestions to resolve this. Thanks,

10 |10000 characters needed characters left characters exceeded
Former Member

Hi Sai,

How did you resolve the error?

Thanks

0
Former Member

Hi Keno,

I got the same error today and this is how I solved it in case you still need it.

/** 
 * 
 * @constructor 
 */
_getErrorsToClear: function() {
	this.getModel().read("/ErrorArchive", {
		success: this._clearLocalErrors.bind(this)
	});
},


/** 
 * 
 * @constructor 
 * @param oData
 * @param oResponse
 * @returns
 */
_clearLocalErrors: function(oData, oResponse) {
	try {
		for (var i = 0; i < oData.results.length; i++) {
			var sUrl = oData.results[i].__metadata.uri;
			var oContext = sap.hybrid.getKapselContext();
			var oHeaders = {};
			oHeaders['X-SMP-APPCID'] = oContext.applicationConnectionId;
			var request = {
				headers: oHeaders,
				requestUri: sUrl,
				method: "DELETE"
			};
			sap.OData.request(request);
		}
	} catch (oError) {
		return;
	}
},


0
* Please Login or Register to Answer, Follow or Comment.

0 Answers