How to Restrict an Employee from Overbooking the time in S4HANA Cloud for

Professional Services

Introduction

You are a professional services organization, Implementing S4HANA Cloud for professional services. You have following business requirements.

1.    How to restrict employee from time recording, when his/her required hours were reduced in a project or What if the demand for the activity was reduced from earlier requested?

2.    How to restrict employee from overbooking the time.

Either of the above requirements you’re aware of that SAP standard S4HANA solution doesn’t support. So, you should have a custom validation in system to control.

How Does SAP Support

As a customer/Partner you might be thinking, S4HANA Cloud as the product is rigid when comes to customizations/enhancements.It’s not always true. SAP has provided options to explore by the customer/partner when comes to custom requirements in S4HANA Cloud.

I will list down below SAP functionalities that are available to explore in S4HANA Cloud.

1.    In-App Extensibility

2.    Side – by – Side Extensibility

Standard Process

 In a customer Project, Project Manager planned for ‘x’ No of hours efforts for a project role. Resource manager proposes and confirms an employee based on the planned effort. Either one or multiple resources based on availability/request.

 

Employee logs in to S4HANA System to record the time for the work he/she has completed.

To Record time, Employee must have access to “Manage My Timesheet” Fiori App.

Note: If Employee Doesn’t find App in his/her home screen, assign role (SAP_BR_EMPLOYEE) to his/her business user.

Once employee access the App, he/she will see following information.

1.    List of projects that they have been assigned and valid on that day/week along with non-project related tasks.

 

 

 

Custom Requirement

Due to various reasons, Project Manager reduced number of Planned hours (Efforts) for one of the Resource.

Or

Due to Various reasons, the resource has left the project/deboarded from the project activity.

(Scenario Where one Work Package with Multiple Work Items and resources assigned. In this Case, you can’t reduce the timelines (St.Date & En.Date) of the Work package)

In either of above mentioned cases, the resource still have access to  project and he/she can use“ Manage my Timesheet” Fiori app to record the time against the Project/Work item as long as the duration of the Work Package is active as on date when he/she records the time or can go to previous month’s to access the project details and book the time. Application doesn’t stop him/her from recording time. This is the flexibility the application has provided.

However, this is not the ideal situation for most of the professional services organizations. Hence, SAP has provided BAdIs as part of standard activation of Scope Item -J12 (Time Management for Project Based Services) to maintain custom validation as an In-App Extensibility.

 Following are the list of BAdIs available for Time Management

1.    HCM: Timesheet Approver Determination

2.    HCM: Timesheet Validations

3.    HCM: Timesheet Subcontractor Services

I’m not going to explain about each BAdI here, Instead, I can tell you what BAdI is useful for our scenario.

BAdI: HCM: Timesheet Validations

You can use this BAdIs (Business Add-in) to write customized validations on the Timesheet Entry to improve or streamline the process

Activate following Custom validation when Employee Records the time and SAVE & SUBMIT.

If an employee records the time, SAVE & SUBMIT for Project Manager’s approval, the BAdI Timesheet Validation triggers custom code to check whether an employee is recorded more than planned efforts. If the recorded efforts for that Month are less than or equals to planned efforts for that month, then the BAdI logic allows to SUBMIT the record for Project Manager’s Approval. If the validation fails, it triggers an error message and restrict employee from SAVING the time record.

 

Below is the Sample Code to activate above Validation.

 

 

CDS View: i_resourceassignmentplanitem

 

** Actual Hours should not be greater than planned hours

 

SELECT PLNDEFFORTQTY FROM i_resourceassignmentplanitem

INTO @DATA(lv_planned)

WHERE EMPLOYMENTINTERNALID = @timeentry-personworkagreement AND WORKPACKAGE = @timeentry-wbselement.

    IF timeentry-recordedhours > lv_planned.

    error_message = 'Recorded Hours are more than planned hours' && lv_planned.

    RETURN.

    ENDIF.

ENDSELECT.

 

To Write this piece of code, you should have access to following Fiori APP.

 

If you haven’t found this app in your home page of you S4HANA Cloud, Please assign the following business role to the Business user.


Business Role:
SAP_BR_ADMINISTRATOR

 

 

Once you have access to this App, you can go Custom Logic tab to activate the BAdI.

 

 

Code maintained for this BAdI

 

 

Testing the BAdI

 

  Let us see how this BAdI influence the behavior of the application before and after the BAdI Implementation.

Scenario 1 – Restrict Overtime Booking

Once the resource assigned and confirmed for “X” number of planned hours by the project manager,

The Resource can book the time against the project in “Manage My Timesheet” fiori app.

 

Before BAdI Implementation

 

In general, the standard solution doesn’t stop the employee from overbooking the time against the project. This is not the bug; it is the flexibility the application has provided to the customer.

 

Here, in the above screenshot, the resource was planned for 5 Hrs for the task/work item to complete. However, when employee books the time more than planned hours (in this case 6Hrs) the application doesn’t stop him from the submitting the time for project manager’s approval.

After BAdI Implementation

 

If the above mentioned BAdI is implemented with the logic that I have mentioned above, the system doesn’t allow the resource to record the time more than planned hours.

Here in the above screen shot, the resource was planned for 3hrs to work on the activity/work item. However, when the resource records the time for 4hrs which is more than the planned to submit for the approval, the BAdI gets triggered immediately to validate the entries and raises an exception with error message by not allowing him/her to submit for approval.

 

Scenario 2 – Restrict Time Recording

 

The same check can also be helpful in case an employee is deboarded from the project or the numbers of planned hours for task for which he/she is working on were reduced from earlier planned.

Here in this below example, the employee was assigned for an activity planned for 10Hrs.

The employee has recorded the time for 6hrs and approved by the Project Manager.

Now due to various reasons, the employee left the project,

Before BAdI Implementation

 

You may have following options to consider; however, those options do not stop the employee from recording the time.

1. Reduce the validity of the work package and No of Planned Hours,

 

 

Now, if resource books the time, system doesn’t stop him/her from time booking

 

 

Though, the project manager reduced the Planned hours and work package validity, the system allows employee to record the time against the project work item/activity.

2. Project Manager may think he/she can unassign the resource from the project. However, the system does not allow project manager to unassign the resource as time posting records were existed.

After BAdI Implementation

 

The BAdI restricts the employee from time booking in either of the above cases listed in scenario 2 as it always checks recorded hours against planned hours before submitting the timesheet.

 

Conclusion:

 

          Above-mentioned scenarios were not the product gaps, it’s the flexibility which was given in the application to cater different requirements for the “Professional Services” customers.

However, for few customers they need certain validations. These validations may differ from customer to customer. To support those custom validation, SAP has provided BAdIs as part of In -App extensibility.