Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
19,903

Introduction

With this blog I would like to recap here all the steps to consume, with SAP Web IDE, data coming from a HANA XS instance located on the Trial landscape. There have been a lot of discussions around this topic on SCN, with many pieces spread around: for this reason I would like to show a step-by-step procedure to achieve this goal.

Let's give a look to the current architecture: if we want to connect our SAP Web IDE to an OData source like to the HANA XS instance we need to go through the creation of a destination in the HANA Cloud Cockpit, which connects on its turn to a Cloud Connector installed either on a local workstation or on a centralised server.

The Cloud Connector should be then able to connect to the HANA XS service. Unfortunately this is not possible on HANA Trial because for this landscape the Cloud Connector should be able to go through the SAML2 authentication, but as of now this is not possible.

To overcome this issue we could use a workaround, we could install a proxy in between the two things: HANA XS instance on one side and Cloud Connector on the other. This proxy server will be able to accept requests coming from Cloud Connector and translate them in SAML2 requests to forward to the HANA XS instance.

There is already a proxy, created by a SCN user, Gregor Wolf, that plays this role: it's located here.

The installation of this proxy is pretty simple and we'll see it in the next steps.

Prerequisites

  • A HANA XS OData service to consume on the HANA Trial platform
  • SAP Web IDE (you can register at SAP HANA Cloud Platform to get your development environment)
  • HANA Cloud Connector 2.7.1 downloadable from here
  • Gregor Wolf's proxy downloadable from here
  • NodeJS

Walkthrough

This is the list of the main steps we'll go through:

  1. Installation of the proxy
  2. Cloud Connector configuration
  3. Destination configuration
  4. Consuming the HANA XS service with SAP Web IDE

NOTE: For this exercise we are supposing that you already have a Trial HANA XS service to consume. If you don't have one or if you just want to create a basic one by yourself, you can follow another blog of mine: How to create a new OData service using the Web-Based Workbench (v2.0)

Let's get started!

1. Installation of the proxy

Let's start with the installation of the proxy. This is the piece with the green arrow you see in the architecture picture. It will take care of communicating with the HANA XS instance on the Trial landscape. For this reason we have to provide it with the URL to the HANA XS service.


  • Download or clone the Git repository of the proxy located here


  • If you have downloaded the package, extract it in a suitable folder of your drive


  • Open a terminal window and go in the folder with the proxy. You should see something like this:


  • Inside the folder hanatrial-auth-proxy, run the command npm install in order to install all the required packages

  • Open the example/config.js file with your editor

  • Choose the port you want to use for this proxy (by default it's set on 7891)

  • Enter the host name taken form the URL string to the HANA XS service

(i.e. from "https://s6hanaxs.hanatrial.ondemand.com/i045523trial/dev/myproducts/services.xsodata" take just "s6hanaxs.hanatrial.ondemand.com")

  • Leave the other options untouched and save the file. In case you are behind a proxy firewall, you need to uncomment the proxy line in this file and enter the correct proxy address and port for your network

  • Start the proxy with the command node examples/server-basic-auth.js


  • You can test the proxy by navigating to the following URL

http://localhost:7891<path_to_the_service>/$metadata where the <path_to_the_service> string is the part of the service URL after the host name (i.e. /i045523trial/dev/myproducts/services.xsodata)


  • You should get something similar to this


  • If you check the terminal window you can see that the proxy is forwarding the requests the browser issues to the HANA XS instance



2. Cloud Connector configuration

Let's now create a new access control in the Cloud Connector.

  • Open the Cloud Connector administration console

  • Click on the Access Control menu item and click on the Add button on the top

  • Set "Non-SAP system" as the Back-end type

  • Set "HTTP" as Protocol

  • Enter "localhost" as Internal Host and "7891" as Internal Port

  • Enter "hanaxs.virtual" as Virtual Host and "8080" as Virtual Port

  • Set "None" as Principal Type

  • Leave the Description blank

  • Click on Finish

   

  • For the added mapping, define also a new resource path

  • As the URL path you need to specify the account name you get from the service URL prefixed with a "/" symbol (i.e. for https://s12hanaxs.hanatrial.ondemand.com/i045523trial/dev/myproducts/services.xsodata take just the red part) and select as access policy to get Path and all sub-paths. Then click on Save

  • You should get something like this

3. Destination configuration

Create a new destination for the service URL you configured as the virtual URL in the Cloud Connector.


  • Create a new destination (i.e. "hanaxs") with the following parameters:
ParameterValue
Namehanaxs
TypeHTTP
Descriptionhanaxs
URL<the virtual URL with port defined in the Cloud Connector (i.e. http://hanaxs.virtual:8080/)>
ProxyTypeOnPremise
CloudConnectorVersion2
AuthenticationBasicAuthentication
User<hana_trial_user_for_the_service>
Password<hana_trial_password_for_the_service>

  • Add these 3 additional properties as well

PropertyValue
WebIDEUsageodata_xs,odata_gen
WebIDEEnabledtrue
WebIDESystem<the same name of the destination> (i.e. hanaxs)

  • Save the destination, you should get something like this. It will take up to 5 minutes for the changes being applied

  • If you want you can also test the destination by typingin the browser a URL like this:

https://webide-<your_hana_trial_account>.dispatcher.hanatrial.ondemand.com/destinations/hanaxs/<path_to_the_service>/$metadata

where <your_hana_trial_account> is the account you use for SAP Web IDE and <path_to_the_service) is the string just after the host name in your service URL

4. Consuming the HANA XS service with SAP Web IDE

The final step is to create a SAP Web IDE project to consume the OData service.

  • Open SAP Web IDE

  • Choose File --> New --> Project from Template

  • Select one of the templates (i.e. SAP Fiori Master-Detail Application) and click on Next

  • Enter the name of the project and click on Next

  • On the Data Connection page, click on Service URL, choose the name of the destination you created in the previous step, enter the path to your OData service (you can omit the protocol and the host name since they are defined in the destination), click on Test and, once you get the details on the right, click on Next

  • Define the fields you want to see in the application

  • Click on Finish

  • Run the application and you will get it perfectly working:

Congratulations! You have successfully consumed your HANA XS OData service with SAP Web IDE.

22 Comments