I published this on my blog the other day and thought it might also be useful for other consultants or customers on the SCN, who want to overrule the standard behaviour of DEFTP in the time evaluation schema:
Most organisations have some policy in place to limit employees’ working time to a healthy maximum limit. Time evaluation in SAP HR PT provides for this in the standard schema TM00. Most people know about the constant TGMAX in table T511K, which is used in overtime generation rules “TOnn” in the standard schema as well as in limits set in table T559P and processed by the function LIMIT in the schema. But this is not the whole truth and will not always suffice, if you want to dynamically change the maximum daily working time.
TGMAX is in T511K for most country versions in SAP standard delivery (with some exceptions like Ireland). It can easily be replaced by a custom constant – often called ZGMAX – in the rules and tables. One best practise actually is, not to replace it with a constant, but with a time type. This gives you more flexibility to pick from different T511k-constants and apply further rules to influence the limit. Considering the opt-out flag for the European Working Time directive, which is available for the UK in the infotype 0016 screen, is only one of the business cases behind this technique.
However, changing T559P and the rules in the schema does not change the behaviour of function DEFTP, because it is hard-wired by SAP
- to use the max daily hours from the daily work schedule (T550A-SOMAX)
- or, if that field is empty, to use the value of TGMAX in T511k
So, you can change the value of SAP standard constant TGMAX defying SAP namespace, but any more complex rules to influence the maximum daily working time in DEFTP actually require a change in coding. We did this in some projects to allow for efficient and flexible use of the cap (or switching the cap off) using an implicit enhancement. As each case is bespoke to the customer’s requirements, we are not sharing any coding, because using it without understanding it is potentially dangerous. But if you want to go for it, the best point to get your enhancement in according to our experience is in include program RPTMAS02_GET_TGMAX at the end of the form GET_TGMAX.
Remember: depending on how you use the daily cap and how you work with attendance quotas, you may not even have to interfere at this point and can do everything later in the schema. But in some cases you just need DEFTP to work with a different max. number, most notably, when you want to pre-approve all overtime up to this limit automatically. That’s where this kind of solution comes in handy.
On a non-technical note:
I’ve seen many organisations investing a lot of effort to get their SAP HR or other T&A systems manage maximum working time and other working time issues. Sometimes, it seems HR is so focused on making the system perfect that they forget to look at the real world. To begin with: if an employee works 14 hours without a break, just capping it at 10 hours is still not complying with the European working time directive nor are the extra 4 hours less of a health and safety risk, just because they are unpaid. The system can provide you with data to monitor behaviour and support the process, but if you are asking yourself, who should manage employees’ working time (in many cases the most expensive resource in the organisation), the hint is in the name: it’s the line managers, who need to sit at the centre of the solution, supported by a transparent system and guidance from HR.