Professional Documents
Culture Documents
Table of Contents
Exercise 1: Setting up the Work Environment ........................................................................... 4
1.1. Prerequisites: set up your environment ........................................................................ 4
1.2. Access your trial account .............................................................................................. 4
1.3. Access SAP Web IDE ................................................................................................... 4
1.4. Set up a Git repository for SAP Web IDE ..................................................................... 5
1.5. Activate Cloud Portal Plugin for SAP Web IDE ............................................................ 6
1.6. Get the source code ...................................................................................................... 7
Exercise 2: Creating Lightweight Applications .......................................................................... 8
2.1. Create the Fiori designed application ........................................................................... 8
2.1.1. Create a project in SAP Web IDE .................................................................... 8
2.1.2. Import the source code into your project ........................................................ 10
2.1.3. View the project tree ....................................................................................... 11
2.2. Create the Opportunity Form Application ................................................................... 12
2.2.1. Import the source code into your SAP Web IDE ............................................ 12
2.2.2. Create the model and connect it to the view .................................................. 13
2.2.3. Cross-site request forgery .............................................................................. 15
2.2.4. Create Opportunity ......................................................................................... 16
2.2.5. Create the Partner Registration Application ................................................... 17
2.2.6. Import the source code into your SAP Web IDE ............................................ 17
2.2.7. Add the OpenSocial specification xml file to the application .......................... 18
2.3. Deploy and manage your code in the SAP HANA Cloud Platform Git ....................... 19
2.3.1. Deploy the fioriwidget application to SAP HANA Cloud Platform .................. 19
2.3.2. Deploy the destination file .............................................................................. 20
2.3.3. Start your application...................................................................................... 22
2.4. Customize the fioriwidget application ......................................................................... 23
2.4.1. Preview fioriwidget in SAP Web IDE .............................................................. 23
2.4.2. Customize the fioriwidget application ............................................................. 24
2.4.3. Commit your changes and create a new application version......................... 25
Exercise 3: Adding Widgets to Cloud Portal ............................................................................ 27
3.1. Test the URLs to the widget files ................................................................................ 27
3.2. Access Cloud Portal .................................................................................................... 28
3.3. Manually create widgets for use in Cloud Portal ......................................................... 29
Exercise 4: Creating and Configuring a New Cloud Portal site .............................................. 30
4.1. Manage files in the document repository .................................................................... 30
4.2. Import a site from the Cloud Portal Market Place ....................................................... 31
Exercise 5: Adding Content and Managing Pages in Your Site ............................................. 32
5.1. Update the Register page ........................................................................................... 32
5.2. Update the List and Create Opportunity subpages..................................................... 32
5.3. Restrict access to the Opportunities page .................................................................. 33
5.4. Reorder the site pages ................................................................................................ 34
Welcome
Welcome to our hands-on for SAP HANA Cloud Portal site and content development. We will guide you in developing
widgets for your Cloud Portal site, deploying them to SAP HANA Cloud Platform, and then building your complete site
in SAP HANA Cloud Portal. After this session, you will have the knowledge and skills to:
Create Cloud Portal sites and populate the site pages with the content that you have developed
Exercise Agenda
1. Setting up the Work Environment
To begin, you will activate your SAP HANA Cloud trial account (if you havent already), access and activate
SAP Web IDE, enable the Cloud Portal plugin for the Web IDE, and learn about the online cloud-based tools
that you will use to develop your widgets for your portal site.
2. Creating Lightweight Applications
In this section, you will develop SAPUI5-based applications in the SAP Web IDE, and store them in a
dedicated Git repository.
3. Adding Widgets to Cloud Portal
You will then deploy your applications to SAP HANA Cloud, and add them as widgets to SAP HANA Cloud
Portal.
4. Creating and Configuring a New Cloud Portal Site
Once your content is ready, you will create a new Cloud Portal site based on an existing site that you import
from the Cloud Portal Market Place.
5. Adding Content and Managing Pages in Your Site
In this exercise, you will focus on finalizing your page structure.
6. Managing Page Templates in Your Site
You will learn how to use and customize page templates to create different page layouts.
7. Managing Roles and Groups
In this section, you will learn how to define organization roles and use them to restrict site and page access to
selected groups of users.
8. Previewing the Site and Publishing It
Before you publish your site for end users, you can preview it on the different devices.
9. Exploring Advanced Site Management and Authoring Features
Once your site is published, you can learn about additional features for building your Cloud Portal sites.
Prerequisites
You have established a trial account for SAP HANA Cloud Portal and have your SAP ID or SCN credentials.
Note: You will need to use the name and password of your trial account in some of the exercises.
Exercise 1:
In this exercise, you will initiate a free SAP HANA Cloud trial account, start SAP Web IDE, set up a Git repository, and
enable the Cloud Portal project plugin for it.
3. Click the webide link in the Name column. The webide application cockpit screen opens.
4. Click the Application URL link to launch SAP Web IDE. This may take a few seconds.
Make sure that you accurately enter the following details; if youre not certain, ask the instructors
3. Click Update.
6. Click OK
SAP Web IDE project folders, which contain the solution source code for this exercise:
o fioriapp
o opportunityform
o partnerregistration
Resources:
o
Destinations: the destination files that enable connections from your trial account to external
systems required for this exercise (detailed information about destinations follows).
Documents: the soft-copy version of this exercise. You can use it to easily copy and paste the
needed code.
Project ZIPs: Three ZIP files that contain the projects to be imported into your SAP Web IDE.
Static Content: Contains the various static resources required for this exercise
Exercise 2:
In this exercise, you will develop SAPUI5-based lightweight applications in your SAP Web IDE. The applications
consist only of front-end code. All applications use connectivity to a Cloud for Customers (C4C) back-end instance to
consume or persist data through OData services. You will manage each set of application code and resources in a
dedicated Git repository that is automatically allocated to your SAP HANA Cloud Platform account upon deployment.
At the end of this exercise, the following applications will be ready for consumption in your Cloud Portal.
Name
Description
fioriwidget
A Fiori designed application displaying a list of records from the Cloud for Customers
Opportunity entity in the master-detail paradigm
opportunityform
A form that enables users to create a new opportunity record in the Cloud for
Customers back end
partnerregistration
A form that enables users to register for the partner portal in the Cloud for Customers
back end
4. Click Next.
5. In the second step, Select a Template, choose the SAP HANA Cloud Portal Widgets option from the dropdown
list.
6. Click on the Cloud Portal SAPUI5 Starter Widget tile.
7. Click Next.
A list of Open Social features supported by the Cloud Portal Open Social container is displayed.
8. Mark the first and last features for inclusion in your widget:
a. SAP UI5 integration [sap-xhrwrapper]:
Proxifies requests from our application code, enabling us to perform client-to-client requests through
the SAP HANA Cloud Platform proxy
b. Site Navigation [sap-navigation]:
Allows navigation from the widget to other pages in the Cloud Portal site
9. Click Next.
10. Click Finish. A new project is created in our project panel.
Make sure that you import the correct ZIP file named fioriapp.zip; if you have questions, consult with
the instructors.
5. Leave the Import as a project checkbox unchecked.
6. Click Import.
7. Click OK on the confirmation dialog
10
Youve successfully created a new Cloud Portal Widget project and imported the implemented source code for its Fiorilike application. Your project tree should look like this:
The view folder contains the JavaScript resources for this application, separated according to the MVC pattern.
splitapp.controller.js is responsible for setting the applications data model to the applications
view. This is done in the onInit method
splitapp.view.js is responsible for building the application UI. The various UI elements are initiated
and returned in the createContent method.
Under the projects root folder, you can find the following resources:
index.html serves as the end point for our application. It builds the view of the application linked to its
dedicated controller and places it inside the application markup.
neo-app.json describes the application welcome file, required destination files for connectivity,
authentication level and so on.
fioriwidget.spec.xml is the specification XML file that enables the application to run inside the
Cloud Portal OpenSocial container. The file points to the SAPUI5 applications index.html and contains
the required OpenSocial features that we selected in step 2.1.1
11
2.2.1. Import the source code into your SAP Web IDE
Import the SAP Web IDE projects that you extracted from the ZIP file into SAP Web IDE.
1. Open your Web IDE.
2. Click on the root Local folder.
3. Right-click and click New > Folder.
12
8. In the Import Archive dialog box, select the Import as a project checkbox.
9. Click Import.
The opportunityform source code is imported into the Web IDE environment.
When you finish, the Web IDE should look like this:
13
this.getView().setModel(oDataModel);
14
When done, the onInit method of your form.controller.js file should look like this:
onInit: function() {
/****
*2.2.2 - Place your code here
*/
var oDataModel = new sap.ui.model.odata.ODataModel( this.oDataServiceURL );
this.getView().setModel(oDataModel);
/*
* 2.2.2
******/
/****
*2.2.3 - Place your code here
*/
oDataModel.refreshSecurityToken(this.refreshTokenSuccess, this.refreshTokenError, true);
/*
* 2.2.3
******/
},
15
7. Invoke the create method of the ODataModel with the Opportunity service path, the new entry, and the
parameter map.
oModel.create('/OpportunityCollection', oEntry, params);
16
2.2.6. Import the source code into your SAP Web IDE
Import the projects that you extracted from the ZIP file into SAP Web IDE.
1. Open your SAP Web IDE.
2. Right-click on the root Local folder and click New > Folder.
17
8. Click Import.
The partnerregistration source code is imported into SAP Web IDE.
When you finish, the SAP Web IDE hierarchy should look like this:
18
2.3. Deploy and manage your code in the SAP HANA Cloud Platform Git
In this part of the exercise, we will deploy our SAP Web IDE application project to SAP HANA Cloud Platform, and
manage the source code in the Git repositories allocated for the application. The application deployment to SAP HANA
Cloud Platform automatically creates a Git repository that stores all artifacts of our project that have been staged,
committed and pushed to it.
1. From the SAP Web IDE project hierarchy, select the fioriwidget project node.
2. Right-click and click Deploy > Deploy to SAP HANA Cloud.
The SAP HANA Cloud Server Connection Properties dialog box opens.
19
User Name: your SAP HANA Cloud Platform trial account/SCN user name (for example:
P1940349974).
Active: Select the checkbox to activate and start the newly-created version of your application.
4. Click Deploy, and after a successful deployment, click OK in the Success dialog box.
20
4. Click the link of your newly-created application to navigate to the applications dashboard.
Notice the red square in the Referenced Destinations table. This means that a destination file named
c4cservices, required by the fioriwidget application (as we stated in the applications neo-app.json file), is
missing from our Cloud Platform account. Our application will fail to connect without it.
5. Switch back to the SAP HANA Cloud Platform cockpit by clicking on the Account ID.
6. Select Destinations in the navigation menu at the left.
7. Above the Destinations table, click Import from File to import the missing destination.
21
22
3. At the top of the State table, check that the application has started. If the icon indicates that has is not, start it
by clicking the
(Play) icon.
Now that we have an active version of the fioriwidget application, we can run it by clicking on the link displayed in
the Application URL field.
The Application Preview opens in a new Chrome tab, displaying the fioriwidget application runtime.
23
5. Click the
The application preview changes from portrait to landscape and vice versa.
6. Click the Resolution Tool Bar at the top left:
The application preview changes to the selected resolution:
Large Desktop, Medium Tablet, Small Smartphone, or Custom.
4. Click Ctrl+F to open the SAP Web IDE search bar, and search for the method name buildDetailPage
5. Complete section 2.5.2 in method buildDetailPage by creating an ObjectAttribute, binding the OData
attribute AccountName to it and adding it to the details header.
At the end of the section, your code should look like this:
/****
*2.5.2 - Place your code here
*/
var newAttribute = new sap.m.ObjectAttribute({
title: "Account Name",
text: "{" + selectedContext.getPath() + "/AccountName}"
});
header.addAttribute(newAttribute);
/*
* 2.5.2
******/
24
Here you can view all of the resources that have been modified in the project, stage them for commit, and push them
into the branch.
25
Now that your latest changes have been committed and pushed, we can return to the applications cockpit in the SAP
HANA Cloud Platform to create a new activated version for our fioriwidget application.
1. Go back to SAP HANA Cloud Platform Cockpit.
2. In the navigation menu at the left, click HTML5 Applications.
3. Click on the fioriwidget link to navigate to the applications dashboard.
4. In the navigation menu, click the Development option.
5. In the History of Branch Master table, notice that the latest commit now appears in the list
6. Click the
icon in the top row of the Create Version column; this creates an application version from your
latest commit and opens the New Version dialog box.
7. In the Version field, enter a version number, such as 1.02.
8. Click Add to create the new version.
26
Exercise 3:
In this exercise, you will consume your HTML5 applications as OpenSocial widgets running on HANA Cloud Portal.
At the moment, applications running from Git should be manually added to the Content Catalog by a Cloud Portal
administrator, who can then create the widgets in the CONTENT tab.
4. The spec XML URL is the concatenation of the Application URL and the relative path of the spec.xml file.
For example: https://fioriwidget-p1940965887trial.dispatcher.hanatrial.ondemand.com/fioriwidget.spec.xml
5. In a new browser tab, enter the URL for the fioriwidget spec.xml file and verify that it is available:
27
If the XML is available, the project version has been created successfully and the widget is ready to
be created.
28
From your Cloud Portal trial account: (See Appendix: Setting up Your Trial Account in the last page)
1. Navigate to the CONTENT tab.
2. Click the
Type: OpenSocial
URL: The URL to the spec XML file of your HTML5 application. For example:
fioriwidget
https://fioriwidget-p1940965887trial.dispatcher.hanatrial.ondemand.com/fioriwidget.spec.xml
partnerregistration
https://partnerregistrationp1940965887trial.dispatcher.hanatrial.ondemand.com/partnerregistration.spec.xml
opportunityform
https://opportunityform- p1940965887trial.dispatcher.hanatrial.ondemand.com/spec.xml
4. Click Save.
The new application is now available for use as a widget in the Cloud Portal sites.
29
Exercise 4:
In this exercise, you will import a site from the Cloud Portal Market Place. You will use your trial account to perform
Cloud Portal site authoring and configuration.
(New folder) toolbar button, change the folder name to Assets, and press
(New folder) toolbar button again, and name the new folder Partner.
(Upload file to the repository) toolbar button and in the Open dialog
box, browse to the header.png file saved on your file system (...\cloud-portal-pcm\Resources\Static Content).
A notification message is displayed when the file is successfully uploaded.
6. Repeat the same step to upload the SAP_logo.png file.
7. In the folder tree at the left, click the Public folder, which contains files used in this site and other files that can
be publically shared by getting their URL from the repository.
8. Click the
site_bg.png.
(Upload file to the repository) toolbar button again, and browse to the following image file:
9. Return to the Home folder and in the Search field at the top right, type site_bg.
The file is displayed in the search results.
30
6. Hover the Partner Portal site and click Edit to open the site for editing.
31
Exercise 5:
In this exercise, you will learn how to add content to pages, expose the new application in your site, and manage pages
by applying page-management capabilities.
4. Find the Registration Form widget and drag it onto the page.
5. From the
6. Click Set as full page and close the close the dialog box.
3. Open the Content Catalog, find the Fiori Widget, and drag it onto the page.
4. Set the widget to show as full page.
5. Under the Opportunities page, open the Create Opportunity subpage.
32
33
2. In the list of page items, drag the News page down and place it after the Marketing page.
3. Expand the Opportunities page and drag the Dashboard page left and up, placing it after the News page.
4. Close the Page Management panel and open the Access Management panel.
5. Click the Dashboard page. The Page Access Permissions screen for the Dashboard page opens.
6. Note that the access level for the page is now Public, which is the site (parent) access level.
34
Exercise 6:
In this exercise, you will learn how to customize page templates to fit your layout needs. You can customize an existing
page template by resizing its sections, and modifying their content items. The site author can assign different page
templates for use in different pages of the site.
(Design Settings).
2. Click the Manage Templates button. The Available Page Templates screen opens, displaying a list of the page
templates that are available for use in your site. Page templates are stored in the Cloud Portal repository.
3. To import a page template from the repository, click
(import template)
4. Select the Standard template and click Import. The template is added for use in this site.
5. Click on the template name (Standard) and change it to Custom.
(Page Management).
(Page options) menu, and change the Page Template from Partner
4. Go to the top right of the Navigation widget in the header, open the
Remove to delete the page navigation bar.
35
(Widget options) menu, click Design. The Design dialog box opens:
6. Click on both Full Width and Full Height to stretch the image over the header container area.
7. Close the dialog box.
8. In the
(Widget options) menu of the widget, click Edit and then click the Add Links button.
4. Click
37
Exercise 7:
A role is basically a collection of permissions that defines a function within a portal, to which users and/or groups are
assigned. In this exercise, you will learn how to define organization roles for restricting site and page access to specific
groups of users who have been authorized by the identity provider (SAP ID service or others).
2. Click the Cockpit link at the top right to open SAP HANA Cloud Portal Cockpit.
3. In the Content panel on the left, click Services.
4. In the SAP HANA Cloud Portal row of the Services table, click Manage Roles at the right. The Roles definition
page opens.
5. Click New Role and name it Role A.
6. In the Individual Users block of Role A, click Assign.
7. In the User ID field, enter P1314641442 and click Assign.
8. Repeat these steps to create a second role named Role B, with User ID P1314636609.
38
3. In the Site and Page Access section, click the site name (Partner Portal) at the top of the list.
The Site Access Permissions screen opens.
4. Click the card with the plus sign. The Add Role dialog box opens, with the new roles listed in the Organization
Role Name list.
5. Select both Role A and Role B and click Add. These roles are now available for assigning page access
permissions to them.
6. In the site hierarchy list, click the Marketing page name, and at the left, select the Set stricter access
permissions radio button. This allows you to assign roles to each page, rather than use the parent-level
assignment as default.
7. Click the Role-Based icon as the access level for the page.
8. Hover over the Role A card, and click Allow Page Access, to give that role access to the page.
39
9. Click the News page name and select Set stricter access permissions again.
10. Select the Role-Based access level and assign Role B to that page.
11. Close the Access Management panel.
2. Click Publish and then click Publish again in the confirmation dialog box. Close the dialog box.
3. Click the Published Site link in the middle of the panel. A new browser tab opens, displaying the end-user site.
4. To explore the page authorizations mechanism, open a new browser using a new incognito window option:
a. Access the site using the end-user link; only the public pages Home, Dashboard, and Register are
displayed.
b. Click Log On and enter the Role A user credentials: P1314641442/ Abcd1234.
All pages appear including the Opportunities page and its subpages, which are visible for authenticated
users only, except the News page, which was assigned to Role B.
40
Exercise 8:
In this exercise, you will learn how to preview your site on a desktop, tablet, or smartphone, and then publish it to your
clients. Once the site is published, you will be able to view the site in consumption mode and access it with your mobile
device.
(Site Preview).
2. In the Site Preview panel, click the relevant icon to preview your site on desktop, tablet, or smartphone. A fully
functional preview of the site, as it will appear on the selected device, is displayed.
3. Close the Site Preview panel.
2. Click Publish and then click Publish again in the confirmation dialog box. A notification dialog box opens,
allowing you to access the site or scan its QR code.
3. Close the dialog box.
4. Open the Site Settings panel, and in the Site URL section, click the URL. The editable part of the URL is
displayed in a text box.
5. Type Partner and press Enter. The name shortens the URL and makes it meaningful.
41
Exercise 9:
Using the default theme provided by SAP HANA Cloud Portal, you can create a new theme based on your companys
branding and site-design requirements. Cloud Portal supports LESS as the stylesheet for site theming.
LESS File: the partner_new.less file that you edited in the previous steps.
3. Click Add. The new theme is added to the Available Themes table.
4. Go back to the Site Directory, open your site for editing, and in the Design Settings panel, apply the theme to
your site.
42
2. Click Register.
3. Fill in the form, then scroll to the end of the license agreement and select the checkbox.
4. Click Register. You will receive an email notification.
5. Click Continue, A message appears with your trial account name.
6. On your account page, in the side-panel menu at the left, click Services.
7. From the Services list, click Enable to activate SAP HANA Cloud Portal.
43
www.sap.com