41
8/11/2019 CD166_exercise.pdf http://slidepdf.com/reader/full/cd166exercisepdf 1/41

CD166_exercise.pdf

Embed Size (px)

Citation preview

Page 1: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 1/41

Page 2: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 2/41

Page 3: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 3/41

 

BEFORE YOU START

SAP HANA Cloud Platform is the platform-as-a-service offering by SAP that enables SAP partners andcustomers to deploy and use Java EE and HANA XS applications in a cloud environment. In this hands-onsession, you will learn how you can use the SAP HANA Cloud connectivity service to integrate a Java cloudapplication with an on-premise backend system. To take advantage from the cloud benefits like low TCO,

high flexibility, fast development cycles, etc., companies are more and more interested in using the cloud. Atthe same time, they want to safeguard their investments in their existing heterogeneous on-premise ITlandscape, and so they are looking for ways how to smoothly migrate and transform their businesses into thecloud. It is therefore a common scenario to develop an application in the cloud which extends a legacysystem running on-premise.

In this Hands-on session, you will learn how to develop an on-demand Java application which uses servicesvia HTTP and RFC running in an on-premise network. This is done using the SAP HANA Cloud connectivityservice and the SAP HANA Cloud connector.

 As scenario, a Web Shop application is used which allows end users to browse through a product catalogand to buy products. The Web Shop application retrieves its product catalog from an ABAP system runninglocally on the TechEd training laptops which simulate isolated on-premise networks. In this session, you will

setup the SAP HANA Cloud connector on your TechEd laptop, configure it and configure the Web Shopapplication in the cloud appropriately so that the access of the ABAP system works end-to-end.

The following image shows the overall landscape relevant for the scenario:

The picture shows the SAP HANA Cloud Platform at the top, and the on-premise landscape – simulated byyour TechEd laptop - at the bottom. Both landscapes are isolated networks, protected by firewalls and DMZs,i.e. not directly accessible from outside. On the cloud side, the Web Shop application is deployed andconfigured. It reads data from an ABAP 7.40 system in a RESTful way via the built-in SAP NetWeaverGateway component. The technical connectivity between the on-premise system (i.e. laptop) and the cloud

Page 4: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 4/41

 

4

application is established by the SAP HANA Cloud connector, which is running on the laptop as on-premiseagent and establishes a secure SSL VPN connection to your specific cloud account.

The Hands-on session will guide you through 5 exercises. We strongly recommend going through theexercises in the given order to make sure that you will reach the final step – running the Web Shopapplication successfully - without issues.

Exercise 1: Creating developer account and deploying applicationRegister with the SAP ID service and create a free SAP HANA Cloud Platform developer account. Deploythe prepared Web Shop application into your account and run it in a browser.

Exercise 2: Configuring destinations of the cloud applicationConfigure the destinations needed by the Web Shop application to communicate with the ABAP on-premisebackend, using the SAP HANA Cloud Platform Customer Cockpit.

Exercise 3: Using connectivity service API in the applicationComplement the application code relevant for connectivity by adding prepared code snippets.

Exercise 4: Installing and configuring the SAP HANA Cloud Connector

Download the SAP HANA Cloud Connector (shortly, SCC) from the SAP HANA Cloud Update Site, install iton your TechEd laptop and configure it to connect to your cloud account. Configure the ABAP services whichshall be accessible for the Web Shop application.

Exercise 5: Using Java Connector and RFC protocol to access the ABAP systemExtend the Web Shop application with data coming from the ABAP backend by calling a remote enabled ABAP function module directly using JCo.

Page 5: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 5/41

 

1 CREATING DEVELOPER ACCOUNT AND DEPLOYING APPLICATION

Estimated time: 15 min

Objective 

Goal of this exercise is to prepare the environment needed for the further steps of the Hands-on session. Asfirst step, you will register for a free developer account on the SAP HANA Cloud trial landscape. As secondstep, you will deploy the already prepared Web Shop application into the newly created developer account.

In the overall scenario picture, this exercise will address following parts of the cloud landscape highlighted inred:

What you will learn

  how to register for a free developer account

  how to deploy and run applications in your account

  how to use the Cloud Cockpit to manage your account

Exercise description 

  In Exercise 1.1 you will create a free developer account.

  In Exercise 1.2 you will deploy the prepared Web Shop application to your cloud account and run the applicationin its initial state in the cloud.

Page 6: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 6/41

 

6

1.1 Creating a free developer account

 As first step, you need to get a free developer account on the HANA Cloud trial landscape that will be used inthe subsequent exercises. The account is the top-level entity on the SAP HANA Cloud Platform that isrequired to deploy, configure and administrate applications, account users, services, and alike. A freedeveloper account has restrictions, like a quota limit of one application that can be started at a time ormissing service-level-agreements (SLAs), and is thus not meant for productive usage.

To create an account on HCP, you need to have a user registered at the SAP ID Service. The SAP IDService is the identity provider used by SAP’s on-demand services and platforms, like SAP DeveloperNetwork, Business ByDesign, HANA Cloud Platform and others. Depending on whether you already have auser registered in the SAP ID Service or not, you need to go through one of the following two cases.

Case 1: You have a user registered in SAP ID Service (e.g. SDN user exists)

Explanation  Screenshot 

Openhttps://account.hanatrial.ondemand.com/cockpit in a browser.

This brings up the login screen shownin the screenshot. Enter your SAP IDService user and password and clickLog On.

 After successful logon, you need toaccept a Legal Disclaimer for the firsttime when accessing the HANA CloudPlatform. Click the checkbox and thenthe Accept button.

Page 7: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 7/41

 

Explanation  Screenshot 

On the next screen, select thedatabase which you want to use for thenewly created account.

This step is only temporarily neededand will be removed in the future.

Select SAP HANA Database and clickContinue.

You get now to the Cloud Cockpit.

The Cloud Cockpit is the centraladministration UI for your account.

Case 2: You don’t have a user registered at SAP ID ServiceTo register a new SAP ID user, you require access to an email account (e.g. of a public email provider ofyour choice, like gmail, gmx, etc.). If this is the case, please continue with the screenshots in the table below.If this is not the case, we have prepared a set of developer accounts, which you can use for the further

exercise. Please contact your trainer to get the details of a prepared developer account and skip the rest ofthe steps below.

Explanation  Screenshot 

Openhttps://account.hana.ondemand.com

in a browser and click the Register  button.

Page 8: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 8/41

 

8

Explanation  Screenshot 

Fill out the Registration form in theupcoming popup. After finishing theregistration, an email is sent to yourprovided email account, which includesan activation link. Click the link in theemail to activate your user.

On the next screen, you have to selectthe database, which is used for thenewly created account.

This step is only temporarily neededand will be removed in the future.

Select SAP HANA Database and clickContinue.

You get now to the Cloud Cockpit.

The Cloud Cockpit is the centraladministration tool for your HCPaccount.

The account name is displayed underAccount in the upper left-side area ofthe user interface, and the user ID isvisible in the header. In the screenshot,the account name is“p1940079614trial”, and user name is“p1940079614”. Note down theaccount and user name somewhere asthey will be needed in the next step

again.

You have now created a free developer account on SAP HANA Cloud Platform. In the future, you canadministrate your account using the Cloud Cockpit by URL https://account.hanatrial.ondemand.com/cockpit. 

Page 9: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 9/41

Page 10: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 10/41

 

10

Explanation  Screenshot 

Click the Run As > Run on Servermenu item.

Select the Manually define a newserver  radio button.

In the server type tree, select SAP >SAP HANA Cloud.

Verify that hanatrial.ondemand.comis entered as Server's host name: Itspecifies that the HANA Cloud triallandscape should be used for thedeployment.

Click the Next button.

Page 11: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 11/41

 

11 

Explanation  Screenshot 

Fill out the fields as shown in thescreenshot, using your developeraccount name and your SAP ID userID.

Application name: webshopAccount name: <name-of-account>User name: <your-user-name>Password: <your-user-password>

Click Next button to start thedeployment. 

Click Finish.

This will start the deployment of theapplication which will take 1 to 2minutes to complete.

Page 12: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 12/41

 

12

Explanation  Screenshot 

 After successful deployment, theapplication is started in the embeddedEclipse browser. At this stage, theapplication does not show any productdata, but displays the message Anerror occured during retrieval ofdata: HTTP request failed in theapplication message area.

Reason for this is that the requiredbackend connectivity for theapplication is not yet configured. Thiswill be subject of the subsequentexercises.

 As last step, use the Cloud Cockpit toverify that the application is deployed.

Open the Cloud Cockpit viahttps://account.hanatrial.ondemand.com/cockpit. 

Click on Applications in the navigationarea on the left hand-side and verifythat the webshop application is visiblein the list of applications in stateSTARTED.

Summary

 After this exercise, you have created a developer account and deployed the Web Shop application into thisaccount in the cloud. You have also gathered first hands-on experience with the Cloud Cockpit used toadministrate your account and applications.

If you want to learn more about the HANA Cloud Platform, its account types, the deployment of applications,or the Cloud Cockpit have a look at following online resources:[1] Product Overview [2] Getting an Account [3] Signing up for a Developer Account [4]  Account Types 

[5] Deploying Applications [6] Cloud Cockpit 

Page 13: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 13/41

 

13 

2 CONFIGURING DESTINATIONS OF THE CLOUD APPLICATION

Estimated time: 10 min 

Objective 

Goal of this exercise is to configure the connection details needed by the Web Shop application in the cloud.Connections are configured on the HANA Cloud Platform using so-called destinations. A destinationrepresents the configuration of the targeted backend service, i.e. in case of HTTP protocol it consists forinstance of a URL, authentication credentials for the backend and other related data.

You have multiple options to configure a destination. You can do this via the neo command line tool (link), viaEclipse (link), or via the Destination Editor in the Cloud Cockpit (link). We will use the Cloud Cockpit in thisexercise.

Looking at our overall landscape picture, you will now work on the following cloud parts highlighted in red:

 As shown in the image, the Web Shop application uses destinations for the remote communication with thebackend services and the destination configuration is stored transparently for the user in a database.

What you will learn 

  how to use the Destination Editor UI in the Cloud Cockpit

  how to configure an HTTP destination

Exercise description 

  In Exercise 2.1 you will use the Cloud Cockpit and its Destination Editor to configure an HTTP destination.

Page 14: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 14/41

 

14

2.1 Configuring destinations with the Destination Editor

In this exercise, you will use the Cloud Cockpit and its Destination Editor to configure two destinationsneeded by the Web Shop application.

Explanation  Screenshot 

Open Cloud Cockpit:https://account.hanatrial.ondemand.com/cockpit. 

Select Applications in thenavigation area on the left side.

From the list of applications selectthe webshop application.

This will drill down into theapplication view for the Web Shopapplication.

Select Destinations in thenavigation area.

This will open the DestinationEditor  for the webshop application.

In the Destination Editor , click theNew Destination button and choseImport from File in the submenu.

In the upcoming file browser, selectD:\Files\Session\CD166\resources\destination\abapbackend.

The abapbackend destination isnow being imported.

Page 15: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 15/41

 

15 

Explanation  Screenshot 

Once the imported destinationproperties are displayed in theDestination Editor, click the Savebutton.

This stores the imported destinationtransparently in a database.

Note: Once an application has reada destination, it stores thedestination in a runtime cache withan expiration time of 5 minutes.When you change the destinationconfiguration afterwards again e.g.using the Destination Editor, it takesup to 5 minutes until the changesbecome effective.

Let’s have a closer look into the destination configuration: it shows an example of an HTTP serviceconfiguration and consists of

  an application-wide unique destination name, in this case abapbackend, which identifies thedestination at runtime.

  a type, specifying the protocol to be used, in this case HTTP is used as protocol.

  the URL to the targeted remote service. In this example, the URL points to a SAP NetWeaverGateway service. Note that espm:50000 is used as host and port. You will find this host and portagain later on, when we configure the backend service in the SAP HANA Cloud connector.

  authentication properties needed for the authentication against the backend. In this example,BasicAuthentication  is used with service user EPM_TEST.

Repeat the destination import steps with abapbackendimages. The second destination is located underD:\Files\Session\CD166\resources\destination\abapbackendimages .

Summary 

In this exercise, you have configured two destinations needed by the Web Shop application. By this, the WebShop application "knows" the connection details of the targeted backend services. If you refresh the WebShop application in the browser, you will notice that there is still no product data shown in the UI and themessage An error occured during retrieval of data: HTTP request failed is still displayed. One reason forthis is that the application coding related to connectivity is not yet complete. In the next step, we will thereforecomplement the application code.

If you want to learn more about destinations and its configuration have a look at following online resources:[1] Using Destinations [2] HTTP Destinations 

Page 16: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 16/41

 

16

3 USING CONNECTIVITY SERVICE API IN THE APPLICATION

Estimated time: 10 min 

Objective 

Goal of this exercise is to complete the Web Shop application with coding snippets related to connectivity.This includes the usage of the destination API and the destination declaration as a JNDI resource of the Webapplication. After this step, the application is fully prepared for final usage on the cloud side.

What you will learn

  how to declare a destination as a JNDI resource in the Web application

  how to use the destination API in a Web application

  how to redeploy the changed application to the cloud

Exercise description 

  In Exercise 3.1 you will configure the destination factory as a JNDI resource.

  In Exercise 3.2 you will add a coding snippet to the application that demonstrates the usage of the destination API.

  In Exercise 3.3 you will redeploy the changed application to the cloud.

Page 17: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 17/41

 

17 

3.1 Configuring destination as JNDI resource

In Java EE applications, resources that are used in a Web application are deployed externally to the Webapplication. To use external resources in the Web application, you resolve the JNDI resource name thatthe application uses with the global JNDI resource name using the web.xml  deployment descriptor.

HTTP destinations are such kind of external resources, which need to be declared in the web.xml  of aWeb application in order to access them from the global JDNI resources. This is done in the followingsteps.

Explanation  Screenshot 

In the Eclipse Project Explorer ,navigate intoespm-ui-shopping-web > src > main

> webapp > WEB-INF folder anddouble-click the web.xml file to open itin the editor.

Page 18: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 18/41

 

18

Explanation  Screenshot 

In the we.xml editor, navigate to theSource tab and search for the string"CD166". This brings you to acommented code block.

Remove the comments <!-- and -->, sothat the following declaration becomesactive:

<resource-ref> <res-ref-name>

connectivity/DestinationFactory</res-ref-name>  <res-type>

com.sap.core.connectivity.api.

DestinationFactory</res-type> 

</resource-ref> 

It declares that the Web applicationneeds the resourceconnectivity/DestinationFactory of typecom.sap.core.connectivity.api.DestinationFactory from the global JNDI tree.

Save the changes made in the web.xmlfile by clicking the Disk icon.

Page 19: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 19/41

Page 20: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 20/41

 

20

Explanation  Screenshot 

In the Java Editor, search for string"CD166" which brings you to themethod

getDestination(String)  which

contains a commented code block.

Comment out the return null;statement and remove thecomments in the code block below.

Note: The code block shows how the

DestinationFactory  class is

looked up in the JNDI registry andhow it is used to retrieve a nameddestination.

Open the context menu and clickSource > Organize Imports.

Double click on the entry

 javax.naming.Context to select it.

 Afterwards, save the changes in thecoding by clicking the Disk icon.

Page 21: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 21/41

 

21 

3.3 Redeploying application changes

 After you have changed the application coding, you need to redeploy the application to your developeraccount.

Explanation  Screenshot 

Go to the Eclipse Servers view andselect the server adapter of thewebshop application.

Click the Republish button to re-deploy the application. This willagain take 1 or 2 minutes tocomplete.

Summary 

You have now added the missing coding to the Web Shop application which takes care of the remote callsfrom the application to the backend. You also deployed the changed application again to the cloud. Fromcloud perspective, the application is now fully set up and ready for final usage.

However, when you refresh the application in the browser, it still does not show any data in the UI. Thereason for this is that it has no physical connection yet to the ABAP system. We will fix this in the nextexercise by establishing the connection to the backend using the SAP HANA Cloud connector.

If you want to learn more about how to use the destination API, have a look at following resources:[1] Exchanging Data via HTTP Protocol [2] Connectivity Service API 

Page 22: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 22/41

 

22

4 INSTALLING AND CONFIGURING THE SAP HANA CLOUD CONNECTOR

Estimated time: 25 min 

Objective 

Goal of this exercise is to install the SAP HANA Cloud connector (shortly, SCC) as on-premise agent on yourTechEd laptop. The SCC is used to establish a secure SSL VPN connection to your developer account in thecloud and is the recommended approach for point-to-point connections between SAP HANA Cloud Platformapplications and on-premise systems.

The TechEd laptop hosts a local ABAP system, which is used as backend for the Web Shop application. Itprovides services to read a product catalog and to drill down into product details. Besides this, it providesimages for each of the products.

For the purpose of this training the laptop thus simulates a complete, isolated on-premise network. Ofcourse, the backend systems and the SCC will usually run on different machines. Looking at the overall

landscape picture, we are now addressing following parts high-lighted in red:

What you will learn

  how to install the SCC

  how to connect the SCC against your developer account

  how to configure the SCC so that it allows access to the required backend services

  how to configure the SCC so that it authenticates itself via a X.509 client certificate against the ABAP backend

Page 23: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 23/41

 

23 

Exercise description 

  In Exercise 4.1 you will install the SCC on your TechEd laptop.

  In Exercise 4.2 you will connect the SCC against your developer account.

  In Exercise 4.3 you will configure the backend services in the SCC.

  In Exercise 4.4 you will upload the system certificate to the SCC.  In Exercise 4.5 you will test the Web Shop application in its final stage.

Page 24: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 24/41

 

24

4.1 Installing the SAP HANA Cloud Connector

You will now install the SAP HANA Cloud connector (SCC) on your TechEd laptop.

Download the SCC Windows installer from https://tools.hana.ondemand.com/#cloud . Choose the latest

version of the sapcc-2.1.x-windows-x64.msi  file available on the Cloud Tools page

Note: In case the Internet connection at the TechEd venue turns out to be weak, you can also download thelatest version of the SCC from the Student share \\TEfile.fair.sap.corp\Studentshare\CD166\scc. 

During installation you get asked for

  the installation directory. Choose D:\Files\Session\CD166\sccas directory.

  the port used by the SCC Administration UI. Change the suggested default port to 9443, as port8443 is already used by the local ABAP system on the TechEd laptops.

 After installation, open the SCC Administration UI with URL https://localhost:9443 in a browser which willbring up the SCC logon screen.

Page 25: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 25/41

 

25 

4.2 Connecting the SAP HANA Cloud Connector to an account

The next step is to go through the initial configuration steps of the freshly installed SCC. This consists of thefirst logon, changing the initial password, and connecting the SCC to a cloud account.

Explanation  Screenshot 

Logon to the SCC Administration UI with userAdministrator and initial password manage. 

 After the first logon, the SCC UI guides youthrough two mandatory steps, first to changethe inital password, and second to connectyour SCC to your SAP HANA Cloud Platformaccount.

Change initial password to abcd1234 oranother password you can easily rememberfor the duration of this Hands-on session.

Click the Save button.

In the Set Up Initial Configuration view,enter:

Landscape Host: hanatrial.ondemand.com   Account Name: <name-of-account>User Name: <your-user-name>Password: <your-password>

 As HTTPS Proxy settings, enter:Host: proxyPort: 8080

Click Apply.

You should now be directed to the Home tabof the SCC Administration UI, and theConnector State should be connected. Thismeans an SSL VPN tunnel to your cloudaccount has been established and you arenow able to make calls from applicationsrunning in your account through this tunnel.

Under the Overview group, you can see youraccount name, next to some otherinformation.

Page 26: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 26/41

 

26

4.3 Configuring access control

Now that the SCC is connected to your account, the next step is to configure the resources/services whichshall be made accessible to the applications in your account. Each resource that shall be accessible forapplications in your account must be explicitly configured in a whitelist, as the default behavior of the SCC isto block all requests to any services which are not defined as accessible resources.

Explanation  Screenshot 

To configure accessible resources, navigateto the Access Control tab in the SCC Administration UI.

 As first step, define the system which hoststhe service you like to make accessible: Onthe Resources tab, click the Add button onthe menu bar of the Mapping Virtual ToInternal System group.

Enter following values in the Add System

Mapping popup:Virtual Host: espm Virtual Port: 50000 Internal Host: localhost Internal Port: 8443 Protocol: HTTPS Backend Type: SAP NetWeaver Gateway 

Note: This configuration defines that thelocalhost on port 8443 can be accessed bythe cloud account under the virtual host andport espm:50000. Remember that this wasthe host and port used in the destination

URLs which we had configured before.

Click Save.

Select the table row with the newly createdsystem mapping. This brings up a detailsview in which you can define the resources(a.k.a. services in case of HTTP), which shallbe used on the related system.

Click Add in the Resources Accessible Onlocalhost:8443 view.

Page 27: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 27/41

 

27 

Explanation  Screenshot 

Enter the following values in the AddResource popup window:

URL Path: /sap/opu/odata/sap/Z_TUT_ESPM_DEVELOPER_SCENARIO_SRV  Access Policy: Path and all subpaths 

Click Save.

Note: The resource paths are case sensitive!

 Add another resource with the following

values:

URL Path: /SAP/PUBLIC/BC/NWDEMO_MODEL/IMAGES  Access Policy: Path and all subpaths 

Click Save.

The Access Control view should now look asshown in the screenshot. You have nowconfigured the services which are needed bythe Web Shop application.

You can now optionally click the Checkbutton to test whether the specified systemcan be accessed by the SCC.This should be the case, i.e. the State field ofthe specified system should turn into a greenlight.

Note that the SCC must be able to directlyaccess the specified systems, i.e. the usageof a proxy between SCC and a configuredsystem is currently not supported.

Page 28: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 28/41

 

28

4.4 Configuring a system certificate

 As final step of the SCC configuration, you will now upload the so-called System Certificate to the SCC. TheSystem Certificate is a X.509 client certificate used for the authentication of the SCC towards the backendsystems. The backend systems need to be prepared accordingly to trust the used client certificate. This trustrelationship has already been configured in the local ABAP system.

Explanation  Screenshot 

In the SCC Administration UI, open theSettings dialog in the top-level menu bar.The Settings popup window comes up inwhich you can define general settings of theSCC, like the connection configuration, the Administrator password, configuration of alocal LDAP for authenticating named users,and others.

In the Settings dialog, you can also uploadthe System Certificate.

Go into the System Certificate tab and clickBrowse.

Select the fileD:\Files\Session\CD166\resources\backend_cfg\scc_teched2013.p12in the file browser. This is a PKCS#12 filecontaining the key pair used as SystemCertificate.

In the Password field type in abcd as

encryption password for the PKCS#12 file.

Click Apply. This should upload the specifiedcertificate as system certificate to the SCC.

 Afterwards, click Close to close the Settingspopup.

On the Home tab of the SCC AdministrationUI, you should now see in the Overview 

group the information that a SystemCertificate has been configured.

Note that the UI also checks if the certificateis still valid. Once it expires it will show awarning sign.

Page 29: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 29/41

 

29 

4.5 Testing the application

 After you established a secure SSL connection from your laptop to the cloud, configured the backendservices which are needed by the Web Shop application and the system certificate for authentication, it isnow time to test the application.

Explanation  Screenshot 

Refresh the application in a browser. Itshould now come up with product datadisplayed as shown in the screenshot.

Select one of the products, like Tablets.This should drill into the product catalog ofthe selected product category.

In the product list, select one product andclick Details to drill into the product details.

Page 30: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 30/41

 

30

Explanation  Screenshot 

The Details view should come up and showa product image, loaded from the backend,and more product details.

You can now also play around with yourSCC: E.g. disconnect the SCC from youraccount using the Disconnect button onthe Home tab. If you then refresh thewebshop application again in your browser,the data is again not visible. If you re-connect the SCC by clicking the Connect button on the Home tab, the data appearsagain after a browser refresh of theapplication.

Summary 

Congratulations! You have now successfully installed and configured the SAP HANA Cloud connector andused two backend services in your Web Shop application to read a product catalog and product details.

 All pieces of the overall landscape picture are now set up and working:

Let’s recapture the steps of an administrator who has to deploy and configure an application which requireson-premise backend connectivity:

Page 31: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 31/41

 

31 

1. You deploy the application into your account.2. You configure the destinations of the application using the Cloud Cockpit.3. You install the SAP HANA Cloud connector and connect it to your cloud account as a one-time task.4. You configure the backend services in the SAP HANA Cloud connector which are needed by the application. This

might comprise the configuration of trust relationships using X.509 certificates, i.e. configuration of a systemcertificate in the Cloud Connector, and establishing trust to this certificate in the backend.

5. You test the application and its data access.

If you want to learn more about the SAP HANA Cloud Connector, have a look at following online resource:[1] Using the Cloud Connector  

More details on SAP NetWeaver Gateway, as well as on how to configure trust in the ABAP system with aclient can be found here:[2] SAP NetWeaver Gateway 2.0 [3] Configuring the AS ABAP to Use X.509 Client Certificates 

Page 32: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 32/41

 

32

5 USING JAVA CONNECTOR AND RFC TO ACCESS THE ABAP SYSTEM

Estimated time: 15 min 

Objective 

Goal of this exercise is to show an alternative approach how an on-premise ABAP system can be accessedfrom your cloud application. Until now, HTTP has been used as protocol for the communication between theWeb Shop application and the backend, and the SAP NetWeaver Gateway component was used on the ABAP 7.40 system to provide RESTful services on top of the ABAP functions.

Now we will use RFC as protocol and Java Connector (JCo) as Java API in the Web Shop application inorder to call some BAPIs from the ABAP system directly. Calling the ABAP system directly makes sensewhen no application proxies like SAP NetWeaver Gateway or Enterprise Services are available or shall beused due to performance reasons. Besides this, the access via JCo and RFC works for any ABAP systemrelease in a uniform manner.

The Connectivity Service tunnels the RFC call from the application to the SAP HANA Cloud connector viathe SSL tunnel, i.e. via an encrypted channel. From the SCC to the backend, the user has the option to useRFC or RFC with SNC (Secure Network Communication) being turned on.

What you will learn

  how to configure an RFC destination for a cloud application

  how to use the JCo API in the cloud application and that this is the well-known approach as for JCo standalone3.0

  how to configure a function module in the SAP HANA Cloud connector

Exercise description 

  In Exercise 5.1 you will configure an RFC destination needed by the Web Shop application using the ConnectivityEditor.

  In Exercise 5.2 you will use the JCo API in the Web Shop application to make a call to an ABAP function module.

  In Exercise 5.3 you will configure the needed function module in the SCC.

  In Exercise 5.4 you will test the extended application.

Page 33: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 33/41

 

33 

5.1 Configuring an RFC destination

In this exercise, you will use the Cloud Cockpit and its Destination Editor to configure an RFC destinationneeded by the Web Shop application.

Explanation  Screenshot 

Open again the Cloud Cockpit viahttps://account.hanatrial.ondemand.com/cockpit 

Drill down into the webshop application.

Click Destinations to open the Destination

Editor .

Click New Destination > Import from File. 

Select the RFC destination fromD:\Files\Session\CD166\resources\destinations\abapjcoDestination .

Click Open.

Page 34: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 34/41

 

34

Explanation  Screenshot 

The imported RFC destination is nowdisplayed in the Destination Editor.

Click Save to store the destination.

Page 35: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 35/41

 

35 

5.2 Using JCo to call an ABAP function module

In this step, you will add coding in the Web Shop application that demonstrates how to use the JCo API. Ingeneral, the JCo API in the cloud is the same as the well-known JCo 7.x API from NetWeaver AS Java orfrom JCo 3.0 standalone. Using it does not feel different.

Explanation  Screenshot 

In the Eclipse Project Explorer , navigateintoespm-ui-shopping-web > src > main > java > com > sap > teched > connectivity> jcoand double-click JCoServlet.java.

This will open the class in the Java Editor.

In the Java Editor, search for string“CD166”, which will bring you to the codingshown in the screenshot.

Comment out the throw newJCoException…; statement.

Remove the comments from the code blockbelow. This code block makes use of theJCo API.

 After the change, the method should look as

shown in the screenshot.

Save the code changes by clicking the Diskicon.

Redeploy the webshop application to thecloud: Go again into the Eclipse Servers view and click the republish button.

Page 36: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 36/41

 

36

5.3 Configuring an ABAP function module in SAP HANA Cloud Connector

 As for HTTP services, each ABAP function module that should be made accessible to your cloud accountmust be configured in the SCC. Function modules not listed in the resources for a system cannot be invoked.In this exercise, we do this for the function module needed by the Web Shop application.

Explanation  Screenshot 

To configure accessible resources, navigateto the Access Control tab in the SCC Administration UI.

 As first step, define the system which hoststhe function module you like to makeaccessible: On the Resources tab, click theAdd button on the menu bar of the MappingVirtual To Internal System group.

Enter following values in the Add SystemMapping popup:Virtual Host: espm_appserverVirtual Port: sapgw23 Internal Host: localhost Internal Port: sapgw00 Protocol: RFC Backend Type: ABAP System 

Note: This configuration defines that the ABAP application server on localhost withservice sapgw00 can be accessed by thecloud account under the virtual host and portespm_appserver with servicesapgw23. Remember that these were the jco.client.ashost and jco.client.sysnrproperties used in the RFC destination, whichwe had configured before (sapgw23 maps tosystem number 23).

Click Save.

Select the table row with the newly createdsystem mapping. This brings up a detailsview in which you can define the resources(a.k.a. function module in case of RFC),which shall be used on the related system.

Page 37: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 37/41

 

37 

Explanation  Screenshot 

Click Add in the Resources Accessible Onlocalhost:8443 view.

Enter the following values in the AddResource popup window:Function Name: ZSEPM_TOPSELLER_GET Naming Policy: Exact Name 

Click Save. 

Page 38: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 38/41

 

38

Explanation  Screenshot 

The Access Control view should now look asshown in the screenshot. You have nowconfigured the services which are needed bythe Web Shop application.

Page 39: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 39/41

 

39 

5.4 Testing the application

The application is now set up to use the ABAP function module. Next step is to test the Web Shopapplication again.

Go into your browser and refresh the application. Navigate to the Top 5 Selling Products tab. It shouldshow a table with the 5 top selling products. The underlying data is retrieved from the used ABAP functionmodule.

Summary

You have now learned how to use an on-premise ABAP function module directly from a cloud application.

If you want to learn more about usage of JCo and RFC in the SAP HANA Cloud Platform, have a look atfollowing online resources:[1] Invoking ABAP function modules via RFC protocol [2] SAP Java Connector (Standalone Version)

Page 40: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 40/41

 

40

6 SUMMARY AND FURTHER INFORMATION

In this Hands-on session you have practiced the usage of the SAP HANA Cloud connectivity service tointegrate an on-demand Web Shop application with an on-premise ABAP system. This is a typical scenariowhich shows how companies can use the cloud to build extensions on top of their existing heterogeneouson-premise IT landscape and integrate them via point-to-point connections.

The used Web Shop application is documented as a SAP HANA Cloud Platform reference application inSDN:[1] http://wiki.sdn.sap.com/wiki/display/EmTech/Developers+Scenarios+using+SAP+HANA+Cloud [2] http://scn.sap.com/docs/DOC-41491 You can also try it out at home.

Page 41: CD166_exercise.pdf

8/11/2019 CD166_exercise.pdf

http://slidepdf.com/reader/full/cd166exercisepdf 41/41

 

COPYRIGHT

© 2013 by SAP AG or an SAP affiliate company. All rights reserved. No part of this publication may bereproduced or transmitted in any form or for any purpose without the express permission of SAP AG. Theinformation contained herein may be changed without prior notice. Some software products marketed bySAP AG and its distributors contain proprietary software components of other software vendors. National

product specifications may vary. These materials are provided by SAP AG and its affiliated companies(“SAP Group”) for informational purposes  only, without representation or warranty of any kind, and SAPGroup shall not be liable for errors or omissions with respect to the materials. The only warranties for SAPGroup products and services are those that are set forth in the express warranty statements accompanyingsuch products and services, if any. Nothing herein should be construed as constituting an additionalwarranty. SAP and other SAP products and services mentioned herein as well as their respective logos aretrademarks or registered trademarks of SAP AG in Germany and other countries. Please seehttp://www.sap.com/corporate-en/legal/copyright/index.epx#trademark  for additional trademark informationand notices.