Andrei Vishnevsky Senior SAP, CRM/C4C Consultant shares his technical experience.

Following on from an older blog post.  As the reader may recall, my initial task was to extend C4C UIs (both HTML client and Fiori client). The extension should be something done with SAPUI5/OpenUI5. In other words, it should embed custom (preferably, SAPUI5) control into C4C. And it should talk to C4C as well.

This brought me to this (un)expected journey. Having all tools in hands from my preparation blog, I started to explore further. The first thing which came to my mind was obviously HTML mashup. There are some very valuable blogs across SAP Community platform available on the topic. Here I’d like to focus on technical aspects as well as on advantages and disadvantages of such approach.

During last SAP TechEd 2017 in Las Vegas, I attended all C4C-related sessions and the main idea I’ve got there is that SAP suggested approach to extend C4C currently is to build your own application and embed it into C4C using HTML mashups. As an example during the session CPL171 “Building SAP Hybris Cloud for Customer Extension with SAP Cloud Platform” (hosted by Vladimir Pavlov , Stanimir Ivanov and Jeff Gebo ) was java/sapui5 combined app to find duplicate tickets in Service Request TI. You can find it here SAP Duplicate Tickets Finder Sample Application

However, this part of the journey was before this very interesting session.

There are two types of HTML mashups available.
The first one is URL HTML mashup. Here you’re providing a URL to your app hosted somewhere. And you’re able to pass parameters available from Port type you’ve selected for your HTML mashup on creation to the defined URL as query (e.g. URL) parameters.
This type of HTML mashup can be used to embed completely new app into your C4C tenant.

Technically what we have in case of URL HTML mashup is iframe with “src” pointing to our URL provided on creation.

Being in the iframe it’s like being in the cage. You can’t talk directly back to C4C. And we’re in a different domain and isolated. Here I’ve learnt a lot about Same Origin policy and CORS.

In this case the only way to talk data back or get additional data to use in your app is through C4C OData services.

But to talk to C4C OData services you need to authenticate yourself from your app to C4C. And this is, from my perspective, the main disadvantage of this approach. You need to get onboard Identity Providers or something else to pass the current user to your app and then back to C4C OData. It’s quite a pain to set it all up and sometimes this requires additional costs if you want, for example, take SAP Cloud Identity Management on board to help you. Thankfully, there is one very good news mentioned during SAP TechEd that we will hopefully have one “magic” button in C4C administration to set up SAP Cloud Identity Management with one click. So the setup topic will be covered with ease.

Read more

https://blogs.sap.com/2017/11/28/sapui5-and-c4c.-my-unexpected-journey.-part-1./