Skip to Content

Hi, my name is Tomer and I’m a developer at SAP HANA Cloud Portal.

One of the most powerful capabilities of this product is an easy integration with SAP back-end systems. In this blog post, I would like to explain how to create a connection between the Cloud Portal and SAP CRM back-end system.

The story behind this scenario is very simple: we want to create a site that contains a simple form. This scenario is to simulate the lead generation process a.k.a web-to-lead, a common scenario across business web sites. NOTE: The following steps are specific for connecting to the CRM back-end system. Similar steps should be applied when connecting to other back-end systems. In addition, in this scenario we do not address the issue of authentication since the site in this scenario is a public site. Propagating the user identity to the back-end would require additional configuration.

First, here is a diagram that should clarify things:


To access an SAP back-end system from the Cloud, an installation of a Gateway server and services are required. In addition, we have to install an SAP Cloud Connector and define the connection between the Gateway service (OnPremise endpoint) and the Cloud Portal instance (Cloud endpoint). And last, we have to define a HANA Cloud destination on the Cloud Portal, pointing to the Gateway service.

Step 1: Create a Gateway Service

The main motivation for using Gateway is to consume SAP back-end systems (such as ERP, CRM) and HANA application data as OData. Gateway converts data to an OData structure, making it possible for any application that consumes OData to use the information easily. In our scenario, we would like to inform the user that the form was successfully submitted. We first have to build a Gateway service using the Service Builder. There are many good tutorials in the web describing how to use the Service Builder. Here are examples for such tutorials: 



After you finish building the Gateway service, you continue to enabling a secured connection from the cloud using the SAP Cloud Connector.

Step 2: Install and Configure SAP Cloud Connector

We use the SAP Cloud Connector to expose a back-end server in the internet. The Cloud Connector should be installed on a server in the local intranet where the CRM server is located. Follow this detailed tutorial, to install and configure the SAP Cloud Connector:

Now that we have a “bridge” between On Premise system and the Cloud, we can consume it using a HANA Cloud destination.

Step 3: Deploy the HANA Cloud Destination to the Cloud Portal Landscape

We use a HANA Cloud destination to fetch remote applications to the Cloud Portal. A destination is a configuration section (described in a properties file) that is deployed to the HANA Cloud application that uses it (Cloud Portal in this scenario). We define the destination properties as follows:





Name: the name of the destination. In this scenario, we want to enable fetching the application from a public site, therefore we need to add “__public” (two underscores) suffix to the name of the destination, to enable the Cloud Portal to access it.

URL: the URL that the destination points to. In this case this is the Gateway service that exposes CRM transactions.

Type: in this case, it is HTTP since it’s working over HTTP.

Authentication: holds the authentication type that should be used for the application in the URL above. In this scenario this is a public site so no authentication is required.

After we add these lines in the “crm__public” file, we deploy it to the Cloud Portal landscape. This is done using the command line tool that you get as part of the HANA Cloud SDK:

1.          Open command line in “<HANA Cloud SDK folder>/tools”.

2.          Execute the following commands for configuring proxy settings (if you are not behind a proxy you can skip this step):

set HTTP_PROXY_HOST=<your HTTP proxy server hostname>

set HTTP_PROXY_PORT=<your HTTP proxy server port>

set HTTPS_PROXY_HOST=<your HTTPS proxy server hostname>

set HTTPS_PROXY_PORT=<your HTTPS proxy server port>

set HTTP_NON_PROXY_HOSTS=”localhost”

3.          Execute the following command in order to deploy the destination:

neo put-destination –account <your account> –user <your user name> –provider-account <cloud portal’s account> –provider-application <cloud portal’s application name> –localpath <path to destination file> –host

You can get more info about this command in the official documentation here:

Now we have a destination configured, pointing to our CRM back-end. Let’s use it now.

Step 4: Write an HTML Form and Send a Request to CRM

This is the last step. We are using a simple HTML form. The main emphasis in this part is on the URL that the form will request on submit. The URL should be in a special format, to instruct Cloud Portal to send the request using the HANA Cloud destination. The format is as follows: “http://dest.crm__public/sap/opu/odata/sap/ZDEMO_LEAD_SRV/Leads“.

Let’s observe the components of this URL:

http://dest.” is a constant that indicates to the Cloud Portal to use a destination to fetch the data. “crm__public” is the name of the destination to use. “/sap/opu/odata/sap/ZDEMO_LEAD_SRV/Leads” is the path to the Gateway service that exposes the CRM transactions. Every other destination URL in Cloud Portal can be used with the same pattern:


Here is a sample code that we used to send the request:


* Execute ajax request to backend system using makeRequest


function formSubmitAjax() {

          var url = ‘ http://dest.crm__public/sap/opu/odata/sap/ZDEMO_LEAD_SRV/Leads’;

          var postdata = composePostPayloadJSON();

          var params = {};

          var postdataStr = JSON.stringify(postdata);

          params[] = postdataStr;

          params[] =;

          var callback = function ajaxCallback(result) {

                    if (result[‘rc’] === 201) {


                    } else {

                              showFormError(“Could not connect to CRM system.”);



          if (isValidForm()) {

          , callback, params);



This is it! We have a connection to an SAP CRM back-end!

We can now post and get data to and from it.

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Vincenzo Turco

    Hi Tomer, great blog!

    I was wondering whether this same route can be applied to showing on HCPortal a website from the on-premise intranet. For instance: could I create e Url Widget or Opensocial widget and show a url from an on-premise system?

    Thanks a lot


    1. Eliel Schurman

      Hi Vincenzo,

      A URL widget pointing to an intranet on-premise system will not work as the on-prem system is inside the corporate DMZ I guess……and also authentication will not work.

      For presenting on-premise content, you should use cloud connector (it will also do the magic with SSO authentication) and create a simple open social widget (spec xml) in cloud portal that points to the url in the on-prem system.

      You can use the ESPM dev guide example – that describes backend connectivity.

      And also additional example in cloud portal development tutorial –

      for more details including open social capabilities see cloud portal development guide –



  2. carlos cavero


    Ones question . Is it necesary to  have one gateway and cloud connector for connecting sap erp to fiori cloud edition?

    thanks for your help


Leave a Reply