Skip to Content

Some of you might have seen the tinyworld example originally made available for HANA XSA. As you also might know HANA XSA is pretty similar to the CloudFoundry standard except it is running “on premise” so to say.

The intriguing thing about tinyworld is that it is more or less the “hello world” for an end to end scenario using HANA on XSA. And such it could be for CloudFoundry too. In fact it works pretty well when switching to SAP Cloud Platform CloudFoundry with a few nifty details…

For efficiency reasons I am writing this blog to get you through the example with less hurdles than I had. This may be obsolete in the future or incomplete, as cloud development brings a new challenge we never had the pleasure to live with: updates can really annoy you, as they come faster then ever before. This means also that menus and functionality may change faster than we have been used to it. As a result manuals and blogs cannot keep up with that speed. So this blog also becomes an experiment how to handle cloud dev speed in the future.

First let me point to some reference of documentation. As said before the base for this will be the HANA manuals with Create a Simple “Tiny-World” Application.

To prove my point you also might want to check out the blog series of my colleague Chaim Bendelac Developing with XS Advanced: A TinyWorld Tutorial written in 2016. You will find that this tutorial still is somewhat accurate, but webIDE has changed since. The big advantage is that is has – unlike the manuals – pictures in it. And there are still some deeper explanations (like in chapter 7, “Under the Hood) that explain some details worth knowing.

Begin with the beginning:

When starting with the tutorial Create a Simple “Tiny-World” Application the first step says:

  1. Start the SAP Web IDE for SAP HANA.

Obviously as we want to use CloudFoundry your WebIDE is the “SAP Web IDE Full-Stack” which does not yet run from CloudFoundry, but from the NEO stack. It is OK to actually start it from your trial account. If you own already a commercial account you have access to  this WebIDE. The only difference between trial and commercial account is that a GiT connection is not working. But this is not part of the tutorial anyways.

Following the tutorial from here on works pretty well. there are some differences in the result of generated files like in step 3. The generation of the mta.yaml does not look like described for HANA XSA, but takinf this with a grain of salt you will recognize that it it logically the same. Instead of

- name: hdi-container

it generates

- name: hdi_tinydb

When referring to the rest of the file you will find that this is just a change in name and everything sorts out in the rest of definitions.

I will not further refer to such logical changes. Also please be adviced that CloudFoundry URLs are much more complex than the ones mentioned in the HANA manuals. This should not disturb you and the rest of the first part of the tutorial should work like a charm.

In step

8. Create an HTML5 module for the client user interface.

you are asked to chose “Basic HTML5 module”. This option does not exist in the Cloud WebIDE. Instead  do the following:

  1. Chose New-> HTML5 Module
  2. Use template SAP UI5 Application and click next
  3. Name it tinyui
  4. Namespace: tiny (does not matter)
  5. Click next
  6. Chose ViewType: None and click finish.
  7. Copy the code from the tutorial step 8.c.
  8. Go to tinyui/webapp and open index.html.
  9. Replace all the code with what you just copied.

 

First hurdle

Once the tutorial works for you there is another one right after this in the manuals that continues with more interesting stuff :

Extend the “Tiny World” Application to Use an OData Service and a Client UI

This one has a real bug in the description of step number

9. Set up the details of the calculation view.

The description somehow exchanged the two objects of a Projection and an Aggregation node. The non picture politics of SAP manuals do another part to confuse you. This is how your picture should look at the end:

Despite what the tutorial says you are starting with the existing Projection node and have to add the aggregation. And as we just post some pictures, this is the icon that gives you the aggregation node:

Once this is done in

10. Create an OData service to display exposed parts of your data model.

there is one warning from my side: DO NOT COPY MTA CODE FROM THE MANUALS.

Add the three lines mentioned only manually as MTA files do not like specific invisible control codes coming with the copy. And while we are there: remember that our name for the hdi container is different than in HANA XSA? Your mta.yaml should look like this after the change with only the bold stuff added.:

- name: tinyjs
type: nodejs
path: tinyjs
requires:
- name: tinydb
- name: hdi_tinydb
provides:
- name: tinyjs_api
properties:
url: ${default-url}

 

If you have the idea of doing your own additional odata service even less complex than using a view -for example just a table from your db, then there is another hint for you. the full odata file looks like this:

service {
"tinyworld.tinydb::myview" as "euro" keys generate local "ID";
"tinyworld.tinydb::tinyf.world" as "world" ;
}

The full name of a database object can be seen in the database explorer when clicking for example on the database tables in the lower left window.

 

No hurdles at all…

After this the further chapters

Add Business Logic to the “Tiny World” Application

Debug the JavaScript Code in the “Tiny World” Application

Run Unit Tests on the “Tiny World” Application’s JavaScript Code

ran really well for me.

 

There is more interesting stuff and I will continue to check this. Stay tuned for more “slightly changed tutorials”. Link will be added here as soon as more is available.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply