lunes, 5 de octubre de 2015

Even kids can play with SAP HANA

This post was originally posted on Even kids can play with SAP HANA.

Small Basic is a programming language created by Microsoft and based on the BASIC language. It’s aimed to teach kids how to code as it comes with Syntax Highlighting, Intelligent Code Completion and In-Editor documentation access. On top of that…the language has only 14 keywords.

Small Basic comes with a nice and very simple IDE…

And the Code Completion is just wonderful and nicely documented.

In order to access SAP HANA via ODBC we need to download the awesome library called LitDev.

Just extract it and copy the DLL’s and XML’s into a folder called “lib” inside your Small Basic installation. If you have any problems, simply right click the LitDev.dll file and unlock it.

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 -;) (This part is not exactly kid friendly…so look for the help of an adult)…

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

First, we need to create a Join object and link the table by MANDT and CARRID. From here select the following fields as output MANDT, CARRID, CARRNAME, PRICE and CURRENCY.

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.

The SAP HANA part is done…so we can move into the Small Basic part…

Now, simply create a new file and paste the following code…
Db = LDDataBase.ConnectOdbc("","","","","",0,"")
Lv = LDDataBase.AddListView(GraphicsWindow.Width,GraphicsWindow.Height)
Quote = Text.GetCharacter(34)
Query = "SELECT * FROM" + Quote + "_SYS_BIC" + Quote + "." + Quote + "Blag/FLIGHTS_BY_CARRIER" + Quote
LDDataBase.Query(Db,Query, Lv, "False")

Replace Blag with your own package name -:)

Easy, huh?

There you go…now even kids can leverage the power of SAP HANA -;)


Development Culture.

2 comentarios:

Fábio Pagoti dijo...

Blag.. you know things I would never imagine they exist. Trully awesome.

Alvaro "Blag" Tejada Galindo dijo...

Thanks Fabio -:) But that might be because of two simple things -;)

a) I'm a programming junkie
b) It's my job -:P


Development Culture.