Sie sind auf Seite 1von 35

BOOT CAMP SERVICE DAY 1

HANA NATIVE DEVELOPMENT

Exercises/Solutions

HANA Native Development (HANA XS) Page 1


BOOT CAMP SERVICE DAY 1
TABLE OF CONTENTS

1. Unit 1: Create MDC (Multitenant Database Container) in SAP Cloud Platform Trial Account ........... 5

1.1. Overview Unit 1 .............................................................................................................................. 5

1.2. Tool and Topic................................................................................................................................ 5

1.3. Objective: ....................................................................................................................................... 5

1.4. Steps .............................................................................................................................................. 5

2. Unit 2: : Import prebuild content (Optional) ....................................................................................... 11

2.1. Overview ...................................................................................................................................... 11

2.2. Tool and Topic.............................................................................................................................. 11

2.3. Objective: ..................................................................................................................................... 11

2.4. Steps ............................................................................................................................................ 11

3. Unit 3: Create tables and services in hana web ide .......................................................................... 13

3.1. Overview ...................................................................................................................................... 13

3.2. Tool and Topic.............................................................................................................................. 13

3.3. Objective: ..................................................................................................................................... 13

3.4. Steps ............................................................................................................................................ 13

3.5. Summary Unit 1 ........................................................................................................................... 22

4. Create HANA Calculation View ......................................................................................................... 23

4.1. Overview Unit 1 ............................................................................................................................ 23

4.2. Tool and Topic.............................................................................................................................. 23

4.3. Objective: ..................................................................................................................................... 23

4.4. Steps ............................................................................................................................................ 23

5. TESTING HANA Calculation View .................................................................................................... 34

5.1. Objective: ..................................................................................................................................... 34

5.2. Steps ............................................................................................................................................ 34

HANA Native Development (HANA XS) Page 2


BOOT CAMP SERVICE DAY 1
Before You Start

In this session, you will walk through a process end-to-end. Therefore, please perform the steps in the
sequence given since the result of one step is the starting point for the next.

Unit 1: Create MDC (Multitenant Database Container) in SAP Cloud Platform Trial Account
Estimated Duration: 10 minutes

Unit 2: Import prebuild content (Optional)


Estimated Duration: 5 minutes

Unit 3: Create Tables and Service in SAP HANA Web IDE


Estimated Duration: 45 minutes

Unit 4: Create HANA Calculation View


Estimated Duration: 30 minutes

Unit 5: Testing HANA Calculation View


Estimated Duration: 5 minutes

HANA Native Development (HANA XS) Page 3


BOOT CAMP SERVICE DAY 1

Target Audience

This course is intended for the following audiences:

Developers
Customers
Business Users

HANA Native Development (HANA XS) Page 4


BOOT CAMP SERVICE DAY 1
1. UNIT 1: CREATE MDC (MULTITENANT DATABASE CONTAINER) IN SAP Cloud
Platform TRIAL ACCOUNT

1.1. Overview Unit 1


SAP HANA supports multiple isolated databases in a single SAP HANA system. These are referred to
as multitenant database containers. A multiple-container system always has exactly one system
database, used for central system administration, and any number of multitenant database containers
(including zero), also called tenant databases.

1.2. Tool and Topic

The MDC feature was introduced with SAP HANA SPS09. As SAP Cloud Platform HANA Database is upgraded to
SPS09, SAP Cloud Platform trial account provision this 1 MDC Database system per trial account.

1.3. Objective:
Creation and configuration of HANA MDC.

1.4. Steps
Create new Database with Database type: HANA MDC <trial>

Open Administration Tools to add user role.

HANA Native Development (HANA XS) Page 5


BOOT CAMP SERVICE DAY 1

Logged in with user: SYSTEM and password set earlier

Click OK

HANA Native Development (HANA XS) Page 6


BOOT CAMP SERVICE DAY 1

Click Continue

Now Open Development Tools in SAP Cloud Platform cockpit

HANA Native Development (HANA XS) Page 7


BOOT CAMP SERVICE DAY 1

Open Security section to add more role to system user to work with webIDE

HANA Native Development (HANA XS) Page 8


BOOT CAMP SERVICE DAY 1

Add following roles

sap.hana.xs.ide.roles::EditorDeveloper
sap.hana.xs.ide.roles::Developer sap.hana.xs.debugger::Debugger
sap.hana.xs.admin.roles::HTTPDestViewer
sap.hana.xs.admin.roles::HTTPDestAdministrator
sap.hana.xs.admin.roles::TrustStoreViewer
sap.hana.xs.admin.roles::TrustStoreAdministrator
sap.hana.xs.lm.roles::Administrator

HANA Native Development (HANA XS) Page 9


BOOT CAMP SERVICE DAY 1

Now Open IDE Editor

HANA Native Development (HANA XS) Page 10


BOOT CAMP SERVICE DAY 1
2. UNIT 2: IMPORT PREBUILD CONTENT (OPTIONAL)

2.1. Overview
Can import the all HANA XS artifact from provided Delivery Unit

2.2. Tool and Topic

Use SAP HANA Web IDE for import provided delivery unit

2.3. Objective:
Import all exercise as import delivery

2.4. Steps
1. From Editor, open Lifecycle Management

HANA Native Development (HANA XS) Page 11


BOOT CAMP SERVICE DAY 1

2. Click Delivery Unit tile.

3. Click on Import and choose provided .tpz file

4. Check log for successful import.

HANA Native Development (HANA XS) Page 12


BOOT CAMP SERVICE DAY 1
3. UNIT 3: CREATE TABLES AND SERVICES IN HANA WEB IDE

3.1. Overview

3.2. Tool and Topic

Use SAP HANA Web IDE to create tables and corresponding services. Before using HANA Web IDE, HANA
instance needs to be created in the cockpit if not already done.

3.3. Objective:
Understand HANA Native Development and XS runtime

3.4. Steps
1. In the editor prospective, create new package with name: bootcamp.

2. Right click on package and create new Application

HANA Native Development (HANA XS) Page 13


BOOT CAMP SERVICE DAY 1

HANA Native Development (HANA XS) Page 14


BOOT CAMP SERVICE DAY 1

3. Create new package under bootcamp package with name DB.

4. All DB tables we will create in this exercise will be developed under this sub package.

5. Create file under package DB with name JobModel.hdbdd. This is HANA CDS for creating
database table

HANA Native Development (HANA XS) Page 15


BOOT CAMP SERVICE DAY 1

JobModel.hdbdd:
https://github.com/vijayrajput/BootCamp_HANAXS/blob/MDC/bootcamp/DB/JobModel.hdb
dd

Open the Catalog view to check created database table

HANA Native Development (HANA XS) Page 16


BOOT CAMP SERVICE DAY 1

Browse schema SYSTEM -> Tables

HANA Native Development (HANA XS) Page 17


BOOT CAMP SERVICE DAY 1

6. Now create new package under application package for the odata service. Name this package as
Service.

7. Now create new file under the sub package Service. File extension will be jobs.xsodata.

jobs.xsodata : A design-time object that defines an Data service that exposes SAP HANA data from a
specified end point. This file resides in the package hierarchy of the OData application and must contain
at least the entry service {}, which would generate an operational OData service with an empty service
catalog and an empty metadata file.

https://github.com/vijayrajput/BootCamp_HANAXS/blob/New2017/bootcamp/Service/jobs.xsodata

8. Now lets test the xsodata service using Run option provided.

Both the entities are visible in the testing of the Odata service.

HANA Native Development (HANA XS) Page 18


BOOT CAMP SERVICE DAY 1

9. Lets know check metadata of the Odata service

10. Insert data into both the tables using catalog view

Insert entries into Job table with below file.


https://github.com/vijayrajput/BootCamp_HANAXS/blob/MDC/bootcamp/Data/JOB_SQL.txt

HANA Native Development (HANA XS) Page 19


BOOT CAMP SERVICE DAY 1

Insert entries into Enrollment table with below file.


https://github.com/vijayrajput/BootCamp_HANAXS/blob/MDC/bootcamp/Data/ENROLLMENT_S QL.txt

11. Check Entries in Jobs table.

12. Check entries in application table.

HANA Native Development (HANA XS) Page 20


BOOT CAMP SERVICE DAY 1

13. Now check entries using xsodata.


Jobs

Applications

HANA Native Development (HANA XS) Page 21


BOOT CAMP SERVICE DAY 1

3.5. Summary Unit 1

You have completed the exercise!

You are now able to:


Create tables and services in HANA Web IDE.
Use HANA Web IDE.
Insert and View data in the database tables
Test XSODATA services

HANA Native Development (HANA XS) Page 22


BOOT CAMP SERVICE DAY 1
4. CREATE HANA CALCULATION VIEW

4.1. Overview Unit 1

4.2. Tool and Topic


Eclipse HANA plug in help us to do native HANA Development. This exercise provide step by step guide
to create HANA Calculation views.

From HANA SPS 9, Web IDE can also be used to create calculation views. Before using HANA Web IDE,
HANA instance needs to be created in the cockpit if not already done.

4.3. Objective:
Understand HANA Models and runtime

4.4. Steps

1. Create New sub package Model under bootcamp

2. Create New Calculation View under Model package

HANA Native Development (HANA XS) Page 23


BOOT CAMP SERVICE DAY 1

Give Name CV_ENROLLMENT_COUNT and following property.

Drag Project element to draw area

HANA Native Development (HANA XS) Page 24


BOOT CAMP SERVICE DAY 1

Add Data Source for Projection_1

Select Job Table

HANA Native Development (HANA XS) Page 25


BOOT CAMP SERVICE DAY 1

Right click on JOBID, DEPARTMENT, VALID_TILL and select Add To Output

HANA Native Development (HANA XS) Page 26


BOOT CAMP SERVICE DAY 1

Similarly create new projection for table Enrollment and select JOBID, LOCATION in output.

Drag Join nodes to drawing area.

HANA Native Development (HANA XS) Page 27


BOOT CAMP SERVICE DAY 1

Create Connection from Projection_1 and Projection_2 to Join_1

HANA Native Development (HANA XS) Page 28


BOOT CAMP SERVICE DAY 1

Click on Join_1 and do join mapping

HANA Native Development (HANA XS) Page 29


BOOT CAMP SERVICE DAY 1

Add all the columns to Output.

Rename JOBID_1 to JOB_JOBID (Need to create JPA relationship from Java application with Job Table)

HANA Native Development (HANA XS) Page 30


BOOT CAMP SERVICE DAY 1

Create New calculated Column with name Count.

HANA Native Development (HANA XS) Page 31


BOOT CAMP SERVICE DAY 1

Create Connection between Join_1 to Aggregation Node.

Select Aggregation node and Add all columns to Output

And Count as Aggregated Column and set its aggregation property as Sum

HANA Native Development (HANA XS) Page 32


BOOT CAMP SERVICE DAY 1

Save Calculation View

HANA Native Development (HANA XS) Page 33


BOOT CAMP SERVICE DAY 1
5. TESTING HANA CALCULATION VIEW

5.1. Objective:
Testing HANA Models and runtime

5.2. Steps
Select Calculation View and Click Run.

Open Catalog -> SQL Console


And run following SQL Command

SELECT "Count",
"LOCATION"
FROM "_SYS_BIC"."bootcamp.Model/CV_ENROLLMENT_COUNT"

HANA Native Development (HANA XS) Page 34


BOOT CAMP SERVICE DAY 1

HANA Native Development (HANA XS) Page 35

Das könnte Ihnen auch gefallen