SAPUI5, ABAP Development, SAP Fiori

How it Works? SAP Fiori Launchpad Plugins

Overview:

Fiori Launchpad plugins are used to extend the launchpad functionality like adding buttons and doing some task when the launchpad is opened etc.,

This usually will be done by create a custom ui5 app based launchpad plugin and deploying it to the ABAP server. Then creating the target mapping and assign the role to that catalog and the same to the user.

So recently there was a question in answers.sap.com on how to show the outage message for the Fiori Launchpad. I never tried it, so I thought to try it once as it will be a good learning for me.

Now when I did all the coding and configuration, it didn’t work!!. I couldn’t find the plugin loaded in the launchpad. So I thought let’s debug in the old fashioned way(thinking it will be a very easy task :D)

So I did f12 on the Fiori Launchpad and started looking at the Launchpad related libraries in the sources and found the below ui2/ushell folder:

SAPUI5, ABAP Development, SAP Fiori

So the plugins will be instantiated(see above)

/sap/bc/ui5_ui5/ui2/ushell/resources/~20180316143600~/sap/ushell/services/PluginManager-dbg.js

sap.ushell.Container.getService(“Ui5ComponentLoader”).createComponent(oApplicationProperties)
.done(function(oLoadedComponent) {
if (oPluginDeferred) {
oPluginDeferred.resolve();
}
oDeferred.resolve.apply(this, arguments);
})
.fail(getRejectHandler());

The above code basically creates the component for the custom plugins(as they are obviously an UI5 app) which is mentioned in the target mappings.

I found here that my plugin component is not called at all.

I checked if any service call might be there to fetch all the custom plugin details but to my surprise no call went to the backend (it makes sense as unnecessary calls will slow down the the Launchpad)

So I debugged a bit and found the code where it is reading the plugins

SAPUI5, ABAP Development, SAP Fiori

It is reading from the window parameter “sap-ushell-config” where the plugin details are stored.

So again I started to search where the window parameter is set and found the place, it is nothing but the main flp file where the Launchpad is loaded:

SAPUI5, ABAP Development, SAP Fiori

But where is that oServerSideConfig coming from? same file, little bit above, we cannot see it in the debugging as it is a dynamic parameter, so opened it in the backend code directly(below);

SAPUI5, ABAP Development, SAP Fiori

So the serversideconfig is set via the placeholder( ${SERVER–SIDE–CONFIG} ) which is again set from http_hanlder class.

Now I went to the HTTP handler class from FLP’s SICF node.

SAPUI5, ABAP Development, SAP Fiori

So at last I found the code where it is fetching the plugins.

SAPUI5, ABAP Development, SAP Fiori

and they are setting it at below in the response(which is the Fiori launchpad page).

SAPUI5, ABAP Development, SAP Fiori

But little did I know, it is fetching the plugins from SHMA(Shared memory access) and so no actually reading the db and trying to fetch the plugins based on a condition, the plugins are already set to SHMA instance before in some other code.

SAPUI5, ABAP Development, SAP Fiori

I guess, this is to increase the performance of the Fiori Launchpad so no addition logic will be performed to fetch the plugins or other information when we launch the FLP.

Here the table mt_plugin doesn’t have my plugin but it has other plugins.

Again, now I debugged where the shared memory is set. But still I don’t know which service or backgroundjob or program will save the plugins to SHMA

So I assumed that it might be set from the Launchpad catalog configuration service when we save the target mapping. Luckily yes and the breakpoint got triggered.

SAPUI5, ABAP Development, SAP Fiori

I found the issue now.. Instead of ‘Shell’ I’ve mentioned in the target mappings Semantic object as ‘shell’. Even I didn’t get any error while saving(no idea why). A silly mistake

So after all this debugging, the issue is a very simple one and from this I understood how the plugins are loaded in Launchpad.

1. First they will be set to SHMA on the save of the target mappings to increase the performance of FLP loading

2. The plugins information along with someother launchpad stuff is converted to string and set to launchpad.

3. These data will be read by the plugin manager.js and the plugins components will be asynchronously loaded.

This is a kind of reverse engineering but if you go from the bottom to top, you get an idea of the process of loading plugins to the launchpad.

The architecture and coding is an awesome piece of art written by SAP team and It’s a very good learning for me.

Leave a Reply

Your email address will not be published. Required fields are marked *