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:
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>
3. Execute the following command in order to deploy the destination:
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: