Build with SAP HANA, express edition and deploy to cloud

A Getting Started Guide

Learn how to develop applications with SAP HANA, express edition and deploy them to the cloud.

www..com

TABLE OF CONTENTS

INTRODUCTION ...... 3 PREREQUISITES ...... 4 SAMPLE MULTI-TARGET APPLICATION ...... 6 GLOSSARY OF TERMS ...... 14

© 2016 SAP SE or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. Please see http://www.sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices. Some software products marketed by SAP SE and its distributors contain components of other software vendors. National product specifications may vary. These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions.

Build with SAP HANA, express edition and deploy to cloud

INTRODUCTION

This technical documentation is a step-by-step guide on how to get started with building an application in SAP HANA, express edition and deploying it to the cloud. The purpose of this guide is to provide an example of this “developing in SAP HANA, express edition and deploying to cloud” workflow – a multi-target application in Java, node.js, HANA DB and SAPUI5. The assumption here is that the user has already installed SAP HANA, express edition and has an active instance running, along with SAP Web IDE for SAP HANA ready for development. If you do not have SAP HANA, express edition installed and running yet, please visit the Prerequisites section of this document. You may also visit the SAP HANA, express edition landing page for instructions and more information: https://www.sap.com/developer/topics/sap-hana-express.html

Please note: For definitions and explanation of terms and abbreviations, please refer to the GLOSSARY at the end of this document

3 Build with SAP HANA, express edition and deploy to cloud

Prerequisites for development in SAP HANA, express edition

4 Build with SAP HANA, express edition and deploy to cloud

PREREQUISITES

Before deep-diving into the examples, here are a set of prerequisite steps you need to have covered, to have SAP HANA, express edition installed and running.

Getting started with installation and setup of SAP HANA, express edition

Follow the 1-2-3 Get Started steps on the SAP HANA, express edition landing page: https://www.sap.com/developer/topics/sap-hana-express.html  Register for SAP HANA, express edition if you have not already done so. You will be directed to a Success Page from where you can download the appropriate Download Manager for your work environment. This Download Manager is a utility that will enable you to download SAP HANA, express edition and install it.  You can install and run SAP HANA, express edition either on-premise or on the cloud.  There are 2 types of on-premise SAP HANA, express edition installation solutions – using a binary installer, or a virtual machine image. To help you decide which one you should choose for on- premise installation, visit this tutorial: https://www.sap.com/developer/how-tos/2016/09/hxe-ua- version.html  Once you have decided on the type of installation that fits your needs, proceed to installing SAP HANA, express edition with your chosen installation method. For each method, there are further configuration and setup steps that need to be followed. Please follow the related tutorial workflow for each on-premise installation method: o Binary installer method: https://www.sap.com/developer/groups/hxe-install-binary.html o Virtual machine image method: https://www.sap.com/developer/groups/hxe-install-vm.html

 Please note, for each installation method, when you open the download manager, you will be given the option to download either a Server Only installer, or a Server + Applications package. To develop with XSA, you will need to install the Server + Applications installer (hxexsa.ova)  Alternatively, you can also launch SAP HANA, express edition on the : https://www.sap.com/developer/groups/hxe-install-gcp.html

 Follow these further instructions to help you prepare for development tutorials on SAP HANA, express edition: https://www.sap.com/developer/how-tos/2016/09/hxe-howto-tutorialprep.html

Getting started with XSA: Basic development

Here are some getting started tutorials to help you get familiar with XSA based development:  Connect to the SAP Web IDE for SAP HANA: https://www.sap.com/developer/tutorials/xsa-connecting- webide.html  Create an HTML5 module: https://www.sap.com/developer/tutorials/xsa-html5-module.html  Create an HDI module: https://www.sap.com/developer/tutorials/xsa-hdi-module.html  Connecting to SAP HANA, express edition with SAP HANA Studio: https://www.sap.com/developer/how- tos/2016/09/hxe-howto-eclipse.html

For more tutorials on XSA, go to the tutorials section of the SAP HANA, express edition landing page: https://www.sap.com/developer/topics/sap-hana-express.tutorials.html

Onboarding with SAP Cloud Platform

This guide shows how you can deploy your SAP HANA, express edition application to SAP Cloud Platform Cloud Foundry. The steps in the guide thus assume that you already have the SAP Cloud Platform Cloud Foundry client interface installed and the necessary tools set up. Please refer to the documentation on SAP Cloud Platform Cloud Foundry for more details: https://docs.cloudfoundry.org/cf-cli/

5 Build with SAP HANA, express edition and deploy to cloud

Sample Multi-Target Application

6 Build with SAP HANA, express edition and deploy to cloud

SAMPLE MULTI-TARGET APPLICATION

This section highlights the process of building a multi-target application based on Java, node.js, SAPUI5 and HANA DB, in SAP HANA, express edition using SAP Web IDE for SAP HANA, and then deploying it both on- premise and on the SAP Cloud Platform Cloud Foundry.

Step 1: Clone the source code from an existing project

Import the source code of an existing MTA project by cloning the repository using git. Right click on your Workspace folder in SAP Web IDE for SAP HANA and select Git  Clone Repository

A popup modal appears, asking for details of the repository to be cloned. Enter the following URL to clone the repository: https://github.com/I809764/smallEx1.git

Wait for the repository to be cloned. Once cloned, it should appear on your workspace.

Note: For additional guidance on cloning git repositories, please refer to this tutorial: SAP HANA XS Advanced, Connecting to SAP Web IDE and cloning a Git Repository to begin development: https://www.sap.com/developer/tutorials/xsa-connecting-webide.html

You should have your repository cloned in your workspace like this:

7 Build with SAP HANA, express edition and deploy to cloud

Note: This cloned project will only work on HANA 2.0 SPS 01. Please check this before building the project in the upcoming steps, to avoid build errors.

Now that the project has been successfully cloned, we will dive into each of the components of the project – the main modules:

 HANA Module: This module contains the database table. The data model is self-contained within the application itself.  Java Module: This module contains a V4 OData service  Node.js Module: This module contains a V2 XSODATA service  Basic HTML5 Module: This module contains the SAPUI5 user interface

Step 2: Build the MTAR

Next, we need to build the project. Before you can do that, you need to define the project space. Right click on the project folder and go to Project Settings.

8 Build with SAP HANA, express edition and deploy to cloud

Under the project settings, go to the Space tab, select a Space for your project (here it is SAP), and then click on Save and then Close.

Now right click again on your project folder and select Build.

When your project has successfully completed the build step, you can see the following log in your console:

9 Build with SAP HANA, express edition and deploy to cloud

Notice that an MTA archive has been created. If you go to your project workspace, you can see the mta_archives folder has been created, which contains the archives for your project.

This step that you just performed is essentially the building of the MTAR for your project before you can deploy the final application either on-premise or in SAP Cloud Platform Cloud Foundry. Download this MTAR file to your local machine, since you will be needing it on your client machine to perform the deployment steps both on-premise and on the SAP Cloud Platform Cloud Foundry target.

You can open the MTAR file you downloaded in WinRAR or a similar application, if you want to see what this file comprises of. This single archive contains all dependent node.js modules and Java libraries. It is self- contained except for build packs and service brokers.

10 Build with SAP HANA, express edition and deploy to cloud

Step 3: Deploy to XSA On-Premise

1. Log in to the system via the XS CLI tool on your local command prompt. If you are using Mac OS, use the terminal shell.

Note: Make sure that you are in the same directory as the one where you saved the MTAR file.

2. Use the xs deploy command to install the MTAR

xs deploy smallEx1_0.0.3.mtar --use-namespaces

Note: Make sure that you are deploying the same MTAR file as the one you have downloaded from SAP Web IDE for SAP HANA

3. Via this one step, the database services are provisioned, the HDI container and contents are deployed to HANA, the User Authentication service is created, and the Node.js/Java/Web services are created and started.

11 Build with SAP HANA, express edition and deploy to cloud

Your application is now ready to use.

Step 4: Deploy to Cloud Platform

1. Ensure that you already have SAP Cloud Platform Cloud Foundry set up.  Make sure the SAP Cloud Platform Cloud Foundry command line interface (CLI) tool is installed and working.  Ensure that MTA support is added to the standard SAP Cloud Platform Cloud Foundry Client. You will need this to deploy the MTA.

The SAP Cloud Platform Cloud Foundry CLI and MTA plugin are available here under the Getting Started with SAP Cloud Platform Cloud Foundry Environment and SAP Cloud Platform Cloud Foundry CLI Plugins sections: https://tools.hana.ondemand.com/#cloud

Note: Please refer to the documentation for SAP Cloud Platform Cloud Foundry for more details on the entire setup process: https://docs.cloudfoundry.org/cf-cli/

2. Log in to the system via the CF command line interface tool.

Please note: The API endpoint URL (here: https://api.cf.sap.hana.ondemand.com) is different for different users depending on their respective chosen regions during the SAP Cloud Platform Cloud Foundry onboarding process. For information on how to obtain your unique user API endpoint URL, please refer to the SAP Cloud Platform Cloud Foundry documentation: https://docs.cloudfoundry.org/cf-cli/

12 Build with SAP HANA, express edition and deploy to cloud

3. Use the cf deploy command to install the MTAR

cf deploy smallEx1_0.0.3.mtar --use-namespaces

Note: As with the on-premise deployment, make sure that you are deploying the same MTAR file as the one downloaded from SAP Web IDE for SAP HANA

4. Via this one step, the database services are provisioned, the HDI container and contents are deployed to HANA, the User Authentication service is created, and the Node.js/Java/Web services are created and started

Your application is now ready to use

13 Build with SAP HANA, express edition and deploy to cloud

Glossary of Terms

14 Build with SAP HANA, express edition and deploy to cloud

CF: SAP Cloud Platform Cloud Foundry

HDI: The SAP HANA Deployment Infrastructure (HDI) is a service layer of the HANA database that simplifies the deployment of HANA database artifacts by providing a declarative approach for defining database objects.

HXE: SAP HANA, express edition

MTA: Multi-target application mtaext: File extension used for extension descriptors

MTAR: Build file for multi-target applications (MTAs)

SAP Web IDE: SAP Web IDE is a powerful, extensible, web-based integrated development tool that simplifies end-to-end application development

SAPUI5: UI development toolkit for HTML5

XSA: SAP HANA XS Advanced. It is a completely re-engineered for native development of applications in SAP HANA environment which is available with SP11. It supersedes SAP HANA XS and provides significant improvements and advantages compared with its predecessor. SAP HANA XSA brings dramatic improvements in terms of architecture with microservices.

XSODATA: OData (Open Data protocol) file in SAP HANA

15