Skip to Content
0

Odata.create method automatically called asynchronous

Jul 10, 2017 at 02:57 PM

76

avatar image

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.???

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Tri Le Minh Jul 11, 2017 at 03:07 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Nishant Bansal Jul 11, 2017 at 02:52 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded