cancel
Showing results for 
Search instead for 
Did you mean: 

Odata.create method automatically called asynchronous

nishantbansal91
Active Contributor
0 Kudos

Hi Team.

I had one issue when i create the oData object from manifest.json file all the call from UI5 TO Backend are made asynchronous. Like in below case.

omodel.create('/ZuserLeaveset', leaveDetails, null, function(oData, oResponse) { alert("Request No" + oResponse.data.RequestNo + "is created"); }, function(error) { alert("Create failed"); });

system is not stopped and execute the next line. It like system call the service create method in parallel mode.

but If i created the same object in component.js file i didn't get that issue. System call the create object in synchronous mode. System wait until the backend process is not completed.

Below is the code for creating oData object.

In component.js

var oModel = new sap.ui.model.odata.ODataModel( "/xxx/xx/odata/sap/ZZLEAVE_SRV/");

In Manifest.js

invoiceRemote": { "uri": "http://xxxxxx.xxx.com:xxx/sap/opu/odata/sap/ZZLEAVE_SRV/", "type": "OData", "settings": { "odataVersion": "2.0" }

Can you please let me know what the exact difference.???

Accepted Solutions (0)

Answers (2)

Answers (2)

nishantbansal91
Active Contributor
0 Kudos

i have changed the version from 2.0 to 1.0 in manifest file . it still behave the same.

How i can pass the same in ocreate method. How i can change the asynch of odata object. .

Thanks

Nishant

Former Member
0 Kudos

Hello Nishant Bansal,

1. In component.js, you're creating Odata model v1.

In case of Odata model v1, create method has async param as false, so it will process in sequence.

https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.ui.model.odata.ODataModel.html

2. In manifest.js, you use Odata model v2.

CRUD methods of odata model v2 are async. That's why it will run parallel.

https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.ui.model.odata.v2.ODataModel.html