Developing with XS Advanced: A TinyWorld Tutorial
TinyWorld – Part 1
Introduction to the TinyWorld application
In his recent blog post, SAP HANA SPS 11: New Developer Features; XS Advanced, Thomas Jung introduced XS Advanced, the new application service that is included with SAP HANA, starting with SPS11.
This blog is the first part in a multi-part tutorial, in which we will learn how to develop business applications for SAP HANA and XS Advanced.
In the past you may have used the SAP HANA studio. In this tutorial, we will build our application using the brand new SAP Web IDE for SAP HANA.
SAP Web IDE for SAP HANA (herein: Web IDE) is available with HANA SPS11 and later, for use with XS Advanced. It is a new adaption of the existing SAP Web IDE (available on HCP), and is specially designed for developing entire business applications on SAP HANA.
Figure 1 – SAP Web IDE for SAP HANA
For more information on how to obtain and install the SAP Web IDE for HANA, and for full documentation, see http://scn.sap.com/docs/DOC-71432.
See SAP HANA SPS 11: New Developer Features; SAP Web IDE for SAP HANA for additional links, including a SAP Academy recording of this tutorial, for those of you who prefer watching videos.
Multi-module business applications
Business applications usually consist of multiple tiered parts (modules) which together form a complete application.
The most common case is a multi-module application consisting of a database model, some business logic (written in a server-side programming language like Java or Node.js), and a user interface app that accesses the data model via the business logic or via OData interfaces.
Developers of multi-module applications must carefully agree on APIs. Testing, installing and deploying such applications (particularly in cloud environments) is very challenging due to the need to orchestrate all these different activities.
SAP HANA based multi-module applications usually follow a standard pattern: the database model consists of data aggregations, filters and selection logic on top of basic tables, designed using CDS specification language and rich Calculation Views. The data model can be accessed via SQL, or can be exposed via OData to allow UI apps to directly access the data. UI apps usually use the SAP UI5 design library.
The TinyWorld application
To illustrate the use of the Web IDE and of programming in the SAP HANA XS Advanced environment, we are going to develop a small application called “TinyWorld”.
TinyWorld is an example of such a three-tier multi-module application. Users use it to create and view a simplified model of the world, merely consisting of continents and their countries.
TinyWorld comprises the following modules:
- tinyui: A UI app module, written with HTLM/JS
- tinyjs: A business logic module, written with Node.js
- tinydb: An SAP HANA database module
As you may have inferred, it is intentionally a really small application, so that you will not be distracted by unnecessary details, and can focus on the development experience of working with SAP HANA and XS Advanced.
To gain a good understanding of the development process we recommend that you try to follow the steps of the tutorial in the order it is presented. However, if you do not have time, you can also access and study the source code, and then read this tutorial to understand how it was constructed (see the Appendix for instructions).
The entire TinyWorld tutorial is structured as follows:
Part 1: Introduction to the TinyWorld application (this blog)
The basic tutorial
Part 4: Add SAP HANA business logic
Part 5: Add business logic with Node.js
Part 6: Create Node.js unit tests
Part 7: Under the hood
Part 8: Source control
Part 9: Application life cycle
Part 10: Add authentication
Part 11: Add authorization
Appendix: Getting the source code
More sections will be added over time, so keep checking back.
Prerequisites for this tutorial
Become a qualified developer
To access the Web IDE, you will need the username and password of a development user. Details depend on how users, authentication and XS Advanced orgs are configured in your landscape. If SAP HANA is the identity provider of your system (usually), here is how your administrator might create a development user called Peter:
- Using a HANA console (Studio, Cockpit, hdbsql client, etc.), enter the following SQL:
- Using the XS command line tools, login to xs (system/installation dependent) and enter:
initial SAP SpaceDeveloper
Note: In order to deploy applications into another space, you will require SpaceDeveloper rights in that space as well.
Login to the Web IDE and the SAP HANA run time tools
The actual URL of the Web IDE is installation dependent. The following command returns the URL in your system:
xs app webide -urls
Use the resulting URL in your browser (Chrome, Netscape). For the first time, you may be required to change your administrator-provided password (i.e. Mysecret1, in the above example). Also, ignore any “your connection is not private” messages you may see.
Similarly, the URL of the SAP HANA runtime tools (herein RTT) can be determined via the following command:
xs app hrtt-core -urls
This tool is loaded in a separate browser window.
We recommend the use of Chrome or Firefox as your browser for the completion of this tutorial.
Summary of part 1
This blog is the first of a multi-part tutorial, teaching you how to develop HANA based applications with XS Advanced, using the new SAP Web IDE for SAP HANA development tools.
We hope that you will enjoy the rest of this tutorial.
And now, let’s get started: Get started with the SAP Web IDE for SAP HANA !