CREATING DATABASE OBJECTS IN SAP HANA CLOUD WITH

Transcription

CREATING DATABASE OBJECTSIN SAP HANA CLOUD WITHSAP BUSINESS APPLICATION STUDIOSESSION #1: How to set up an environment anddefine data structures

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioGET STARTEDWelcome to the Digital Hands-on Workshop Series on SAP HANA Cloud! We’re excited to offer you a detailed,hands-on introduction into your SAP HANA Cloud!WELCOME!2PRE-REQUISITES FOR SESSION #1:3ADDITIONAL RESOURCES4PREPARATION: PROVISIONING5TOOLS TO WORK WITH YOUR SAP HANA CLOUD, HANA DATABASE7SET UP YOUR ENVIRON MENT IN SA P BUSINESS APPLICATION STUDIOAND GITHUB9ACCESSING SAP BUSINESS APPLICATION STUDIO9GENERATE A KEY FOR SSH IN YOUR PROJECT13ADD THE SSH KEY TO YOUR GITHUB ACCOUNT16CREATE A NEW GITHUB REPOSITORY18BUILD A NEW PROJECT IN SAP BUSINESS APPLICATION STUDIO20INITIALIZE THE GIT ENVIRONMENT IN YOUR PROJECT23ADJUST THE .GITIGNORE FILE24PUSH YOUR CHANGES TO GITHUB AND VERIFY THE RESULT25CREATE OBJECTS IN YOUR DEVELOPMENT P ROJECT27CREATING AN HDBMIGRATIONTABLE27CREATING HDBROLES31COMMIT ALL CHANGES TO THE GITHUB REPOSITORY36saphanajourney.com/hana-cloud 2020 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.The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its distributors contain proprietary software 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 or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP or SAPaffiliate 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 affiliatedcompanies’ 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 forwardlooking statements, and they should not be relied upon in making purchasing decisions.service names mentioned are the trademarks of their respective companies. See www.sap.com/copyright for additional trademark information and notices.1

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioWELCOME!Learn in this session how to set up an SAP HANA native application development space and project in SAPBusiness Application Studio and how to create tables in your development project. This includes:·Introduction to SAP Business Application Studio·Setting up an SAP HANA native application development space and project·Binding your project to your SAP HANA Cloud, HANA database·Establishing a connection to a repository on github.com to backup your project and share it with otherdevelopers·Creating hdbmigration tables and hdbrolesYour presenters:Volker SaggauJan ZwickelProduct Manager, SAP HANA Cloud SAPProduct Manager, SAP HANA Cloud SAP2

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioPRE-REQUISITES FOR SESSION #1:1.Sign-up for the SAP HANA Cloud trial. We recommend using the US server for this workshop.a. If you already have a trial account with SAP Cloud Platform, check your trial entitlements to addSAP HANA Cloud2. Provision an SAP HANA Cloud, SAP HANA database in trial.3. Make sure your SAP HANA Cloud, SAP HANA database is running in your trial account.4. Add a subscription to SAP Business Application Studio to your trial.5. Create a free account on github.com.6. All code necessary for this session can be found in this workbook. You can also access it via:a. The public github repository tifactsb. Download as a txt file from here.If you need help with the preparation, post your questions in the SAP community using the hashtag#saphanacloud.Note that during your trial, your instance will be automatically stopped overnight, according to the serverregion time zone. That means you need to restart your instance before you start working with your trialevery day.3

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioADDITIONAL RESOURCES·SAP HANA Cloud Product Page·Data and Analytics Learning Center featuring free in-depth content:·oSAP HANA Cloud Onboarding GuideoInteractive learning mission on SAP HANA CloudRecommended related Learning Tracks:oMoving a project with calculation views from XS Advanced to SAP HANA CloudoHow to create a CAP development project in SAP Business Application Studio and bind it to SAPHANA Cloud··Related Technical Documentation:oSAP HANA CloudoSAP HANA Cloud Deployment Infrastructure Reference GuideoSAP HANA Cloud Modeling Guide for SAP Business Application StudioGet a Demo of Implementation Services from SAP4

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioPREPARATION: PROVISIONINGPlease begin by registering for the SAP HANA Cloud trial. Your first step is to sign up here.If you have already registered and have an existing account, you will be automatically logged in. Here is some basicinformation about the trial.To create your trial instance of SAP HANA Cloud, you need to follow these steps:1.In the SAP BTP cockpit, navigate to your subaccount and space.2. In your space, on the menu on the left-side of the screen, click on SAP HANA Cloud.3. Click on Create and then SAP HANA database.4. A new tab will open in which you will see the SAP HANA Cloud Central. Follow the steps in the wizard by firstinputting a username on the Instance Name field. Please note that you should not use any spaces in thename.5. You can insert a description of this instance on the Description field.6. Then insert a password in the Administrator Password field.7. Confirm it by typing it again on the Confirm Administrator Password field.8. Now, the Step 2 button will appear on the left-hand side of the wizard. Click on it to continue.9. This is where, in a production environment, you would be able to scale your instance up or down. Becauseyou are using a trial instance, you can't change your configuration. So, click on Step 3 to continue.10. Click on Step 3 to continue.11. Now you can manage the allowed connections for your SAP HANA Cloud, HANA database instance. Thatmeans choosing if you allow access to your HANA Cloud instance from outside of the SAP BusinessTechnology Platform. You can either limit it to SAP Business Technology Platform by denying all IPaddresses or allowing specific applications to access it by inserting one or more specific IP addresses.Finally, you can allow all connections from all IP addresses.12. Now you can choose to enable access to the cloud connector. This feature allows you to connect moreeasily to SAP HANA on-premise databases using the SAP Cloud Connectivity service.13. Next is where you can choose to enable the ScriptServer in a production environment. The trial instancestandard size does not allow the ScriptServer to run. Click here to learn more about the ScriptServer.5

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application Studio14. Click on Step 4 in the bottom left corner to continue.15. In Step 4, you can choose to enable a managed SAP HANA Cloud, data lake. Click on the switch to enable. Ifyou do not enable the data lake while creating the instance, you can always do that later.16. Click on Step 5 to continue.17. Now you can determine which connections are allowed to access your managed data lake. You can chooseto only allow access to the instance from Business Technology Platform (default), allow all access, or onlyfrom trusted IP addresses by specifying IP address filter ranges. If you select deny all, you will not be able toconnect using tools such as dbisql.18. Click on Create Instance and you are done! Your first SAP HANA Cloud, HANA database and managed datalake instances will be created, and you can monitor its status to see when it will be ready to be used. Thisprocess usually takes a few minutes.6

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioTOOLS TO WORK WITH YOUR SAPHANA CLOUD, HANA DATABASEOnce your instance is created, you can access all tools you need to work with your instance right on this tile.Click on Actions in the bottom right corner of the tile and you can see the following options:Monitor landscape will open the SAP HANA Cloud Central. There, you can start and stop your instances and checkon their status.Administer instance name will open the SAP HANA Cockpit in a new tab. There, you can monitor your databases,create users and assign roles as well as set up replication services.7

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioExecute SQL and explore objects will open the SAP HANA Database Explorer. There, you can access your data andinteract with your databases.To access SAP Business Application Studio, you can click on Trial Home at the top bar in SAP BTP cockpit. Then,under Quick Tool Access, you will find SAP Business Application Studio. Alternatively, you can find it in the ServiceMarketplace on your Subaccount level.8

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioSET UP YOUR ENVIRONMENT INSAP BUSINESS APPLICATIONSTUDIO AND GITHUBIn this section, we will show you how you can create a development project in SAP Business Application Studio andestablish a connection to a repository in github.com to be able to push your changes to the github repository or pullchanges collaborators have made to the project. We will follow these steps:Accessing SAP Business Application StudioTo get started, let us first access SAP Business Application Studio from your SAP HANA Cloud trial.1.Go to your trial account in SAP BTP cockpit.2. You can find the link to Business Application Studio directly on the trial home page under quick tool access.9

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioAlternatively, you can access it this way:3. Click enter trial account on the trial home page.4. Enter your subaccount by clicking on the name of your subaccount in the top navigation bar.5. Click on Service Marketplace on the right side of the screen.6. Scroll down or use the search bar to find SAP Business Application Studio.10

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application Studio7. On the SAP Business Application Studio tile, click on the three dots and select Go to Application.8. Click on Ok to accept the privacy statement if this is your first time accessing SAP Business ApplicationStudio.9. Bookmark this page so you can get to BAS quickly in the next sessions of this workshop.10. Click on Create Dev Space at the top right corner of the screen.11. In the wizard that opens, give a name to your dev space in the field Dev Space name at the top right corner.Note, that this name must start with a letter or number and only allows alphanumeric characters andunderscores, no special characters.11

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application Studio12. On the left, select SAP HANA Native Application. This will add SAP Predefined Extensions to yourdevelopment space that allow you to deploy native SAP HANA applications or analytical models.13. Click on Create Dev Space at the bottom right corner. Your development space is being created. Thisprocess usually takes a few minutes.14. Once the status changes to RUNNING, you can click on the name of your dev space to open it.12

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioGenerate a key for SSH in your projectSet the global git parameters1.In SAP Business Application Studio, click on Terminal at the top of the screen.2. In the terminal that opens at the bottom of the screen, check that you are in the correct directory for theterminal to be opened in. By default, the terminal should be in the 'user/ /projects' directory if you do thisstep in an empty workspace. Otherwise, use the command "cd" to change the directory.3. First, set the global git parameters by entering this code line by line in your terminal. Enter your emailaddress and user name that you used when creating your github.com account and execute each line.git config --global user.email " YOUR@EMAIL.com "git config --global user.name " GITUSERNAME "git config --list4. You can use either of these commands in the terminal to double check if your global parameters have beenset correctly:git config --listcat .gitconfig13

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioGenerate an SSH key for your projectNext, we will get the SSH key to add it to your github account. This will establish a secure connection between yourproject and the repository.1.Paste this statement to your terminal, enter your github email address and execute:ssh-keygen -t ed25519 -C " YOUR@EMAIL.com "2. Hit enter 3 times to use the default directory to save the file in and to not use a passphrase. Your public keyand identification will be saved.3. Executing the following command, move to the directory of the file that has been created. You might have toadjust the directory to include your specific directory, e.g. /home/user/.ssh.cd .ssh4. Use this command to see the content of this directory:ls -lisa5. There, you should see two key files. The one we need is the public key that ends on.pub. Copy the file namefrom the terminal.6. Execute this command to see the exact name of your public key (If your public key file is named differentlyenter it in the command instead of id ed25519):cat id ed25519.pub7. Copy the whole line shown in the output of your terminal and copy it to your clipboard or a text editor likenotepad.14

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application Studio8. To manage required security settings, copy and paste this command to your terminal and execute it:chmod 0400 id ed255199. This configuration will protect your private ssh key. If you skip this step, SAP Business Application Studiowill not allow you to push changes to github and show this error message:15

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioAdd the SSH key to your github account1.Open github.com on a new browser tab.2. On top right corner click on your profile and select Settings.3. On the left, click on SSH and GPG keys.16

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application Studio4. Click on New SSH Key at the top right corner.5. In the field Title, give this SSH Key a title, for example "BAS".6. Paste the public key string that you have copied in SAP Business Application Studio in the step before andclick on Add SSH key.7. A prompt might ask you to enter your password. Once you do that, the SSH key will be established.8. Now you are ready to create a new repository for your development project to be synched to.17

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioCreate a new github repository1.Click on the profile icon in the top right corner again and select Your repositories.2. In the top right corner, click on New to create a new repository.3. In the field Repository name, next to your profile name, enter a repository name, for example HANACloudWorkshop2.4. Optionally, you can add a short description.5. You can choose to make your repository visible publicly or privately.6. Don't check any of the other boxes for the purpose of this workshop.18

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application Studio7. Finally, click on Create Repository to finish.8. Once your repository is created, it will open and you can see lines of code to help with the initialization ofgithub in your project.9. Make sure, that on the top, SSH is selected.10. Copy the first code block with the header or create a new repository on the command line and paste thecode to a text editor. Alternatively, you can use the code you will find in the next steps in this workbook. Inthe statements in the workbook.19

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioBuild a new project in SAP Business Application Studio1.Switch back to the SAP Business Application Studio tab in your browser.2. On the Welcome screen, click on the Start from Template tile to create a new project.3. Make sure that at the top, where it says Specify a target folder path, the path /home/user/projects isselected. If not, you can change the directory by clicking on Preferences.4. Select the SAP HANA Database project tile and click on Start.5. In the field Project Name, enter a name for your project, for example HANACloud-Workshop2 and click onNext.20

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application Studio6. In the next step (Set Basic Properties), we suggest you keep the database module name as the default dband click on Next.7. In the next step (Set Database Information), we recommend not to fill in the fields Namespace and SchemaName for the purpose of this workshop.8. In the dropdown of the option SAP HANA Database Version, select HANA Cloud.9. On Bind the database module to a Cloud Foundry service instance, select Yes and click on Next.10. In the next step (Bind to HDI Container service), enter your email address (the one you used for your SAPHANA Cloud trial account) and corresponding password to make the project target your trial account andclick on thelogin icon. Once you have logged in, the Cloud Foundry Org and Cloud Foundry Space willbe filled automatically.11. Keep the other default settings as they are and click on Finish.12. Your project is being generated and the hdi container is created on the database according to yourcredentials.13. Click on Open in New Workspace in the pop-up at the bottom right side corner, to open your project.21

SAP HANA Cloud Workshop Series Creating database objects in SAP HANA Cloud with SAP Business Application StudioThe different panels in the file explorerOn the left panel, you can now see your workspace where you have your files, and the SAP HANA Project panelwhere you can deploy your project and open the HDI container in the SAP HANA Database Explorer. Wh

2. Provision an SAP HANA Cloud, SAP HANA database in trial. 3. Make sure your SAP HANA Cloud, SAP HANA database is running in your trial account. 4. Add a subscription to SAP Business Application Studio to your trial. 5. Create a free account on github.com. 6. All code necessary for thi