Authors - Bakov Rustam, Lyudmila Dmitrieva, Dmitry Kulnev, Yury MedvedevHello, Habr community!
In this article, we will not talk about SAP HANA, they talk and write so much about it, but we will show you how you can play with the system and create a simple application from the Hello World series using the Eclipse development environment.
')
First we set up the Eclipse development environment with the necessary plugins. Plug-ins to work with SAP HANA exist for two versions of Eclipse - Luna and Kepler. If you do not have Eclipse installed, you can download it from the links:
Luna -
www.eclipse.org/lunaKepler -
www.eclipse.org/keplerIn our example, we will show all the configuration steps using the example of Eclipse Luna.

The next step is to install plugins - a standard process for Eclipse. The only "but" - versions of plug-ins for Luna and Kepler are different, so choose the one that suits your version of Eclipse.
Link to Luna plugins -
tools.hana.ondemand.com/lunaLink to plugins for Kepler -
tools.hana.ondemand.com/keplerSelect Help from the top Eclipse menu and select Install New Software.

Copy the link into the string Work with: and add it to the list of saved links.

After that there will be a list of plugins available for download. From this list, we are only interested in two plugins:
• ABAP Development Tools for SAP NetWeaver - it contains all the necessary tools for development in the ABAP language;
• SAP HANA Tools - this plugin includes all development tools for SAP HANA, including tools for administration (at developer level), database design and development based on the SAP HANA platform.

We mark these two plugins for installation and click on the Next button.

After that, reviewing the list of installed components and agreeing to the license agreement,

waiting for Finish.
After restarting Eclipse, you are greeted by an updated welcome page. On it you can find links to articles on the basics of development in the ABAP language, as well as many other useful information.

Click on the Workbench button in the upper right corner and get into the “work zone” of the development environment. The next step is to choose the necessary development prospects.
This can be done in two ways. The first is to go to Window-> Open Perspective-> Other ...
The second way is to click Open Perspective directly on the prospects panel.

We need to add two perspectives one by one: SAP HANA Administration Console and SAP HANA Modeler.
This completes the preparation phase of Eclipse, now you can go directly to obtaining test access to the SAP HANA Cloud Platform.
Get it easy enough. First, go to
account.hana.ondemand.com/register and register on the site. Secondly, after registering and logging in, you need to go to the control panel of the cloud platform by clicking on the appropriate link on the site navigation bar or simply follow the link:
account.hanatrial.ondemand.com/cockpit
Here we see several tabs leading to viewing and setting up different parts of the cloud platform. Now we are interested in creating the so-called HANA XS application - let's create it!
Creating a new instance of the applicationClick on the HANA Instances in the quick access panel on the left.
To gain access, you need to create a new test sample (New Trial Instance) and, specifying its name, save the changes.
Adding a system (Eclipse)Now connect together Eclipse and SAP HANA. To do this, run Eclipse and open the perspective of SAP HANA Development. Then go to the Systems tab. It will look something like this:

Click the right mouse button and select Add Cloud System. After that you will need to enter your account name, username and password.

Your account name is right here.

If you forgot your password, you can recover it here.

After clicking on Next, Eclipse asks which instance to select. Most likely, you will see only one available option (the one that was just created).

Select it and click on Finish.
Let's see what happened in the end.

Of interest are the two packs - Catalog and Content. In the HANA system directory, we can use two schemes: NEO_ and DEV_. The database schema with the prefix NEO_ is a schema for development, that is, you must save there all the artifacts related to the development of the application. The scheme with the DEV_ prefix is ​​your personal scheme, you can store anything in it, but only if these objects are not used in the main development.
And in the Content folder we will see our newly created HANA XS application project.
So, the tools are configured, the connection with SAP HANA is established - it's time to create a new application.
Adding a new projectGo to the Project Explorer tab.

Choose from the main menu File-> New -> Project and select SAP HANA-> Application Development-> XS Project.

Set the name of the project, check that the Share project in SAP repository box is checked, and go ahead.
Repository selection
In the new window, you must select the current workspace (Default Workspace).

We get:

Choosing the path for the Repository Package


It will look like this:

Click Next and go to the next step.
Creating objects of our applicationFill in the XS JavaScript field.

Next, click Finish.
As a result, we have a new project in which development will take place.
HelloWorld.xsjs fileThe file “HelloWorld.xsjs” was generated automatically in the previous step and contains some code. We will clean it up and add the simplest functionality that implements:
1. Read data from SAP HANA
2. Displaying results in HTTP format in the browser
To do this, update the contents of the file with the following code:
$ .response.contentType = "text / html";
var output = “Hello World! Message from system ";
var conn = $ .db.getConnection ();
var stmt = conn.prepareStatement (“SELECT value FROM m_host_information WHERE key = 'sid'„);
var rs = stmt.executeQuery ();
if (! rs.next ())
{
$ .response.setBody (“Failed to retrieve data!”);
$ .response.status = $ .net.http.INTERNAL_SERVER_ERROR;
}
else
{
output = output + rs.getString (1);
}
rs.close ();
stmt.close ();
conn.close ();
$ .response.setBody (output);
$ .response.status = $ .net.http.OK;
We get:

The program refers to the “m_host_information” table for information on the unique identifier of the SAP HANA system. The resulting information is added to the hello text "Hello, World!"
We activate the script.

Then go to Cockpit and see that our HelloWorld application appeared in the HANA XS Applications tab (you may have to restart Cockpit to see it). We take the URL of our application,

we register in it the created script and we start.

The script successfully worked!
So, you are familiar with the development of the simplest HANA application using the Eclipse development environment.
We are ready to discuss with you our post, answer your questions and talk about the tasks that interest you!