Skip to Content
Author's profile photo Alvaro Tejada Galindo

Node-RED -> Visual Node with SAP HANA


If you are an SAP Employee, please follow us on Jam.

Node-RED is a visual tool for wiring the Internet of Things.


In other words…it’s NodeJs with a nice visual interface.

In order to make it work, we can do the following.

Download NodeJS version 0.10.X for your corresponding architecture and OS.

Linux Binaries 32Bits or 64Bits.

Mac OS X Installer

Windows Installer 32Bits or 64Bits.

I used Linux and here’s the most practical way to install it…

After downloading the package simply do..

sudo tar C /usr/local stripcomponents 1 xzf nodev0.10.36linuxx86.tar.gz

With that, NodeJS should be up and running…so now it’s time for Node-RED.

sudo npm install -g node-red

As easy as that 🙂 Now, simply run node-red on the terminal and open a browser with http://localhost:1880


Well…no example or demonstration would be complete if we didn’t hook it up with SAP HANA, right? So…let’s go and do it 😉

First, we need to create a Calculation View and call it “FLIGHTS_BY_CARRIER”. It will be composed of two tables, SCARR and SFLIGHT.

Next, create a Join object and link the table by MANDT and CARRID. From here select the following fields as output MANDT, CARRID,


Then create an Aggregation object selecting the fields CARRNAME, PRICE (As Aggregated Column) and CURRENCY. Filter the CURRENCY field by ‘USD’.

Then create a Projection object and select only PRICE and CARRNAME.

On the Semantics object make sure to select “CROSS CLIENT” as the Default Client.


Now, switch to the SAP HANA Development View and create a new repository. Call it “Flights”.

Create a new “XS Engine” project and call it “Flights” as well. Link it to the “Flights” repository.

Create an empty “.xsapp” file.

Create a file called “.xsaccess” with the following code.



“exposed” : true,

“authentication” : [ { “method” : “Basic” } ]


Finally create a file called “flights.xsodata” with the following code


service {

          “Blag/FLIGHTS_BY_CARRIER.calculationview” as “FLIGHTS” keys generate local “Id”;


Activate your project and launch it on your browser, you should see something like this…


The SAP HANA part is done…so we can move into the Node-RED part…

First, select the http node and fill in /hana in the url section



Now, select the http request node and fill in the URL


And the rest of the data…



Now, select a Function node and fill in the following source code…



var results = msg.payload.d.results;

var message = “”;

for (i=0;i<results.length;i++){

    var carrname = results[i].CARRNAME;

    var price = results[i].PRICE;

    message += carrname + ‘ : ‘ + price + “\n”;


msg.payload = message;

return msg;


Select a template node and simply pass this…




Finally, select an http response node and name if you want 🙂



In the end…you should end up with something like this 😉


We’re done 🙂 And BTW…if you don’t feel like doing anything like this…you can always copy this code and import it back to Node-RED…

[{“id”:”4ae9ba82.b51644″,”type”:”http in”,”name”:””,”url”:”/hana”,”method”:”get”,”x”:155,”y”:91,”z”:”3c0f3fe4.c3f0c”,”wires”:[[“ded8853e.212778”]]},{“id”:”ded8853e.212778″,”type”:”http request”,”name”:”HANA”,”method”:”GET”,”ret”:”obj”,”url”:”$format=json“,”x”:329,”y”:102,”z”:”3c0f3fe4.c3f0c”,”wires”:[[“c177bd31.3e884”]]},{“id”:”c177bd31.3e884″,”type”:”function”,”name”:”GetInfo”,”func”:”var results = msg.payload.d.results;\n//var message = [];\nvar message = \”\”;\nfor (i=0;i<results.length;i++){\n    var carrname = results[i].CARRNAME;\n    var price = results[i].PRICE;\n    //message[i] = carrname + ‘ : ‘ + price + \”\\n\”\n    message += carrname + ‘ : ‘ + price + \”\\n\”;\n}\n\nmsg.payload = message;\nreturn msg;”,”outputs”:1,”valid”:true,”x”:507,”y”:179,”z”:”3c0f3fe4.c3f0c”,”wires”:[[“c59088cb.3a6f78”]]},{“id”:”1995c536.e66a3b”,”type”:”http response”,”name”:”Response”,”x”:653,”y”:359,”z”:”3c0f3fe4.c3f0c”,”wires”:[]},{“id”:”c59088cb.3a6f78″,”type”:”template”,”name”:”Template”,”field”:”payload”,”format”:”handlebars”,”template”:”{{payload}}”,”x”:487,”y”:321,”z”:”3c0f3fe4.c3f0c”,”wires”:[[“1995c536.e66a3b”]]}]


To run it…simply select “Deploy” and head to http://localhost:1880/hana


Awesomely easy, huh? 🙂

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Hendrik Neumann
      Hendrik Neumann

      Hi Blag,

      Nice and easy to follow!! 🙂 Reminded me of Gregor Wolf's sitfra where he also used Node-RED.

      He wrote about  his a bit more complicated approach here: Raspberry Pi on SAP HANA Cloud Platform - without Java - Part 1: XSODATA Backend

      Looking forward to try Node-RED myself. Your blog seams to be a good starting point before moving on to the Raspberry Pi Integration...

      Best Regards


      Author's profile photo Alvaro Tejada Galindo
      Alvaro Tejada Galindo
      Blog Post Author

      Hello Hendrik:

      It's been a long time since the last time I saw Gregor 🙂 So thanks for sharing the link...he's doing some awesome stuff as always 😀

      Mine is for sure more aimed for people who has never used Node-RED I hope you like it and let me know if you run into any problems 😉



      Development Culture.