One way to throw custom messages while clicking on Record Working Time
Are there a lot of options to validate users when they click on the record working time link on the ESS and prevent their access to the timesheet under some specific custom conditions alone?
Unfortunately, all the exits that are available for CAT2 validations aren’t available here, as listed in the link http://wiki.scn.sap.com/wiki/display/ERPHCM/User-exits+in+CATS
So how do we force SAP to throw some custom exceptions and prevent the users from accessing the timesheet application? (In cases where validations on check/save will not suffice)
Here is one last resort:
The standard method CL_HRESS_AS_CATS->SET_EMPLOYEE_DETAILS gets invoked when the user tries to access the ESS timesheet. This method determines if the user is eligible to open the record working time application and if his PERNR setup is correct. If any error occurs, the standard catches an exception and opens a new window showing the error instead of opening the ESS timesheet application. Hence one way to put in custom validations is to perform an implicit enhancement within this method .
By carefully placing a proper try-catch statement and catching the exception of type CX_HRESS, the standard framework can be leveraged to pass custom messages. (Here the appropriate complex constant needs to be passed).