Skip to Content
Technical Articles

Meticulous Investigation in Backend: Restricting Fiori Launchpad (ABAP) theme selection

We had Blue Crystal, Belize, now we have Quartz. What we haven’t until now, 3 Fiori revisions later, is a way to allow only a few selected themes to user choose from. Customers create their themes but are left with two options to restrict theme selection:

  • Disable entirely have only a custom one set as default
  • Have multiple custom themes, but they have to be displayed alongside all standard ones.

The third option, displaying only customer ones, was not possible… until now.

Disclaimer: This is a about an enhancement in INTEROP service, the backbone of all data gathered to make Fiori Launchpad work as we know it (tiles, catalogs, and a bunch of other things). Changing  that service blindly can screw really good your system Launchpad. Read carefully the instructions or ask for system backup before starting, one of them will surely help you in this journey.

Note: Those steps were initially done on 7.52 (ABAP Trial) and could be exactly replicated on an older system (7.40). Therefore this standard part is somewhat stable and the procedure should be the same or similar for other stack versions. Steps were done through SAPGUI for Java.

How did I find where to enhance?

The same way as any Fiori/UI5 application that you know nothing (Jon Snow): peek network traffic in browser developer console. All modern web applications communicate with one (or multiple) backend endpoint(s), and UI5 is no exception (OData / REST). You can find its name there.

Interop%20Service%20selected%20on%20Developer%20Console%20Network%20tab

INTEROP Service selected on Developer Console Network tab

Here we have path /sap/opu/odata/UI2/INTEROP/Themes. Reading a bit more about how developers implement OData services, you’ll find that SEGW projects commonly falls into /opu/odata/sap/ space, so this INTEROP should be a bit special and have a own handler class or, at least, one assigned. You can find it through SICF transaction.

Locating%20INTEROP%20path%20on%20SICF

Locating INTEROP path on SICF…

...and%20then%20locating%20its%20handler%20class.

…and then locating its handler class.

To debug or not to debug?

Not to debug, be clever. And then debug (cleverly).

We have a name, we have search tools, we have the premise that all new code are implemented in classes. Do the math. Open SE84 and search for it.

After%20searching%20by%20class%20name.%20Naming%20patterns%20plus%20good%20descriptions%20simplifies%20our%20work.

After searching by class name. Naming patterns plus good descriptions simplifies our work.

We have the class: /UI2/CL_EDM_DA_INTEROP_THM_00. You can either read its source code and locate, or help yourself with layer-aware debug.

Activating%20layer-aware%20debug%20to%20stop%20only%20in%20that%20class

Activating layer-aware debug to stop only in that class

Enhancement point spotted! Class constructor of class /UI2/CL_EDM_DA_INTEROP_THM_00. Just one implicit enhancement there and job is done.

Theme%20selection%20after%20enhancement%2C%20displaying%20only%20High%20Contrast%20themes

Theme selection after enhancement, displaying only High Contrast themes

 

I could happily finish here but I won’t. Let’s do this enhancement wise, a pluggable one to be quick to adapt whenever SAP decides to change standard code. Normal development would be with a new customer class wrapping company rules to restrict themes, but I did by creating a BAdI definition and calling it there, and only then implementing a customer class. Why? To share it with you!

You can download/install from git repo thalesvb/flponprem-themerestriction and all you need to do is implement a BAdI with your rules, the same way you do for standard code. Whenever SAP changes (or relocates) that code, git repo will (probably) be updated. You fetch that update for your system, and that’s it. No need to manually readapt code on your end.

This is not bulletproof, it is still possible to set any theme with URL parameters because that happens on Fiori Launchpad Javascript, before any call to backend. There is margin to disable this behavior, but that’s an excellent start for one horror story and I will not help you with it.

Now if you’ll just look right here…

%5BNeuralyzer%20sound%5D

[Neuralyzer sound]

2 Comments
You must be Logged on to comment or reply to a post.