*----------------------------------------------------------------------* * INCLUDE ZXPBEU29 - HR_BEN_CALC_CUTOFF_SAL * *----------------------------------------------------------------------* ************************************************************************ * Author: Clay Molinari * CREATED FOR HR EXPERT JULY 2004 ISSUE * READERS ARE GRANTED RIGHTS TO USE THIS CODE AS IS OR TO * EXPLOIT THE CODE IN ANY MANNER. THE AUTHOR DOES NOT EXTEND * ANY WARRANTY AS TO THE RELIABILITY OF THIS CODE. IT IS * PROVIDED AS AN ILLUSTRATION ONLY. * Date: 05/29/2004 * Purpose: This user exit overrides the standard benefit salary cutoff * calculation. * * Normal salary cutoff is July 1 of the preceding year. The salary * cutoff can be moved forward of that date for several reasons. The * cutoff date will be the last date on which any of these things * happened. * 1) The EE was not hired until after that date. * 2) The EE changed between exempt and non-exempt after that date. * 3) The EE retired. ************************************************************************ if _cutoff_month is initial or _cutoff_day is initial. raise customer_error. endif. if _cutoff_month lt 1 or _cutoff_month gt 12. raise customer_error. endif. if _cutoff_day lt 1 or _cutoff_day gt 31. raise customer_error. endif. ** start with the cutoff month and day of last year. This varries from ** standard SAP when the evaluation date falls on or after the cutoff ** month and day. _sal_cutoff(4) = _datum(4) - 1. _sal_cutoff+4(2) = _cutoff_month. _sal_cutoff+6(2) = _cutoff_day. * STEP 1) PROPOSED SALARY DATE CANNOT BE EARLIER THAN EARLIEST IT0008 * THIS IS FOR NEW HIRES. clear i0008. refresh i0008. perform read_infotype(sapfp50p) using _pernr '0008' space space space _sal_cutoff _datum '1' 'NOP' i0008. if sy-subrc ne 0. clear _sal_cutoff. raise customer_error. endif. if i0008-begda gt _sal_cutoff. _sal_cutoff = i0008-begda. endif. * 3) SALARY CUTOFF MUST BE THE MOST RECENT CHANGE BETWEEN * EXEMPT AND NON-EXEMPT * * read all IT0001 records from cutoff date to evaluation date clear i0001. refresh i0001. call function 'HR_READ_INFOTYPE' exporting * TCLAS = 'A' pernr = _pernr infty = '0001' begda = _sal_cutoff endda = _datum importing subrc = l_subrc tables infty_tab = i0001 exceptions infty_not_found = 1 others = 2. if sy-subrc ne 0 or l_subrc ne 0. raise customer_error. endif. * CHECK TO SEE IF EE IS CURRENTLY RETIRED sort i0001 by endda descending. read table i0001 index 1. if i0001-persg EQ 'R'. " EE group 'R' is retired * get all IT0001 records to search back to last active status clear i0001. refresh i0001. call function 'HR_READ_INFOTYPE' exporting * TCLAS = 'A' pernr = _pernr infty = '0001' begda = '19000101' endda = _datum importing subrc = l_subrc tables infty_tab = i0001 exceptions infty_not_found = 1 others = 2. if sy-subrc ne 0 or l_subrc ne 0. raise customer_error. endif. sort i0001 by endda descending. * CUTOFF DATE MUST BE LAST DAY ACTIVE clear: active_date, old_position, new_position. loop at i0001. if active_date is initial. active_date = i0001-begda. if i0001-persg eq 'R'. newposition = 'RT'. endif. endif. if i0001-persg eq 'R'. oldposition = 'RT'. endif. if old_position ne 'RT' and new_position eq 'RT'. active_date = i0001-endda. exit. endif. new_position = old_position. endloop. _sal_cutoff = active_date. " LAST DAY BEFORE RETIREMENT else. * EE IS ACTIVE. LOCATE LAST EXEMPT/NON-EXEMPT CHANGE sort i0001 by endda. clear: chg_date, old_position, new_position. loop at i0001. if chg_date is initial. chg_date = i0001-begda. if i0001-persg eq 'E'. "EXEMPT oldposition = 'EX'. else. oldposition = 'NX'. endif. endif. if i0001-persg eq 'E'. "EXEMPT newposition = 'EX'. else. newposition = 'NX'. endif. if old_position ne new_position. chg_date = i0001-begda. endif. endloop. if chg_date gt _sal_cutoff. _sal_cutoff = chg_date. endif. endif.