Getting started with OData Model Editor on SAP River RDE
Hope you have already heard about our new web based SAP River Rapid Development Environment (RDE) and had a chance to try it out. RDE is really much more than any typical Integrated Development Environment (IDE) – it is built with a much larger vision – which is to provide an extensible framework capable of hosting any number of independent tools to achieve seamless “end-to-end development”.
Many articles have been already written to help a developer setup the environment, create SAPUI5 applications from existing templates, consuming a service etc. So to maintain the spirit of end-to-end development, in this article we shall focus on the “service provisioning” aspects – i.e., steps to actually create the service-end-point which is then consumed by the application.
SAP River RDE is still in beta but we have already taken the initial steps to embed the service provisioning experience into the overall development lifecycle. This is motivated by the fact that a productive service is a pre-requisite for a productive SAPUI5 application, so it is also better to bring the two development experiences closer. Ofcourse the creation of actual data source itself (e.g., RFC, HANA View…) is mostly done via respective platform specific tools (e.g., Service Builder in SAP Gateway, HANA Studio…), but the provisioning of an OData service, from a variety of data sources, across different platforms, in a consistent manner, is important and that is the focus here.
So coming back to the RDE, what if you wanted to create a SAPUI5 application without a service? The service is yet to be built and let’s say you don’t want to wait until the service has been fully implemented. Good news here – You probably know about the mock service functionality of RDE already. You simply need a metadata xml file and couple of clicks later “Run with Mockdata” feature ensures that as an application developer you don’t miss the absence of service that badly anymore. Well, all is good so far but what if you don’t have the metadata also? Simple – SAP already provides a graphical OData modeling tool. You can even manually write a bunch of XML in your favorite text editor to create metadata.
Ofcourse. But we think “simple” is not good enough when things can be “simpler” – which by the way is SAP’s bold vision for the future of businesses as articulated by our CEO Mr. Bill McDermott as recently as last month in SAPPHIRE NOW event in Orlando, Florida.
How would you like if you did not have to leave the context or leave the RDE for creating metadata? With automatic code-completion? And with intellisense? Plus schema based validation on-the-fly? And SAP annotations support? Sounds good? Okay here we go…but just to be on the same page – the context of “simplicity” referred above is about enabling an end-to-end development experience. Otherwise the idea of “simple” is always subjective and different for different developers.
Open SAP River RDE and notice the option to create a new “EDMX File” under “File -> New” – that’s the starting point for creating our Entity Data Model XML. Select a project or a folder where this file needs to reside and follow below screen grab.
You are now presented with a dialog to type in the desired file name and select the OData Version. At present we support standard OData Version 2.0 with or without SAP specific annotations.
Once you are done, a (not-so) empty file is created with the skeleton code so the developer can focus on the actual scenario specific metadata definition and leave basic housekeeping to us.
At this point you cannot help but notice the two red squares – these errors are here to remind us to enter the mandatory parameters in the skeleton code which cannot be auto-generated. In this case these parameters are “Namespace” and “Name” fields and as soon as we give appropriate values we are good again.
Next, we would like to create an entity set. All I need to do at this point is to invoke the intellisense feature by pressing “Ctrl + Space” and I am presented with different possibilities as a drop-down list. Much less error prone! Let us select “EntityType” and move on.
You will notice that all the necessary code around the tag “EntityType” is auto-generated. Again, few errors are silently demanding your attention – they are mostly the user defined values for mandatory properties.
Let us quickly define these missing elements – All the “name” fields are obviously arbitrary user defined values but you will particularly notice the “Type” field. If you are someone like me, chances are that you will not remember the list of primitive data types under Sub-heading 6 of Section 1 “Overview” in OData Version 2.0 specification. Well, before we really try to “Google” how exactly they represent the “date” type in OData let us give our intellisense a chance. Here are the results –
Now we can really convince ourselves that it is a context sensitive feature 🙂 Anyway, I hope you get the drift – this is a fairly advanced OData Model editor which you can trust to quickly get your models crafted in an assisted manner. Once you are done, simply export the model using “File -> Export Project or Folder” and a zip file is dropped from cloud to your desktop. In this beta version RDE only supports exporting the entire project or folder so please make sure you select the appropriate folder before attempting to export.
As you can imagine this is just the beginning of our journey. As mentioned earlier in this blog, our larger motivations for doing this are a) simplicity and b) enabling end-to-end development. So as we work towards embedding this experience into the larger development lifecycle and further enrich the product, we invite you to try this out and let us know your feedback. For more in depth technical information feel free to refer product documentation of this tool.
If you have questions, suggestions, feedback etc. feel free to add it as a comment here and we will quickly get back to you. If you prefer to discuss it individually an email is equally good.
Signing off for now~