Skip to Content
0
Dec 09, 2016 at 07:04 PM

How to use odata.create() returned response

3559 Views

Hello all,

I am working on an SAPUI5 project and have gotten a little stuck. I have successfully built a simple form which sends the input data using oData.create()to the backend odata service. I have run this in debug mode and can tell that the post action is working correctly. What I would like the app to do now is access a message generated in the create_entity method and included in the er_entity structure. It is important to note that the message is more than just a success or failure message. If the post is successful the message includes a newly generated document number. If it fails it will display one of many messages as to why it failed. When I created the oData service I included a parameter called message, so after everything runs on the backend I set er_entity-message to the message generated by the post. When I debug I can even watch as er_entity-message gets the message saved to it. I have read in SAP documentation that when I use the odata create operation the entity data should be returned in the body of the response. This sounds like er_entity should be accessible after I post my data to the back end. Pretty much I just want to be able to bind er_entity-message to a text field in my SAPUI5 project after the post is successful but I am unsure how to access the data from the response body. Your assistance achieving this is greatly appreciated.

Thanks,

Kristen