Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Change leaves duration from hours to days in SAP Fiori app
In general, customizing Fiori applications involves customizing the parent SAP application. So, if in the application, it defaults to hours then the Fiori app will also inherit the default behavior and show it in hours.
Go ahead and change it to days, it will impact your Fiori app and the app will also start showing in days.
In case you cannot afford to make a change in SAP application, then you need to handle it in a custom manner which will require you to have a custom implementation in place.
Method 1: Backend Configuration Change
The most straightforward approach is to modify the time unit configuration in the SAP backend system. This change will automatically reflect in your Fiori application ?
* Navigate to SPRO > Employee Self-Service > Time Data * Go to Time Recording > Define Time Units * Change default unit from 'HUR' (Hours) to 'DAY' (Days) * Save and activate the configuration
Method 2: Custom Implementation
If backend changes are not feasible, implement a custom conversion logic in your Fiori application. This involves modifying the view controller to convert hours to days ?
// In your Fiori controller
convertHoursToDays: function(hours) {
var days = hours / 8; // Assuming 8-hour workday
return parseFloat(days.toFixed(2));
},
formatLeaveDisplay: function(value, unit) {
if (unit === "HUR") {
return this.convertHoursToDays(value) + " Days";
}
return value + " " + unit;
}
This custom approach requires modifications to both the data binding and display formatting logic in your Fiori application.
Conclusion
Changing leave duration from hours to days in SAP Fiori apps can be achieved through backend configuration changes or custom frontend implementation, depending on your system constraints and business requirements.
