Skip to Content
Author's profile photo Matthias Steiner

Extending SAPUI5 web applications with SAP HANA Cloud Portal


A classic use-case for cloud applications are extension scenarios, wherein the cloud application provides additional functionality to an already existing application. In such a setup the cloud extension may simply expose backend data of on-premise systems to the outside world (acting as public API provider) or provide a web-based user interface to make the application accessible to a broader set of users or devices (internet of things). In case the to-be-extended application already has a user interface though the requirement comes up to “seamlessly” integrate the old parts and the new into a holistic experience (composition pattern.)

In today’s blog post I want to touch upon this very scenario and demonstrate how one can develop an extension to an existing SAP UI5 application and integrate the two into a single web site via the SAP HANA Cloud Portal. Best of all, if the original application has been developed with extensibility in mind such a composition view can be accomplished without even touching the original code base (spells modification-free extension.)

Example scenario

Guess it helps to have a crisp example at hand to better illustrate and understand the concept, so why not use the ESPM webshop extension scenario as a reference? This scenario is based upon the idea of extending an existing web shop application with functionality to allow customers to read and write product reviews.


So, on one hand we got a web shop application as seen everywhere on the web, on the other we got an extension that provides the data model, functionality and the matching user interface to read and write product reviews. Now let’s see how we can integrate the two into a single web site.

SAP HANA Cloud Portal

Exposing a SAP UI5 application as a portal widget is straight forward thanks to the OpenSocial features of the SAP HANA Cloud Portal. All there is to it is to create a portal widget XML artifact and create the corresponding widget as documented here.

In its simplest form such an XML artifact may look as follows:

<?xml version="1.0" encoding="UTF-8"?>
  <ModulePrefs title="SAPUI5">
      <Require feature="sap-xhrwrapper" />
  <Content type="html" href="index..html">

As such, all we need to do is to define both applications (original application and extension) as portal widgets and place them both on a single portal site as illustrated below:


Obviously, we would need to establish some sort of communication between the two widgets. For this purpose we can use the so-called Site Context (Pub-Sub) API of the Portal. Tomer Gabbai from the portal team wrote a great tutorial blog (including example code) about this feature a while ago:

How to Develop an OpenSocial Widget on top of SAP HANA Cloud Portal with Site Context Feature

In a nutshell, it’s just an eventing mechanism: one widget publishes events that other widgets can subscribe to. In our example scenario, such an event would include the ID of the currently displayed product. With this information the review extension could load all matching reviews and display them.

With a cherry on top

As you may recall I mentioned something along the lines of modification-free extensions at the beginning, so let’s elaborate on that. In order to subscribe to an event, someone must publish it in the first place. Of course, the trigger to publish an event needs to coded somewhere within the original application. Fortunately, the portal specific publish-subscribe handling can be added to a dedicated index file (e.g. “index_portal.html”), which contains the content of the original “index.html” of the SAP UI5 application plus the required event dispatching coding.

Still, there has to be some code in the original application though that triggers the event and provides the required context information (in our example: the product ID needs to be published when the user enters the product details view.) This is what I meant by refereeing to applications “being developed with extensibility in mind“. Good software architecture principles promote the usage of modular design and loose coupling between components.

SAP UI5 is no exception and the best practices document promotes using the EventBus for inter-component communication. Consequently, if the original app has been developed using this technique (the ESPM web shop application does!) then we are all set! All we need to do is to register a subscriber/listener to EventBus events and dispatch them via the portal eventing mechanism and vice versa. Now, isn’t that sweet?!?

PS: For those of you interested in seeing these concepts in action and going to TechEd please consider registering for session CD265 “End-2-End Developer Experience with SAP HANA Cloud Platform and SAPUI5.” 😉 </plug>

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Graham Robinson
      Graham Robinson

      Great example Matthius. I like. 😎

      Author's profile photo Andy Silvey
      Andy Silvey

      Hi Matthias,

      excellent, thank you.


      Author's profile photo Jan Penninkhof
      Jan Penninkhof

      Very interesting concept. i think you just introduced side-panels (or bottom-panels in this case) for web-apps!

      Thanks for this insight Matthias!



      Author's profile photo Matthias Steiner
      Matthias Steiner
      Blog Post Author

      Thanks for the positive feedback guys!

      PS: (I pretend I didn't noticed the typo in my name, ok?) 😉

      Author's profile photo Andy Silvey
      Andy Silvey

      ooops,  sorry,

      my excuse is, I followed Graeme's lead 🙂


      Author's profile photo Graham Robinson
      Graham Robinson



      Graeme 😏

      Author's profile photo Matthias Steiner
      Matthias Steiner
      Blog Post Author

      Hi Robbo, hi Andy,

      no biggie at all... Graham knows how we deal with such incidents or as Karin would say: "KA-TSCHING!"

      Looking forward to having a drink with you soon! 😀



      Author's profile photo Chandrashekhar Mahajan
      Chandrashekhar Mahajan

      Hi Matthias,

      Very informative blog! Thanks a lot for sharing 🙂



      Author's profile photo Former Member
      Former Member

      Nice post. Thanks!

      Author's profile photo Russ Wagner
      Russ Wagner

      Hello all:

      I know I am coming into this way late in the game (years in fact), but is this blog still current and feasible?  With opensocial widgets now deprecated in the portal service of HCP and with the current state of available api's in the portal service, is this the road one should travel?

      Is there an alternative to this.

      Any help anyone can offer would be appreciated.

      Many thanks