Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between use of xsjs and xsodata?

Tags:

sapui5

I understand that both xsodata and xsjs are used for exposing data but why there are two ways? Which one should one use and how the use of xsodata is different from xsjs data.?

like image 408
loki Avatar asked Mar 10 '23 01:03

loki


1 Answers

Good Question, I will try to give you a little overview. I will describe three SAPUI5 ways of backend implementation.

XSODATA

Let's assume, you have something like a Checklist. You may want to add items to your list, edit or delete them and - obvious - you want to display them. These simple tasks are called CRUD (create, read, update, delete) operations. These Operations are the simplest way of dealing with data. There are no real "hard" queries to get work done and you may operate on very less JOIN's. This can be easyly done with XSODATA. It's a simple REST-Interface.

XSJS

Okay, you have your checklist, but you want to log every single entry, or do analysis or something not-so-easy with it. This is, where XSJS comes into play. With XSJS you have a better control (and much more work needs to be done) of your data. But keep in mind, that you need to code every single step. XSJS is not a real interface, but it's a sapui5 way of handling data, like you would do in any other vanilla-programming-language without a framework.

Node.JS / custom backend

Another, newly (2017) introduced way of handling data at sapui5 is the usage of Node.JS. Node.JS let you write your own RESTful API (node.js is much more powerful than that, but this information must be enough for now). Node.JS is something like the intersection between XSODATA and XSJS: you are able to use a RESTful API (implemented by yourself) with 100% datacontrol. I don't want to go too much into detail, but Node.JS is for advanced applications the state-of-the-art at early '17.

Conclusion

What you might use really depends on your application itself. Personally, I think the best way to start is with XSODATA. If you can't solve certain tasks with only oData, use XSJS for those single cases. In a real-world application with tons of data and complex queries, you might consider Node.JS as your backend-wizard.

useful informations:

  • OData vs XSJS in SAP Hana Development
  • https://archive.sap.com/discussions/thread/3688095
  • http://saphanatutorial.com/sap-hana-xsjs-service/
  • https://blogs.sap.com/2015/12/08/sap-hana-sps-11-new-developer-features-nodejs/
  • https://nodejs.org/en/
like image 130
Sauerbrei Avatar answered Mar 11 '23 16:03

Sauerbrei