Skip to Content
0

Batch input in sapui5 odata fiori

Apr 10, 2017 at 09:06 AM

224

avatar image
Former Member

Hello guys!

I have a problem with batch input. I use SAP Gateway with Odata services, and this I would like send to ERP one request to record rows. I sent batch input. And operation created execute several time. IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_BEGIN execute several time. It is bad. I would like sent to table and create one request for create.

Please, give me advice how I can do one request.

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

2 Answers

avatar image
Former Member Apr 10, 2017 at 11:46 AM
0

Are you using v2 oData model? Is the batch mode set to true?

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

I use,

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

batchChanges.push(oModelCreate.createBatchOperation("ItemsWriteSet", "POST", newItem));

oModelCreate.addBatchChangeOperations(batchChanges);

Could you give me your code?

0
avatar image
Former Member Apr 10, 2017 at 12:04 PM
0

sap.ui.model.odata.ODataModel is obsolete. You should use sap.ui.model.odata.v2.ODataModel more info here.

An example:

this.getModel().create("/EntitySet", entity, {
success: function(oData) {
//Success handler
},
error: function(oError) {
//Error handler
}
});

If you call it in a loop then it will send it all in one batch request and should trigger CHANGESET_BEGIN only once.

Share
10 |10000 characters needed characters left characters exceeded