Reputation: 65
I have an application that sends the data to my backend (database).
In UI of another application, the data is consumed using ODATA model.
WHenever there is any insert/update in database, I want the changes to be reflected automatically in the UI also without having to press f5 everytime.
How can I achieve this?
Thanks!
Upvotes: 1
Views: 4647
Reputation: 1920
Unfortunately OData doesn't have a way to push data from the producer to the consumer, so you will have to implement a form of polling.
I agree that it isn't nice to have the user to do this manually though. Instead, you could have this done automatically for your user, by instructing your application to read the potentially changed data e.g. every second:
setInterval(function() {
oModel.read('/EntityChangedByTheOtherApp');
}, 1000);
Alternatively you could open a web-socket with the server (e.g. ABAP push channel) and have the server to notify your application whenever the first application is making a change. That prevents your app from having to continuously refresh unchanged data. There's a nice blog on SCN explaining this trick in detail: http://scn.sap.com/community/abap/connectivity/blog/2014/06/20/enabling-real-time-bidirectional-client-server-communication-using-abap-push-channel
Upvotes: 1