The HANA SQL Console
The HANA SQL Console

The HANA SQL Console

Published at October 19, 2018by Jörg Brandeis

The following texts were partially or completely generated with the help of generative AI models.

To learn the SQLScript language, the SQL console of the various development environments (IDEs) is the ideal tool. In this post I would like to briefly explain why the SQL console is not just a tool for nerds. When it comes to learning SQLScript, it is even considerably superior to the other interfaces, in particular the AMDP development environment for BW transformations.

The temporal separation of cause and effect

In the middle of the last century, my aunt had learned to program computers on mainframes. Back then you still had to punch your programs onto punch cards. These were then read into the system as a batch and processed. For this, the students were each allotted a small time slice at night in the computing center, since during the day the computer was needed for more important tasks. So the programs were run at night, and the next morning the students could then pick up their results. If an error occurred, it had to be fixed by their next time slice, and so on...

You can learn programming that way too. But it goes faster if, after making corrections, you can run a program again and again in a timely manner. Without long waiting times and without complicated procedures for entering the data.

Make mistakes, spot mistakes, fix mistakes, repeat... and all within a short period of time.

Short feedback cycles when programming SQLScript

And what does that have to do with SQLScript now? Anyone who wants to learn the language by writing AMDP transformation routines for SAP BW faces a similar problem. To run the code, a lot of prerequisites are needed:

  • An InfoProvider as the data source
  • An InfoProvider as the target
  • Suitable data in the source
  • The transformation between source and target
  • An associated AMDP routine, e.g. an end routine
  • A data transfer process (DTP)

And only once we have all of this together can we get started. We can then look at the result in the data target using SE16. And for the next run, the previous request first has to be deleted. On top of that, at least with some system releases, the DTP has to be reactivated after changes to the AMDP routine... Not quite as bad as punch cards, but for learning it isn't really good either.

For experienced SQLScript developers this environment is quite acceptable, since here the number of iterations is correspondingly lower. But if, for example, you just want to quickly try out how best to determine the following calendar month for a given date, you need a suitable playground without a lot of overhead.

Learn faster with the SQL console

In the SQL console you can directly enter SQL commands, which are then executed on the HANA database. To enter SQLScript code, it has to be surrounded by an anonymous block. But that is not rocket science and is quickly learned. The code you have entered can be run over and over again.

This makes it possible to repeat queries elegantly and quickly until they deliver the correct result.

Why is the SQL console used so rarely?

Often the HANA SQL console is not reachable for developers on the SAP BW or SAP NetWeaver systems, because there is only a connection to the application server and not to the database. Traditionally, only administrators have access to the latter.

A solution to this problem can be a free HANA system on the SAP Cloud Platform. Or a local installation of the SAP HANA, express edition.

More articles

New!
New!