Note : this post was also published on SAP Community Blogs. Click here to view it there.
I often get the question from clients asking if SAP provides ESS on-behalf-of MSS functionality as a standard functionality. Customers want the possibility to have a manager enter a leave request for their employees (for example blue collar workers that don’t have access to a PC). The answer to the question is often simple… No. SAP says that Fiori is simple to use and available on mobile so accessible by everybody, but it’s not always so straightforward.
I got the same question recently from my customer where Time Administrators fill in the timesheets of their employees (CATS). Luckily there is still the possibility to develop custom functionality! Part of the solution was briefly explained in my previous blog : SAP Fiori : how to update an Application Title with Dynamic Content
Previous mentioned blog only explains how to update the title of the application, in this blog we will look more into the complete setup of the “on-behalf-of” CATS solution in Fiori.
OData to get the employee list
I designed an OData project that will retrieve employees based on a certain scenario. The idea here is to get different lists based on the application. A custom report might show the direct subordinates of a manager while the custom Timesheet application has to show the employees for which the current user is the Time Administrator.
A custom table was setup to define the class and method that is called per scenario (the employee list oData is used by multiple applications).
UI5 application to show the employee list
The next step is showing the employees to the users which will be done in a UI5 application built from scratch. This application will use the employee OData and show the results in a smart table (Smart Table Example).
When the user clicks on a row we trigger the navigation to the extended My Timesheet application by passing the personnel number that was selected. To achieve this the following code was added to the manifest.json file:
With the crossNavigation property “toCats” we can trigger the Timesheet~change semanticObject which will execute the navigation to the actual Timesheet application. 3 parameters are available where PersonnelNumber is of course the most important one.
When the user clicks on an employee the following function will provoke the “toCats” navigation:
The semanticObject navigation has to be maintained in order to trigger the link to the extended Timesheet application:
extended UI5 application of standard My Timesheet (version 2)
The enhanced Timesheet application was heavily adapted but in this blog I’ll focus on the interaction between the 2 applications. The following picture shows the result of clicking on a certain employee:
You can see that the standard title is changed to “Timesheet – Name of selected employee” and that a panel was added with details of the selected employee.
The personnel number is read via the following code in the onAfterRendering function:
extended OData to remove standard checks
For different requirements I already had to enhance the standard OData service of My Timesheet, but I had to create redefinitions of almost all the standard methods to enable ESS in MSS. The reason for this is that in standard, SAP always checks if the personnel number is connected to the current logged-on user. As it is clear this is not the case in our scenario, I had to remove the following piece of code in my custom class multiple times:
Should you want to implement the same functionality as I did, be sure that you add security since a clever person can change the parameter of the personnel number in the URL. One option is to catch this and route to an error page as shown below and explained here: Step 3: Catch Invalid Hashes and Message Page Example
A lot of development time was invested into the dynamic employee selection OData service, but we re-use this service in multiple application providing Managers and Administrators with all kind of applications like Timesheet on-behalf-of but also custom reports and more.