cancel
Showing results for 
Search instead for 
Did you mean: 

HCM_CATS_V1_B_TS_VALIDATION

Annelies_Schill
Participant
0 Kudos
61

Hi all

We want to limit the maximum number of hours per day or per week in the "manage my timesheet" app, using the BAdI HCM_CATS_V1_B_TS_VALIDATION. 

Once you do a Save & Submit, the time entries are written to the database. Then when you then add new time entries, internal table "timeentries" only contains these new time entries - not those time entries already saved to the database. 

Example: you enter a time entry for 6:30 then Submit (time entries will contain just this one record). Then enter a further time entry for 2:30 and Submit (again timeentries will contain just this one record). So, there will be no error message for exceeded hours.

To meet our business requirement, the custom logic needs to be enhanced to also check for existing time entries on the database and adding these to the calculation of lv_totalhours. For this you can use CDS View I_TIMESHEETRECORD and read records based on PERNR / WORKDATE.

Does anyone have example coding for this scenario? And how can you involve the maximum number of hours that was maintained in the "manage workforce" app for a certain user? 

In the post https://community.sap.com/t5/enterprise-resource-planning-q-a/badi-hcm-cats-v1-b-ts-validation/qaq-p... is mentioned that BAdI HCM_CATS_V1_B_TS_VALIDATION checks and validates only the duration of the last single timesheet entry. It was planned for release 2005 (Q2/2020) the BAdI will be enhanced to check and validate against all the timesheet entries for the day. Anyone who knows if this is done or when this will be enabled? 

Thanks! 

Best regards, 
Annelies

View Entire Topic
raymond_giuseppi
Active Contributor
0 Kudos

You should check in your version : Is the TIMEENTRIES table parameter active and used?

*-- Important Note:
*-- This BAdI is called once for each TIMEENTRY, so your validation checks should be based on madatory parameter - TIMEENTRY.
*-- Use optional parameter - TIMEENTRIES only in cases where the currently processing timeentry has dependency on other timeentrties which are posted along with it.
*-- Example : Multiple Time Entries submitted by the user on a day should not exceed the target hours of the day.