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

A Simple HANA Application

 

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

 

Pre-requisites:

1. HANA Studio installed and configured with HANA System.

2. Workspace repository to store the projects is created.

 

Procedure:

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.

clip_image001[4]

 

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

clip_image002[4]

 

Enter the name for the project and click on finish.

clip_image003[4]

 

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.

clip_image004[4]

 

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

clip_image005[4]

 

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.

clip_image006[4]

 

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

clip_image007[4]

 

Leave the file empty.

 

Creating XSACCESS file:

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

clip_image008[4]

 

Write the following code in the xsaccess file.

clip_image009[4]

 

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.

 

clip_image010[4]

 

Write the following code in the file.

clip_image011[4]

 

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.

clip_image012[4]

 

 

 

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.

clip_image013[4]

 

 

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

 

clip_image014[4]

 

 

Testing the Application:

Copy the URL for the HANA Server.

clip_image015[4]

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.

clip_image017[4]

 

 

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

clip_image018[4]

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

0 Comments:

Post a Comment

Powered by Blogger.