on 12-06-2023 1:30 AM
When developing the backend in ABAP, I typically add messages to the OData response using the following method:
lo_message_container->add_messages_from_bapi(
EXPORTING
it_bapi_messages = lt_return
iv_add_to_response_header = abap_true ).
Now, in Swift, I'm making a call to update an entity with the following sentence:
await let pUpdate = myOdata.dataService!.updateEntity(myRecord)
The challenge I'm facing is that I don't know how to retrieve the messages sent by the backend. Despite going through the documentation thoroughly, I couldn't find information on accessing the response. Therefore, I'm seeking your assistance.
Thanks!
Hi Daniel,
you can access the returned header by using this code:
let responseHeaders = SAPOData.HTTPHeaders()
let options = SAPOData.RequestOptions()
options.captureResponseHeaders = responseHeaders
let updateResponse = try await self.dataService.updateEntity(self.entity, options: options)
print("this is the header : \(responseHeaders.toString()) returned ")
The response is most probably in the header field SAP-Messages.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.