Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com

A Simple HANA Application


This tutorial explains how to develop a simple functional HANA Application.



1. HANA Studio installed and configured with HANA System.

2. Workspace repository to store the projects is created.



1. Create an XS Application Project

2. Share the application project with the HANA Server

3. Create all the necessary development Artifacts

4. Execute the application.


Step 1: Create an XS Application project:

In the menu, choose the file à New à Project.



In the pop up wizard for new project, choose the folderà SAP HANA Development à XS Project and click on next.



Enter the name for the project and click on finish.



Your HANA project will be created with all the necessary files included.



Step 2: Share the project with HANA Server

The project we have created now remains local in our machine. We have to create the project in the HANA Server to be executed. Hence sharing the project will create the underlying project in the HANA Server.

Right click on the application project and choose the menu Team à Share project.



In the pop up choose the repository workspace which you have configured and click on finish.



Now a package will be created at the SAP HANA Systems and a folder will be created in the SAP HANA repository. You can view them in the respective perspectives.


Step 3: Creating all the necessary development artifacts.

1.  xsapp file à Provide privileges to access HANA Packages

2. xsaccess file à Provide information on authentication to  access the application (eg. security)

3. xsjs file à Javascript code that contains business logic



Note: There should be only one .xsapp file and .xsaccess in the project. Hence SAP has restricted to create these extension files with no names making it unique.

Creating XSAPP File:

Right click on the project and create a file.



Create the file without name, only with extension and click on finish:



Leave the file empty.


Creating XSACCESS file:

Similarly create the file xsaccess with no name and click on finish.



Write the following code in the xsaccess file.



This is to specify that the application can be exposed and the basic authentication method is to be followed (username and password).



Creating a XSJS file:

Similarly create a file with extension xsjs.




Write the following code in the file.



This is a simple java script code that set the content type of the web page and sets its output using the javascript function embedded in the project library. You can see them in the xs javascript api’s. Make use of these methods to request or provide response to the webpage.





We are done with our development artifacts now. Now commit and activate the project. This will copy the changes that we did in our project in the underlying HANA Database.


Right click on the project à Team à Commit.

Right click on the project à Team à Activate.




You can see the Icons of the files have been changed with an orange bar which represent the file has been activated successfully.





Testing the Application:

Copy the URL for the HANA Server.


The URL which was hidden in red, run this url in browser with Port 8000:

You should get a page your HANA Server is up and running.




Direct the URL to the .xsjs file of your project.


Note: The url path depends on the location where you have placed your project. With the basic authentication method you will be requested for HANA database user name and password. This will be requested only once.



About Arun


Post a Comment

Powered by Blogger.