Skip to Content
Author's profile photo Alvaro Tejada Galindo

Even kids can play with SAP HANA

/wp-content/uploads/2015/10/d_shop_blog_logo_803474.jpg

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


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.

SmallBasic_Logo.pngSmall Basic comes with a nice and very simple IDE…

SmallBasic_001.jpg

SmallBasic_002.jpg

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.

Calculation_View.jpg

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…

HANA.sb

LDDataBase.Connection=”DRIVER={HDBODBC};SERVERNODE=YourServer:30015;DATABASE=SYSTEM;UID=YouUser;PWD=YourPassword”

Db = LDDataBase.ConnectOdbc(“”,””,””,””,””,0,””)

GraphicsWindow.Show()

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?


SmallBasic_003.jpg


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

Assigned Tags

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