0
votes

I am building a SAP UI5 application using XML views. In the XML View the data binding is done using a JSON model which is a REST service used to fetch data from SQL Database.

Now, on clicking on Submit button in the view, I need to post the data to both the SQL Database and SAP system using REST and Odata services.

How can we achieve this? The data is present in the JSON Model, how can I populate the ODATA service and submit the data simultaneously.

Thanks

1
This doesn't sound like a sound design. What happens if the SAP update succeeds but the SQL database update fails - are you going to roll back the SAP update? Why are you reading from one system and then updating another - you need a proper integration layer, not something that's doing integration in the UI.mjturner

1 Answers

0
votes

Just copy the data from the JSON model and create an OData request to send to the OData service with this data.

var OData = {
   Data1 : JSONDATA.Data1
   .
   .
//etc.
}

var oModel = new sap.ui.model.odata.ODataModel(<URL>);
oModel.create(<sPath>, OData, <mParameters?>) 

BUT I am on the same page as mjturner this should NOT be done in the UI, the integration and data consistency is part of the backend and should happen there!