Skip to Content
Personal Insights
Author's profile photo Bilen Cekic

HANA CatEye! Experimental Project with NodeJS + MongoDB + RaspberryPI3


Hello Everyone,

In my previous article, I have explained BPC on HANA by using HANA objects and their advantages. This time i want to write about NodeJS which is going to be the primary Javascript runtime in HANA XS with SAP HANA SP11. Also I have developed a simple application by using NodeJS named as HANA CatEye.

I’m still beginner in NodeJS but after digging inside the technology, I found NodeJS very simple to learn and develop applications.

No alt text provided for this image

After i read NodeJS will be included in SAP HANA SP11 i decided learn more about it and initially planned to develop a basic “hello world” example. Later on i decided to build an application (HANA CatEye) which can be benefit for my future HANA projects.

One of my biggest problem during the development was keeping track of code changes. Sometimes me or my colleagues need to roll back the code to previous state due to user’s decision on calculation logic, bugs or performance reasons. What i need was a version control mechanism and being aware of any code change.

In HANA, there is already a standard version control mechanism and change management features but I didn’t find it easy and useful. Hence, HANA CatEye application is designed to backup HANA development objects to the local DB, create versions for the changed objects and code version comparison to see what has changed between versions.

It is built based on NodeJS, MongoDB and hosted on Raspberry PI3 which is a microcomputer and a half size of iphone6 that cost around USD 35.

No alt text provided for this image

What is NodeJS ?

It is a JavaScript runtime that uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Maybe many of you know that JavaScript run on browsers but there is an exception for NodeJS, it doesn’t need a browser to run (thanks to Google Chrome V8 engine) and it is commonly used run web servers and handling http requests/responses.

One of the major differences of NodeJS from client side scripting or many other programming languages is, asynchronous nature. For example, reading parameters line 27 and 28 would be execute sequentially, but I/O functions in lines 31 and 32 are triggered concurrently and they are not depended on each other’s result or response time.

No alt text provided for this image

So basically the whole point is it doesn’t have to wait for I/O. Because of that Node scales well for I/O intensive requests and allows many users to be connected simultaneously, we can also extend it to the database access. Multiple requests can be send to HANA database in concurrent without interrupting the process flow of application logic.

NodeJS Modules/Packages

There are many libraries available to be installed over NodeJS to add new functionalities to the applications. For example, we can use module named “Express” as a web application framework to handle low level http library, “HDB” module to connect HANA server, Mongoose for our MongoDB database operations, Swig to render webpage and many other modules which has their own purposes. Even for the same purpose, you can find many modules work in different logic but does the same job. It is a very rich environment.

Installing a module is very easy by using NPM which is our package manager for NodeJS.For example HDB module installation for HANA connectivity is just one line in command tool.

-> npm install HDB

below is how i installed HDB to my project in raspberry.


No alt text provided for this image

After installing, connection also very easy (this is basic connection mode, so we just connect with username and password);

No alt text provided for this image

Currently i don’t have HANA SP11 installation, but in a real implementation we are not going to use HDB module for HANA connectivity which I mentioned above, we will be using SAP delivered modules that is under the installation folder for SP11.

No alt text provided for this image

Below is the usage of modules for both public and SAP delivered ones. We are using “require” command to include modules in our application.

No alt text provided for this image

We didn’t want the traditional application server — large-scale, stateful, necessarily takes a lot of memory

SAP HANA Product Management Director Thomans Jung said “We didn’t want the traditional application server — large-scale, stateful, necessarily takes a lot of memory. We wanted something lightweight and pass-through that was just there as part of the database, and that could do basic RESTful server enablement and web serving, and not a whole lot else”.

They are not only making it lightweight but they are also simplifying the development model


No alt text provided for this image

NodeJS is very lightweight even it can run on Raspberry PI3 with MongoDB without any problem. Below is my tiny Raspberry PI3 that costs around 35 USD. It is running an OS called Raspbian which is a free operating system based on Debian optimized for the Raspberry Pi hardware. I placed a lego near it for you to compare the size. So far i deployed many applications on it and had no problem. 1 GB ram is already enough for NodeJS applications.

No alt text provided for this image

What is HANA CatEye ?

I started learning NodeJS from tutorials and paid more attention after i heard it will be in SAP HANA. Later I decided to build this application based on one of the tutorial related to CRUD operations on MongoDB that i found on the web.

Currently for my BPC on HANA development, I have more than 100 procedures. We keep adding and removing new lines from the current procedures based on needs. Keeping the track of changes is really difficult.

Here comes the CatEye, it connects the HANA server by using HDB module, checks the source code of existing procedure, creates a new version and save in to MongoDB which is also running on Raspberry PI3.MongoDB is a perfect fit for NodeJS applications. It lets us to focus on front-end rather than database layer.

Backup time took around 4 seconds for 100+ procedures, which is much faster than SAP Hana Studio :).

First of all, lets create a dummy procedures and see the result:-


No alt text provided for this image

We have created 2 procedures named ZTEST_GET_GUID and ZTEST_GET_MATERIAL.

Then, I open CatEye application and click on “Meow” button;

No alt text provided for this image

CatEye connected to HANA system and based on my selection filters on the backend, it will read the specific procedures. It will also count the local objects available in CatEye system which is either transferred from HANA or manually added.Application send 2 concurrent requests to read both from HANA server for the procedures to be transferred and MongoDB for the actual ones on our local.

Due to non-blocking architecture, those requests won’t stop the flow of application logic and whenever their response is sent, their result is loaded to the page separately.

After clicking Sync button, procedures are transferred to our local.

No alt text provided for this image

And lets check the objects on our local MongoDB.

No alt text provided for this image

For demo purpose, I changed ZTEST_GET_MATERIAL procedure and also created a new procedure ZTEST_GET_PRICE on HANA layer. Lets Sync again!

No alt text provided for this image

Now Cateye found a new procedure(ZTEST_GET_PRICE) and created it and also created second versions for the updated procedure(ZTEST_GET_MATERIAL). Lets use version comparison;

No alt text provided for this image

Red lines no more exist on new version and green line is the changed line. Now we can easily backup and track what has changed on procedures :).

You can find the video of the actual integration and version comparison here;

Overall, the project took 2 weeks to develop. I build from scratch and really had so much fun & learn many things during the development phase of this experimental project. There are several NodeJS modules used on the application, some examples are ; SAP HANA connectivity(hdb), managing asynchronous flows(async), notifications(toastr), parsing POST data(body), MongoDB operations(Mongoose), code highlighting(react-highligt) ,rending HTML pages(swig), showing code difference(diff) all has their own specific purpose. I asked to Thomas Jung if SAP is limiting us for any NodeJS modules/packages and he said there is no limitation but we are responsible for any bugs/security problems caused by the public module. I can not wait to use NodeJS in HANA SP11 with real scenarios 🙂


Thomas Jung SP11 new developer features ; .

Why HANA XS is moving to NodeJS ?

HANA change management and version control;

Top 10 reasons to use NodeJS :

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.