Building Portal Site on SAP Cloud Platform Example – Hyderabad Metro – SapUi5
This blog illustrates how to create a Portal Site on SAP HCP, adding standard widgets, creating custom widgets.
We will be implementing below sample requirement (Site for Hyderabad Metro) using basic layout site template:
- Create a single page site
- Create / Add standard cards Ex: Gallery, Events, and address.
- When we click on a particular card, Application should open URL in a new tab.
- Create a custom widget: Simple Form to show address
- Based on the authorization, only admins can edit the address / Contact number
- Add Footer (Social network links)
- Creating a single page site
Open SAP HANA Cockpit and click on portal service >> Go to Service.
In the site directory, Click the Create New Site. Enter a name and confirm
In the above screenshot, we can observe some standard site template are there which we can use. These site templates will create the basic layout of page, menu and some standard widgets.
Basic Layout Site Template
We would need only one page to implement the requirement so we can delete other pages by clicking on down arrow of each page and click on the delete button.
Use setting icon of the page to Rename the page / Change Authorization settings.
Click on menu editor and hide the menu for all the devices:
Menu Editor >> Settings >> Uncheck two checkboxes >> Save
Next target is to remove the fiori shell header. Follow below steps to delete the header which contains Search, User Personalization settings, a Company logo.
- Go to setting using the side navigation
- Click on the edit button
- Change the SAP Fiori Site Header switch to No
- Click on save button
Single page template creation is completed. Below is the screenshot:
- Creating a Create / Add standard cards Ex: Gallery, Events and address.
Change background image by clicking on setting icon of the section:
Below is the screenshot after changing background image:
Use standard widgets and create title, subtitle and some cards.
Follow the below steps to create standard cards
- Click on add button of the section
- Search for gradient Image Card and select the widget
- Select the cards section and click the edit button to change the image and text like shown below
3. When we click on a particular card, Application should open URL in a new tab.
Click on the edit button of card and give URL and select the external link. Enter the site URL and save.
Publish the changes and click on the preview button.
After all the changes, the Site will be like this :
Using a standard widget option, we can add videos and grid layout.
- Create a custom widget: Simple form to show address.
Open Hana Cockpit >> Select Web IDE full stack >> Go to Service
- Create a new sap UI5 project
- Create a simple form to display the address in view.
- Add User service in neoApp.json
- In Controller by using user details service we can retrieve first name, last name, user id, etc…. In controller onInit method we can control the widget visibility by validating the user.
- After Deploying UI5 project successfully. Right click on the project and select Use As SAP Cloud Portal Template and enter name.
Add a custom widget to portal site:
Below is the site screenshot after completing the above steps:
- Adding Footer: Social Network URLs.
Click on add button and select social Networks
After adding the above widget, we can add URL by clicking on the settings icon.
We need to publish the site after completing the development.
Click on publish button and open site URL in a new tab.
Final Site Preview:
> Create a custom widget: Simple form to show address.
You should include Portal extension in your web ide first to obtain the functionality mentioned: