Adding Items to the User Preferences Dialog Box in Fiori Launchpad
Requirement: I had a requirement of adding a custom fied on the UserSettings of fiori launchpad and I was wondering how can I achieve it . Then I found a link documentation link provided by SAP and started working on it .
In general , the link says that we need use the Semantic object as a Shell and configure this on the admin URL of the Fiori Launchpad.
I started to do it by creating a sample SAP UI5 Application and with no views and controllers in it . Then I opened the Component.js and found that we need to extend only the faceless components i,e sap.ui.core.Component .
SAPUI5 provides faceless components for services that deliver data from the back end system, UI components that extend components and add rendering functionality.
As we are using a Shell Plugin , component which acts as shell plug-in is a plain component, not a UIComponent.
Faceless components (class: sap.ui.core.Component )
Use sap.ui.core.Component in Component.js file and extend it .
Using the API sap.ushell.renderers.fiori2 add code in Component.js file to add the Custom Plant Field .
In onInit() of Lifecycle method add the below code
var oRenderer = sap.ushell.Container.getRenderer("fiori2");
var oEntry = {
title: "title",
value: function() {
return jQuery.Deferred().resolve("entryTitleToBeDisplayed");
},
content: function() {
return jQuery.Deferred().resolve(new sap.m.Button("userPrefEntryButton", {text: "Button"}));
},
onSave: function() {
return jQuery.Deferred().resolve();
}
};
oRenderer.addUserPreferencesEntry(oEntry);
Above Code is for Adding a button in the user preferences dialog box .
Deploy the Application .
FLP Configuration.(Refer other blogs for FLP configuration)
(i) Go to lpd_cust Transaction Create a Role.
(ii) Go to /n/UI2/SEMOBJ_SAP Transaction and check for “Shell” Semantic object .
(If you do not find this, go to the /n/ui2/semobj Transaction )
(iii) Add “Shell” Semantic Object .
Go to the Admin URL under Catalog , add a Static Tile and do the Target Mapping and Tile Configuration as in the per below screen shots.
(Click on tile and do the config as per Screen Shot )
Tile Config :
Target Mapping :
Since the Semantic object is of “Shell” Type , we cannot see this as a tile even thought we have taken as a Static Tile .
We are done .
Go to Fiori Launchpad and Check the User Preferences Dialog Box you can see the Custom field added .
On Clicking the title we get a button on the next view .
Reference Links :
In addition to that, you can also add the button to the launchpad menu or to the launchpad header with the renderer.
User menu = oRenderer.addUserPreferencesEntry(oEntry)
Launchpad menu = oRenderer.addActionButton(oEntry);
Launchpad header = oRenderer.addHeaderEndItem(oEntry);
Hi ,
It is a nice blog . Is it possible to hide an item from the user Preference list. I didn't find any method for the same .
Any help is much appreciated.
Thanks
Ritushree
Hi Srikar Nagadevara,
Thanks for sharing you knowledge, i would like to know to how to implement in HANA as backend system.
Could you please help me.
i have create FLP.compext package has component.js file and added you code Snippet into init function but when i tried to create a tile with target mapping i am seeing different UI.
static tile
Target Mapping
Could you please help me to understand?
Thanks,
Sachin