Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
TheGokke
Active Participant
Hello and welcome to my first blog at SCN, I hope it will be useful to some of you.

As you know, Fiori applications are created to be simple so they are aimed to be used by normal end-users. However at the client I am currently working for, they want to use CATS (My Timesheet version 2) and give this application to a Time administrator who will fill in the timesheet of their assigned employees.

Next to a dozen of other required modifications, one of them is quite easy to achieve and will be the topic of this post: Updating the header title of the application with dynamic content.

 

The title is usually set in the manifest with a hardcoded value that links to a description in the i18n files as shown here:



 

The standard Fiori application for CATS has "My Timesheet" as title which is shown in the image below:



As the administrators won't be filling in their time sheet but the one of the employee they selected in the previous screen, they want to have the employee's name in the title.

 

After some searching on the web, a touch of OData extension, some trial and error and some praying, it was achieved in the following (quite easy) way:

 

  1. Include the shell service in the manifest file 

  2. Update the title in an overwritten method of the view (method initializeView in my case)
    		//Set employee info in title
    var oInfo = this.oConfiguration.getInitialInfoModel();
    if (oInfo.Pernr) {
    this.getOwnerComponent().getService("ShellUIService").then( // promise is returned
    function (oService) {
    var sTitle = that.getView().getModel("i18n").getResourceBundle().getText("TIMESHEET_TITLE") + oInfo.EmployeeName;
    oService.setTitle(sTitle);
    },
    function (oError) {
    jQuery.sap.log.error("Cannot get ShellUIService", oError, "XXXXXXXXX.hr.MyTimesheet");
    }
    );
    }​



The result is shown like this (along with the modification of the standard legend colors which was a different requirement):



 

Enjoy trying it out yourself and feel free to post questions in case of problems/doubts/...
7 Comments
Labels in this area