Skip to Content

submitChanges callback

May 17, 2017 at 12:35 PM


avatar image
Former Member

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Krishna Kishor Kammaje
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 
Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks Krishna. That's what I was suspecting but was looking for someone to assure me there won't be a callback from update method.


Radek, not sure if I misled you. In UI5 there will always be a response, but no response body in case of a succesful update.

Former Member
Krishna Kishor Kammaje

Yep I understand that and that's exactly what I see in the response.

Mahesh kumar palavalli 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.

10 |10000 characters needed characters left characters exceeded
Akhilesh Upadhyay May 17, 2017 at 05:24 PM

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


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

I am aware of that but that is the problem that I don't get to see anything meaningful in the response. See the screen below:

response.png (29.8 kB)

i hope in the backend you are passing the data back to ui in the changing parameter ct_changeset_response.

Best Regards,


Former Member

That' what I am doing in the backend:

 ls_changeset_response-operation_no = ls_changeset_request-operation_no.
copy_data_to_ref( EXPORTING is_data = ls_equipmentcharacteristics CHANGING cr_data = ls_changeset_response-entity_data ).
INSERT ls_changeset_response INTO TABLE ct_changeset_response.

i think from backend itself you can pass batch info/message in the "body" property, but i dont know how.