62
Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com Internet of Things Using SAP HANA Lesson Three: HANA XS Web Service

HANA XS Web Service

Embed Size (px)

Citation preview

Page 1: HANA XS Web Service

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Internet of Things Using SAP HANA

Lesson Three: HANA XS Web Service

Page 2: HANA XS Web Service

Course Overview

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Release Date: March 18, 2016

Release Date:March 31, 2016

Coming Soon… Coming Soon…

Now Available!

Internet of Things Using SAP HANALesson Three: HANA XS Web Service

Learn More @ http://www.blackvard.com/iot-overview/

Release Date:April 14, 2016

Lesson One

•Introduction To Internet of Things

Lesson Two

•XS Trial Application Prerequisites & Setup

Lesson Three

•HANA XS Web Service

Lesson Four

•Consuming Data With HANA XS

Lesson Five

•Sample Application

Page 3: HANA XS Web Service

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Agenda

What Will Be Covered:

1. Database Setup/Database Connection/HANA XS Web-Service Connection

1. Creating & Connecting an SAP HANA Trial Instance

2. Creating an SAP HANA Subpackage & Repository Workspace

3. Creating an XS Project

4. Creating the Application Descriptors & Role

5. Creating an XS Destination File/Creating an XSJS File/Granting a User Role

6. Testing Your Application

2. About Us

Page 4: HANA XS Web Service

Creating an SAP HANA Trial Instance (1/4)

Now let’s begin with your next lesson by creating an SAP HANA Trial instance in the SAP HANA Cloud Platform Cockpit

From the main SAP HANA Cloud Platform Cockpit, select Databases & Schemas.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 5: HANA XS Web Service

Creating an SAP HANA Trial Instance (2/4)

All available account databases will be listed along w/ ID, Type, Database System, & Database Version (none are currently available below for this trial).

To view database details (state & existing bindings) select a database list & click the link name. Database overviews allow you to perform actions such as database deletion, etc.

To create a new trial instance, simply click the New button.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 6: HANA XS Web Service

Creating an SAP HANA Trial Instance (3/4)

The New Database/Schema pop-up screen is displayed. Enter the Schema ID.

Can be freely defined, but must begin w/ a letter and contain only uppercase & lowercase letters such as a “z” or “Z”, numbers 0 – 9, & only the special characters of “.” and “-”.

For this example, use Schema ID: zhanaxs. Select an available Database System from the drop-down box & click Save.

For this example, use Database System: HANA XS (<shared>).

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 7: HANA XS Web Service

Creating an SAP HANA Trial Instance (4/4)

The new zhanaxs schema has been successfully created.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 8: HANA XS Web Service

Connecting an SAP HANA Trial Instance (1/5)

Return to the Eclipse IDE, to connect directly to the shared SAP HANA schema, using SAP HANA Tools.

In Eclipse, navigate to Window - > Show View - > Other….

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 9: HANA XS Web Service

Connecting an SAP HANA Trial Instance (2/5)

In the Show View pop-up, open the SAP HANA folder, and select Systems. Click the OK button.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 10: HANA XS Web Service

Connecting an SAP HANA Trial Instance (3/5)

After clicking OK, you will see the Systems view in the main Eclipse IDE. From the Systems menu bar, in the bottom right-hand portion of the screen,

select the Add System icon and then select the Add Cloud System… option.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 11: HANA XS Web Service

Connecting an SAP HANA Trial Instance (4/5)

Modify your Landscape host information (if required). You can learn more about landscape hosts here:

https://help.hana.ondemand.com/help/frameset.htm?350356d1dc314d3199dca15bd2ab9b0e.html

Enter the Account name, User name, Password, and click Next. The system will fetch SAP HANA Schemas and Databases for you.

For more information about your account visit: https://help.hana.ondemand.com/help/frameset.htm?8ed4a705efa0431b910056c0acdbf377.html

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 12: HANA XS Web Service

Connecting an SAP HANA Trial Instance (5/5)

In the SAP HANA Schemas and Databases window, choose the Schemas radio button (if it is not already selected by default).

From the Schemas drop-down menu, select the desired zhanaxs schema. Click Finish.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 13: HANA XS Web Service

Creating an SAP HANA Subpackage (1/4)

Eclipse is now connected to your SAP HANA Cloud Platform zhanaxs schema. Proceed to the SAP HANA Development perspective. If not already in this perspective, click the Open Perspectives icon seen

below, then select SAP HANA Development & click OK.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 14: HANA XS Web Service

Creating an SAP HANA Subpackage (2/4)

In the Systems view, open your project. Open the Content folder, then open the package (e.g. p1941908884trial). Right-click on zhanaxs, then follow menu path: New - > Package….

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 15: HANA XS Web Service

Creating an SAP HANA Subpackage (3/4)

The New Package dialog box appears. In both the Name and Description fields, add the new subpackage name

connectivity to the end of the full package path as seen below. Choose OK to confirm.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 16: HANA XS Web Service

Creating an SAP HANA Subpackage (4/4)

The new subpackage connectivity is added to the package hierarchy below the zhanaxs package.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 17: HANA XS Web Service

Creating a HANA Repository Workspace (1/3)

Now create a Repository Workspace. Navigate to the Repositories view. Click the Create Repository Workspace icon.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 18: HANA XS Web Service

Creating a HANA Repository Workspace (2/3)

Select your SAP HANA system from the displayed SAP HANA Systems list. If your system is not listed, click the Add System… button and add it to the list. If you have more than one system, ensure the correct system is selected.

Enter Workspace Name zhanaxs (the same name as the root package name). In the Workspace Root field, browse and select the desired folder that will

contain the workspace you are creating. Click Finish.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 19: HANA XS Web Service

Creating a HANA Repository Workspace (3/3)

The workspace now appears in the Repositories view, and a folder has been added to your local system (e.g. C:\Users\Erin\hana_work), which will contain all your development files.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 20: HANA XS Web Service

Creating an XS Project (1/7)

Return to the Project Explorer view. In the Project Explorer view, choose File - > New - > XS Project.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 21: HANA XS Web Service

Creating an XS Project (2/7)

The New XS Project dialog box appears. Enter connectivity as the Project name, and click the Next button.

For this tutorial, keep all default settings as-is.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 22: HANA XS Web Service

Creating an XS Project (3/7)

Select the Repository Workspace you created (eg. zhanaxs). In the Repository Package field, choose the Browse… option.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 23: HANA XS Web Service

Creating an XS Project (4/7)

Navigate to the subpackage (e.g. p1941908884trial.zhanaxs.connectivity). Double-click it, or click OK.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 24: HANA XS Web Service

Creating an XS Project (5/7)

The package now appears in the Repository Package field. Click Next.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 25: HANA XS Web Service

Creating an XS Project (6/7)

In the New XS Project dialog box, de-select the default XS Application Access (.xsaccess) and XS Application Descriptor (.xsapp) Access Objects.

Click Finish.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 26: HANA XS Web Service

Creating an XS Project (7/7)

The new project (e.g. connectivity) now appears in the Project Explorer view.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 27: HANA XS Web Service

Creating The Application Descriptors (1/9)

Now create the Application Descriptor file. In the Project Explorer view, select the project (e.g. connectivity), right-click it. Choose New - > File.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 28: HANA XS Web Service

Creating The Application Descriptors (2/9)

In the File name field, insert .xsapp, and click Finish.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 29: HANA XS Web Service

Creating The Application Descriptors (3/9)

After entry, save it by clicking the Save icon, or select Ctrl + S. Activate it by clicking the green Activate SAP HANA Development Object icon.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 30: HANA XS Web Service

Creating The Application Descriptors (4/9)

Now create the Application Access file. In the Project Explorer view, select the project, and right-click it. Select New - > File.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 31: HANA XS Web Service

Creating The Application Descriptors (5/9)

Enter the File name as .xsaccess, and click Finish.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 32: HANA XS Web Service

Creating The Application Descriptors (6/9)

For the .xsaccess file, insert the coding seen below. After entry, save it by clicking the Save icon, or select Ctrl + S. Activate it by clicking the green Activate SAP HANA Development Object icon.

Enhanced Coding View:

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 33: HANA XS Web Service

Creating The Application Descriptors (7/9)

Now create the Application Privileges file. In the Project Explorer view, select the project, and right-click it. Choose New - > File.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 34: HANA XS Web Service

Creating The Application Descriptors (8/9)

Enter the File name as .xsprivileges, and choose Finish.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 35: HANA XS Web Service

Creating The Application Descriptors (9/9)

Insert the coding seen below and click the Save icon. Then click the Activate SAP HANA Development Object icon.

Enhanced Coding View:

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 36: HANA XS Web Service

Creating The Application Role (1/3)

Now create the Role. In the Project Explorer view, select the project, and right-click it. Choose New - > File.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 37: HANA XS Web Service

Creating The Application Role (2/3)

Enter the File name as model_access.hdbrole, and select Finish.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 38: HANA XS Web Service

Creating The Application Role (3/3)

Insert the coding below & replace <package name> with the package name where the project is shared.

Please note that the brackets “<>” are only placeholders and should be deleted. For this tutorial, the code should appear similar to p1941908884trial.zhanaxs.connectivity.

Save the file, then click the Activate SAP HANA Development Object icon.

Enhanced Coding View:

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 39: HANA XS Web Service

Creating an XS Destination File (1/3)

Now create the XS Destination file. In the Project Explorer view, select the project, and right-click it. Follow the menu path New - > File.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 40: HANA XS Web Service

Creating an XS Destination File (2/3)

Enter the File name as google.xshttpdest, and click Finish.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 41: HANA XS Web Service

Creating an XS Destination File (3/3)

Insert the below destination configuration settings, then click the Save icon. Click the Activate SAP HANA Development Object icon.

Enhanced Coding View:

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 42: HANA XS Web Service

Creating an XSJS File (1/4)

Now create the XSJS file. In the Project Explorer view, select the project, and right-click it. Follow menu path New - > File.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 43: HANA XS Web Service

Creating an XSJS File (2/4)

Enter the File name as google_test.xsjs, and click Finish.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 44: HANA XS Web Service

Creating an XSJS File (3/4)

Insert the XSJS JavaScript coding below, then click the Save icon. Click the Activate SAP HANA Development Object icon. Note: A larger view of the full JavaScript coding can be seen on the next slide.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 45: HANA XS Web Service

Creating an XSJS File (4/4)

An enhanced visual of the full XSJS JavaScript coding can be seen below:

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 46: HANA XS Web Service

Granting a Role To The User (1/4)

Now Grant a Role to the user. Return to the Systems view. Select your system & right-click it, then select Open SQL Console.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 47: HANA XS Web Service

Granting a Role To The User (2/4)

The SQL Console opens.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 48: HANA XS Web Service

Granting a Role To The User (3/4)

In the SQL Console, enter the coding below:

Replace <SAP HANA Cloud user> w/ your user ID, & replace the sample trial instance w/ your own trial information as depicted below:

Right-click on the coding, & select Execute to execute the procedure.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 49: HANA XS Web Service

Granting a Role To The User (4/4)

A confirmation message that the statement was successfully executed will appear.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 50: HANA XS Web Service

Testing Your Application (1/8)

Now test the application. Return to the SAP HANA Cloud Platform Cockpit. Navigate to HANA XS Applications.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 51: HANA XS Web Service

Testing Your Application (2/8)

The new HANA XS Application will now display in your SAP HANA Cloud Platform Cockpit.

In the HANA XS Applications table, click the application URL link to launch the application.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 52: HANA XS Web Service

Testing Your Application (3/8)

Since SAP HANA Cloud Cockpit only displays the root of an application’s URL path, a possible 404 (Not found) error may appear after clicking the new application’s URL.

To resolve this issue, the following steps may be required: Add the application name to the URL address in the internet browser (hello.xsjs). Create an index.html file, which is the default setting for the file displayed when the

package is accessed without specifying a file name in the URL. Override the above default setting by specifying the default_file keyword in the .xsaccess

file. For example:

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 53: HANA XS Web Service

Testing Your Application (4/8)

To correct the 404 error (if required), return to the Repositories view in Eclipse.

Navigate to the connectivity subpackage, and right-click it. Select New - > Other….

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 54: HANA XS Web Service

Testing Your Application (5/8)

In the Wizard, open the Web folder, then select HTML File. Click Next.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 55: HANA XS Web Service

Testing Your Application (6/8)

Give the New HTML File the File name: index.html. Click Finish.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 56: HANA XS Web Service

Testing Your Application (7/8)

The below index.html file coding will appear. Change the Insert title here text to: Hello, World! Change the character set from “ISO-8859-1“ to “UTF-8” as seen below. Click the Save icon to save it. Then click the Activate SAP HANA Development Object icon to activate it.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 57: HANA XS Web Service

Testing Your Application (8/8)

Return to the 404 error page, and add index.html to the end of the URL below: https://s12hanaxs.hanatrial.ondemand.com/p1941908884trial/zhanaxs/connectivity/

Now use the new URL to test your application, as seen here: https://s12hanaxs.hanatrial.ondemand.com/p1941908884trial/zhanaxs/connectivity/index.html

Your Hello, World! HANA XS Trial Application is now connected & displayed.

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Page 58: HANA XS Web Service

Success – You Completed The Lesson!

10/10Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Congratulations, you completed the lesson!

In this lesson you successfully: – Created & Connected an SAP HANA Trial Instance– Created an SAP HANA Subpackage & Repository Workspace– Created an XS Project– Created Application Descriptors and Role– Created an XS Destination File, XSJS File & Granted a User Role– Tested Your Application

Page 59: HANA XS Web Service

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Want to learn more about connecting your devices?

Contact us today for your FREE consultation with our experts.

Email: [email protected]

Require A Consultation?

Page 60: HANA XS Web Service

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

Technical project leads and ABAP architects responsible for quality in technical scope and budget in global roll-outs of SAP Logistics applications (SAP LE / LO)

Conducted multiple SAP ABAP, SAP HANA®, and SAP Fiori® trainings for various US companies

Implementation of a standard SAP software solution for Spend Management within SAP AG & ARIBA (annual spend volume 3 Bill. EUR) which can be used in all SAP systems

Improved claims management using SAP FS-CM which is generating annual savings of 15 Mio € for a huge German public healthcare organization

Implemented a global solution for procurement processes at BMW AG using SAP SRM / B2B

Blueprinting and implementation of SAP software for banking credit cancelations for VOLKSWAGEN

Key Achievements of Blackvard Management Consulting in Previous Projects

What We’ve Accomplished

Page 61: HANA XS Web Service

Blackvard Management Consultants

www.blackvard.comCopyright © Blackvard Management Consulting – All rights reserved

Short Bio:

Lukas M. Dietzsch is managing director at Blackvard Management Consulting, LLC. He is holding a Master’s degree in Information Technology and is an experienced IT solution architect and project lead.

His strong background in adapting to requirements and standards in different industries and on various platforms are valuable assets for Blackvard customers.

He is repeatedly commended by customers for driving efficient solutions for complex problems in globally distributed team environments and meeting tough deadlines.

For further information please visit:

www.blackvard.com

Lukas M. Dietzsch

[email protected]

Copyright © Blackvard Management Consulting- All rights reserved www.blackvard.com

Managing Director

Page 62: HANA XS Web Service

Copyright © Blackvard Management Consulting – All rights reserved www.blackvard.com

An overview of current and previous customers:

Customers That Recommend Blackvard