How to create ODATA v2 & 4 using Business Application Studio
The easiest way is thru a CAP project. When you create a project using the generator (wizard), the project will contain different modules (i.e.: db, srv and app). Those correspond to the persistence layer, service layer and front-end layer. It will also feature a sample bookshop persistence model and services that you could use to uderstand how these artifacts work together to deploy an OData service onto BTP. In addition to it, the template will give you the chance to choose the odata version and the technology to be used (Node or Java).
Please check the open sap course on this: