[C4C]SAP UI5 in C4C
This blog will give some brief introduction of how C4C’s UI framework works and what is the render process of C4C.
As we know SAP C4C’s front client is built based on SAP UI5, but actually how C4C using UI5 have some different from other application.
For almost Fiori applications which is based on UI5, we can found that all client sources codes are in a specific folder by chrome dev tools.
For example, client source codes for ‘My opportunity’ app in CRM Fiori is located in folder crm_opprtnty:
Source codes for customer master data in folder customers-webapp:
But we cannot find any folder like above in C4C:
This is what C4C exactly different from other UI5 application. What user can see in browser actually is huge template which is consist by several parts, each part’s location on UI and component to draw these parts like below:
Such as some pink tags on the right top, we call them NavigationBar in technical, actually it’s implement in NavigationBar.js which is located under namespace sap.ui.ux3.
The red area in below is detail for opportunity, the technical name is:
We can open it in UI Designer by this technical name :
Below are some detail related to C4C rendering and source codes analyse.
As above said, after we draw view in UI Designer, in run time, C4C UI framework will render what we draw in browser by HTML source codes, the how the process run?
Let’s using Account work center view as example.
Firstly, we know that the xml file will be generated and stored in ABAP back end after we draw screen in UI Designer. Meanwhile, we also can see this xml file in UI Designer:
We can see red part in above screenshot, there is a tag EmbeddedComponents, the targetComponentID has target to an Object Work List(OWL), which is what we have seen on screen like below:
So how this xml file rendering in run time?
Let’s see what happened later, here the program will request back end to get a JSON Model based on resource path(which is view path we have mentioned above), then execute the call back function.
Then let’s that the callback function did:
See the HTTP response from back end, this is JSON model which contain all components information for this page. We can map this model back to xml which is we mentioned above.Then program will get render manager for these component and render the page.
My colleague, Sean Li has mentioned that C4C have 3 types UI, Silverlight, HTML5 and RUI. HTML5 & RUI both are based on UI5. So when to render HTML5 component and when to render RUI component? Actually every UI component has their own renderer, so which render is responsible to generate HTML source codes? It’s decided by below method getRendererName:
For example, below call stack is when program is rendering Tool Bar in RUI.
And below call stack is when program is rendering red part in HTML5 page.
However, not all the C4C UI are developed by UI Designer. There are still some traditional UI5 xml view.
For example, work center view ‘Visit’, open a survey from facet survey:
This detail page is implemented by UI5 xml view:
So the question is how this hyper link(which in included in view that is developed in UI Deigner) target to UI5 xml view?
Firstly we found the function of on click event –OnSurveyPreview:
Here we can found that there is three path to handle this event, we have mentioned above that C4C have 3 types UI, although these 3 types UI share one development view in UI Designer, the logic after click hyper link have some difference, that’s why there is three paths to handle OnSurveyPreview. The red part codes is the path to handle RUI logic.
Click red part in above screenshot, we found that the implement function for this path is : OnOpenResponsiveSurvey
This function will open a CutomControl:
On run time, the implementation of this CustomControl will create xml view instance, as what we saw in line 127 below, the constructor of xml view will be called:
This is why we can see main.view.xml file loaded after we click hyper link.
Hope that reader can know some basic knowledge for how C4C using UI5 after read this article.
Hi. Great job! My doubt regarding SAPUI5 is: Is it really possible to develop an app/view/work center in SAPUI5 and publish into work center view in C4C, For example a Stock report.
I saw something published into SCP and available as work center/menu in C4C.
Sorry for late reply, actually each work center view in C4C has developed in UI designer which is developed by India team and maintain it in database then the render engine will render it based on user right.