Skip to Content
avatar image
Former Member

Batch input in sapui5 odata fiori

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

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

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

    Add comment
    10|10000 characters needed 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?

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

    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.

    Add comment
    10|10000 characters needed characters exceeded