Skip to Content
avatar image
Former Member

submitChanges callback

I have got a table bound to an odata model as in the picture:

I have deferred changes to that entity:

this._oModel.setChangeGroups({ "EquipmentCharacteristics": {
		                groupId: "EquiChars",
		                single: true } });

And when the user clicks "Save" I want to post changes to the backend:

this._oModel.submitChanges({groupId: "EquiChars",
			    merge: false,
			    success: function(oResponse){},
		            error: function(oError) {} });

So what may happen that the 1st entry changed successfully and the 2nd one failed hence I would like to show an error log to the user e.g.
Equipment 10001654 successfully updated.
Equipment 1001693 failed top update + message from the backend.

But from the "oResponse" I can only identify error messages for the entries that failed.
And I can't identify entries that were successfull as it is not returning any key/data of the successfully updated entry.

Any suggestions on how to identify which postings failed/succeeded?

table.png (15.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    May 19, 2017 at 12:18 AM


    As per OData standards, response body of an 'Update' is empty and successful response code is 204. So UI has to just look for this code and assume that update is successful.

    If you really want success or warning messages, you can send them back as response headers by doing as below.

    DATA lo_message_container TYPE REF TO /iwbep/if_message_container. 
      " get message container object
      lo_message_container = me->/iwbep/if_mgw_core_srv_runtime~mo_context->get_message_container( ). lo_message_container->add_message(
             iv_msg_type                = /iwbep/cl_cos_logger=>warning
             iv_msg_id                  = /iwbep/cx_tea_business=>team_id_out_of_range-msgid
             iv_msg_number              = /iwbep/cx_tea_business=>team_id_out_of_range-msgno 
             iv_add_to_response_header  = abap_true 
    Add comment
    10|10000 characters needed characters exceeded

  • May 17, 2017 at 06:20 PM
    Like Akhilesh Suggested, pls check the oResponse data as mentioned in the standard documentation.

    oData contains the parsed response data as a Javascript object. The batch response is in the __batchResponses property which may contain further __changeResponses in an array depending on the amount of changes and change sets of the actual batch request which was sent to the backend. The changeResponses contain the actual response of that change set in the response property. For each change set there is also a __changeResponse property.

    Add comment
    10|10000 characters needed characters exceeded

  • May 17, 2017 at 05:24 PM

    check this below code, it should return an array of batch responses, it may help.


    Add comment
    10|10000 characters needed characters exceeded