Time Management-2 for Absence combinations
METHOD if_ex_hrpad00infty~after_input.
IF new_innnn-infty EQ '2001'.
DATA : lt_p2001 TYPE STANDARD TABLE OF p2001.
DATA : lx_p2001 TYPE p2001.
DATA : ls_p2001 TYPE p2001.
DATA : lv_date TYPE datum.
DATA : lv_fdat TYPE datum.
DATA badi_message_handler TYPE REF TO cl_hrpa_message_list.
DATA message_handler TYPE REF TO if_hrpa_message_handler.
DATA msg TYPE symsg.
DATA is_ok TYPE boole_d.
DATA pernr_tab TYPE STANDARD TABLE OF pdpnr.
DATA pernr TYPE pdpnr.
DATA psp TYPE STANDARD TABLE OF pdpsp.
DATA day_psp TYPE STANDARD TABLE OF pdsppsp.
DATA lwa_day_psp TYPE pdpsp.
CREATE OBJECT badi_message_handler.
message_handler = badi_message_handler.
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = new_innnn
IMPORTING
pnnnn = ls_p2001.
* "" Get Emp Group for Validation
lv_date = ls_p2001-begda - 1.
lv_fdat = ls_p2001-begda + 1.
IF pernr_tab IS INITIAL .
pernr-pernr = ls_p2001-pernr.
APPEND pernr TO pernr_tab.
CLEAR pernr.
ENDIF.
CALL FUNCTION 'HR_PERSON_READ_WORK_SCHEDULE'
EXPORTING
begin_date = ls_p2001-begda
end_date = ls_p2001-endda
TABLES
pernr_tab = pernr_tab
psp = psp
day_psp = day_psp.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
* TCLAS = 'A'
pernr = new_innnn-pernr
infty = '2001'
* begda = lv_date
* endda = lv_date
TABLES
infty_tab = lt_p2001
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
DATA lv_btime TYPE begti.
IF sy-subrc = 0.
LOOP AT lt_p2001 INTO lx_p2001.
* " Check For Previous Day Absence
IF lv_date BETWEEN
lx_p2001-begda AND lx_p2001-endda OR
lv_fdat BETWEEN
lx_p2001-begda AND lx_p2001-endda.
* " For Regular Employees
IF i503-konty = 1 .
* " Rectriction For Earned Leave Reg, Half Pay Leave
IF lx_p2001-subty = 'ERNO' OR
lx_p2001-subty = 'HPAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'CHCL' OR
lx_p2001-subty = 'CMLL'.
IF ( lx_p2001-subty = 'ERNO' OR
lx_p2001-subty = 'HPAL' OR
lx_p2001-subty = 'CMLL' ) AND ls_p2001-stdaz LT 7.
IF ls_p2001-subty = 'CASL'.
READ TABLE psp INTO lwa_day_psp WITH KEY datum = ls_p2001-begda.
IF sy-subrc = 0.
IF lwa_day_psp-begzt+0(2) GE 21.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 4.
ELSE.
lv_btime+0(2) = lwa_day_psp-begzt+0(2) + 04.
ENDIF.
CONCATENATE lv_btime+0(2) lwa_day_psp-begzt+2(4) INTO lv_btime.
* IF lwa_day_psp-endzt GE ls_p2001-enduz.
* ELSE
IF ( lv_btime = ls_p2001-enduz ) OR ( ls_p2001-enduz BETWEEN lv_btime AND ls_p2001-enduz ).
IF ls_p2001-enduz GE lwa_day_psp-endzt.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '046'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* ENDIF.
ENDIF.
ENDIF.
ELSE.
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'OSTR' OR "ls_p2001-subty = 'CHCL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'NRAL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
** condition for 1st day CHCL and second day UNAL not allowed (27.04.2015)
if ( lx_p2001-subty = 'CHCL' ) OR ( lx_p2001-subty = 'NRAL' ).
IF LS_P2001-subty = 'UNAL'.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* "Casual Leave- Regular
IF lx_p2001-subty = 'CASL'.
IF ls_p2001-subty = 'CASL'
AND ls_p2001-stdaz LT 7.
READ TABLE psp INTO lwa_day_psp WITH KEY datum = ls_p2001-begda.
IF sy-subrc = 0.
IF lwa_day_psp-begzt+0(2) GE 21.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 4.
ELSE.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 04.
ENDIF.
IF ls_p2001-beguz BETWEEN lv_btime AND ls_p2001-enduz.
* msg-msgid = 'ZHR'."'YHBN'.
* msg-msgty = 'E'.
* msg-msgno = '046'.
*
* CALL METHOD message_handler->add_message
* EXPORTING
* message = msg
* cause = message_handler->unknown.
* is_ok = space.
*
* badi_message_handler->add_messages( message_handler ).
* RAISE error_with_message.
* EXIT.
ENDIF.
ENDIF.
ELSE.
IF ls_p2001-subty = 'CASL' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'STTL' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'DOFF' OR
ls_p2001-subty = 'OT2A' OR
ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'OSTR' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
* "" Extra Ordinary Leave
IF lx_p2001-subty = 'EORO'.
IF lx_p2001-subty = 'EORO'
AND ls_p2001-stdaz LT 7.
IF ls_p2001-subty = 'CASL'.
READ TABLE psp INTO lwa_day_psp WITH KEY datum = ls_p2001-begda.
IF sy-subrc = 0.
IF lwa_day_psp-begzt+0(2) GE 21.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 4.
ELSE.
lv_btime+0(2) = lwa_day_psp-begzt+0(2) + 04.
ENDIF.
CONCATENATE lv_btime+0(2) lwa_day_psp-begzt+2(4) INTO lv_btime.
* IF lwa_day_psp-endzt GE ls_p2001-enduz.
* ELSE
IF ( lv_btime = ls_p2001-enduz ) OR ( ls_p2001-enduz BETWEEN lv_btime AND ls_p2001-enduz ).
IF ls_p2001-enduz GE lwa_day_psp-endzt.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '046'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
IF ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'ERNO' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
* "" Special Casual Leave
IF lx_p2001-subty = 'SCAL'.
IF ls_p2001-subty = 'CASL' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'OT2A' OR
ls_p2001-subty = 'CMLL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* "" Special Disability Leave
IF lx_p2001-subty = 'SPDL'.
IF lx_p2001-subty = 'SPDL'
AND ls_p2001-stdaz LT 7.
IF ls_p2001-subty = 'CASL'.
READ TABLE psp INTO lwa_day_psp WITH KEY datum = ls_p2001-begda.
IF sy-subrc = 0.
IF lwa_day_psp-begzt+0(2) GE 21.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 4.
ELSE.
lv_btime+0(2) = lwa_day_psp-begzt+0(2) + 04.
ENDIF.
CONCATENATE lv_btime+0(2) lwa_day_psp-begzt+2(4) INTO lv_btime.
* IF lwa_day_psp-endzt GE ls_p2001-enduz.
* ELSE
IF ( lv_btime = ls_p2001-enduz ) OR ( ls_p2001-enduz BETWEEN lv_btime AND ls_p2001-enduz ).
IF ls_p2001-enduz GE lwa_day_psp-endzt.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '046'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
IF ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'HPAL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
* "" Settling time leave
IF lx_p2001-subty = 'STTL'.
IF ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'DOFF' OR
ls_p2001-subty = 'OT2A' OR
ls_p2001-subty = 'NRAL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*COFF Compensatory Off
*DOFF Dharma OFF
IF lx_p2001-subty = 'COFF' OR
lx_p2001-subty = 'DOFF' OR
lx_p2001-subty = 'RESL' .
IF ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'CASL' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'DOFF' OR
ls_p2001-subty = 'OT2A' OR
ls_p2001-subty = 'RESL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*MATL Maternity Leave
IF lx_p2001-subty = 'MATL'.
IF lx_p2001-subty = 'MATL'
AND ls_p2001-stdaz LT 7.
IF ls_p2001-subty = 'CASL'.
READ TABLE psp INTO lwa_day_psp WITH KEY datum = ls_p2001-begda.
IF sy-subrc = 0.
IF lwa_day_psp-begzt+0(2) GE 21.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 4.
ELSE.
lv_btime+0(2) = lwa_day_psp-begzt+0(2) + 04.
ENDIF.
CONCATENATE lv_btime+0(2) lwa_day_psp-begzt+2(4) INTO lv_btime.
* IF lwa_day_psp-endzt GE ls_p2001-enduz.
* ELSE
IF ( lv_btime = ls_p2001-enduz ) OR ( ls_p2001-enduz BETWEEN lv_btime AND ls_p2001-enduz ).
IF ls_p2001-enduz GE lwa_day_psp-endzt.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '046'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'METR' OR
ls_p2001-subty = 'MEDT' OR
ls_p2001-subty = 'MEDL' OR
ls_p2001-subty = 'NRAL' .
ELSE.
msg-msgid = 'ZHR'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
*NRAL NR Absence
IF lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' .
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'SDYL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space
.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
**********************************************************************
* FOR Employee Group D Absence Type 2
* Leave Restriction For Labour Confirmation
**********************************************************************
ELSEIF i503-konty = 2.
* ERNL Earned Leave- Reg Labour
* MEDL Medi Leave- Confirm Labour
* SPDL Special Disability Leave
* MATL Maternity Leave
* NRAL NR Absence
* UNAL Unauthorised Absence
* OSTR On Strike
* EORO Extra Ordinary Leave
IF lx_p2001-subty = 'ERNL' OR
lx_p2001-subty = 'SPDL' OR
lx_p2001-subty = 'MATL' OR
lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'EORO' OR
lx_p2001-subty = 'MEDL' .
IF ls_p2001-subty = 'ERNL' OR
ls_p2001-subty = 'MEDL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*COFF Compensatory Off
*DOFF Dharma OFF
IF lx_p2001-subty = 'COFF' OR
lx_p2001-subty = 'DOFF' OR
lx_p2001-subty = 'SCAL' OR
lx_p2001-subty = 'CSLL' .
IF ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'CSLL' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'DOFF' OR
ls_p2001-subty = 'OT2A'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* Employee Sub Group 4
ELSEIF i503-konty = 4 .
" Rectriction For Earned Leave Reg, Half Pay Leave
IF lx_p2001-subty = 'ELPR' OR
lx_p2001-subty = 'HPAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'CHCL' OR
lx_p2001-subty = 'CMLL' .
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'ELPR' OR
ls_p2001-subty = 'NRAL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* Casual Leave- Regular
IF lx_p2001-subty = 'CSRP'.
IF ls_p2001-subty = 'CSRP' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'STTL' OR
ls_p2001-subty = 'SACL' OR
ls_p2001-subty = 'OSTR' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* "" Extra Ordinary Leave
IF lx_p2001-subty = 'EORO'.
IF ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'ERNO' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* "" Special Casual Leave
IF lx_p2001-subty = 'SCAL'.
IF ls_p2001-subty = 'CSRP' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'CMLL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* Special Disability Leave
IF lx_p2001-subty = 'SPDL'.
IF ls_p2001-subty = 'ERPR' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'HPAL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* "" Settling time leave
IF lx_p2001-subty = 'STTL'.
IF ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'NRAL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*COFF Compensatory Off
*DOFF Dharma OFF
IF lx_p2001-subty = 'DOFF' OR
lx_p2001-subty = 'RESL' .
IF ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'CSRP' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'RESL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*MATL Maternity Leave
IF lx_p2001-subty = 'MATL' .
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'ELPR' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'NRAL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*NRAL NR Absence
IF lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' .
.
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'ELPR' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'SDYL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ELSEIF i503-konty = 6.
* NRAL NR Absence
IF lx_p2001-subty = 'METR' OR
lx_p2001-subty = 'EORO' OR
lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'MATL'.
IF ( lx_p2001-subty = 'METR' OR
lx_p2001-subty = 'EORO' OR
lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'MATL' ) AND ls_p2001-stdaz LT 7.
ELSE.
IF ls_p2001-subty = 'METR' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'OSTR'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
IF lx_p2001-subty = 'CSRT' OR
lx_p2001-subty = 'COFF'.
IF ls_p2001-subty = 'CSRT' OR
ls_p2001-subty = 'COFF' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* Absence Combination Restriction For Trainee Labours
ELSEIF i503-konty = 5.
*MEDT Medi Leave- Labour Trainee
*EORO Extra Ordinary Leave
*MATL Maternity Leave
*MTPL MTP Leave
*UNAL Unauthorised Absence
*OSTR On Strike
IF lx_p2001-subty = 'MEDT' OR
lx_p2001-subty = 'EORO' OR
lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'MATL' OR
lx_p2001-subty = 'SPDL' OR
lx_p2001-subty = 'MTPL'.
IF ls_p2001-subty = 'MEDT' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'OSTR'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
IF lx_p2001-subty = 'CSLT' OR
lx_p2001-subty = 'COFF'.
IF ls_p2001-subty = 'CSLT' OR
ls_p2001-subty = 'COFF' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF. " Check For Absence Type
ENDIF. "" Check For Dates
ENDLOOP.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD if_ex_hrpad00infty~after_input.
IF new_innnn-infty EQ '2001'.
DATA : lt_p2001 TYPE STANDARD TABLE OF p2001.
DATA : lx_p2001 TYPE p2001.
DATA : ls_p2001 TYPE p2001.
DATA : lv_date TYPE datum.
DATA : lv_fdat TYPE datum.
DATA badi_message_handler TYPE REF TO cl_hrpa_message_list.
DATA message_handler TYPE REF TO if_hrpa_message_handler.
DATA msg TYPE symsg.
DATA is_ok TYPE boole_d.
DATA pernr_tab TYPE STANDARD TABLE OF pdpnr.
DATA pernr TYPE pdpnr.
DATA psp TYPE STANDARD TABLE OF pdpsp.
DATA day_psp TYPE STANDARD TABLE OF pdsppsp.
DATA lwa_day_psp TYPE pdpsp.
CREATE OBJECT badi_message_handler.
message_handler = badi_message_handler.
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = new_innnn
IMPORTING
pnnnn = ls_p2001.
* "" Get Emp Group for Validation
lv_date = ls_p2001-begda - 1.
lv_fdat = ls_p2001-begda + 1.
IF pernr_tab IS INITIAL .
pernr-pernr = ls_p2001-pernr.
APPEND pernr TO pernr_tab.
CLEAR pernr.
ENDIF.
CALL FUNCTION 'HR_PERSON_READ_WORK_SCHEDULE'
EXPORTING
begin_date = ls_p2001-begda
end_date = ls_p2001-endda
TABLES
pernr_tab = pernr_tab
psp = psp
day_psp = day_psp.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
* TCLAS = 'A'
pernr = new_innnn-pernr
infty = '2001'
* begda = lv_date
* endda = lv_date
TABLES
infty_tab = lt_p2001
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
DATA lv_btime TYPE begti.
IF sy-subrc = 0.
LOOP AT lt_p2001 INTO lx_p2001.
* " Check For Previous Day Absence
IF lv_date BETWEEN
lx_p2001-begda AND lx_p2001-endda OR
lv_fdat BETWEEN
lx_p2001-begda AND lx_p2001-endda.
* " For Regular Employees
IF i503-konty = 1 .
* " Rectriction For Earned Leave Reg, Half Pay Leave
IF lx_p2001-subty = 'ERNO' OR
lx_p2001-subty = 'HPAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'CHCL' OR
lx_p2001-subty = 'CMLL'.
IF ( lx_p2001-subty = 'ERNO' OR
lx_p2001-subty = 'HPAL' OR
lx_p2001-subty = 'CMLL' ) AND ls_p2001-stdaz LT 7.
IF ls_p2001-subty = 'CASL'.
READ TABLE psp INTO lwa_day_psp WITH KEY datum = ls_p2001-begda.
IF sy-subrc = 0.
IF lwa_day_psp-begzt+0(2) GE 21.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 4.
ELSE.
lv_btime+0(2) = lwa_day_psp-begzt+0(2) + 04.
ENDIF.
CONCATENATE lv_btime+0(2) lwa_day_psp-begzt+2(4) INTO lv_btime.
* IF lwa_day_psp-endzt GE ls_p2001-enduz.
* ELSE
IF ( lv_btime = ls_p2001-enduz ) OR ( ls_p2001-enduz BETWEEN lv_btime AND ls_p2001-enduz ).
IF ls_p2001-enduz GE lwa_day_psp-endzt.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '046'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* ENDIF.
ENDIF.
ENDIF.
ELSE.
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'OSTR' OR "ls_p2001-subty = 'CHCL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'NRAL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
** condition for 1st day CHCL and second day UNAL not allowed (27.04.2015)
if ( lx_p2001-subty = 'CHCL' ) OR ( lx_p2001-subty = 'NRAL' ).
IF LS_P2001-subty = 'UNAL'.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* "Casual Leave- Regular
IF lx_p2001-subty = 'CASL'.
IF ls_p2001-subty = 'CASL'
AND ls_p2001-stdaz LT 7.
READ TABLE psp INTO lwa_day_psp WITH KEY datum = ls_p2001-begda.
IF sy-subrc = 0.
IF lwa_day_psp-begzt+0(2) GE 21.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 4.
ELSE.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 04.
ENDIF.
IF ls_p2001-beguz BETWEEN lv_btime AND ls_p2001-enduz.
* msg-msgid = 'ZHR'."'YHBN'.
* msg-msgty = 'E'.
* msg-msgno = '046'.
*
* CALL METHOD message_handler->add_message
* EXPORTING
* message = msg
* cause = message_handler->unknown.
* is_ok = space.
*
* badi_message_handler->add_messages( message_handler ).
* RAISE error_with_message.
* EXIT.
ENDIF.
ENDIF.
ELSE.
IF ls_p2001-subty = 'CASL' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'STTL' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'DOFF' OR
ls_p2001-subty = 'OT2A' OR
ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'OSTR' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
* "" Extra Ordinary Leave
IF lx_p2001-subty = 'EORO'.
IF lx_p2001-subty = 'EORO'
AND ls_p2001-stdaz LT 7.
IF ls_p2001-subty = 'CASL'.
READ TABLE psp INTO lwa_day_psp WITH KEY datum = ls_p2001-begda.
IF sy-subrc = 0.
IF lwa_day_psp-begzt+0(2) GE 21.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 4.
ELSE.
lv_btime+0(2) = lwa_day_psp-begzt+0(2) + 04.
ENDIF.
CONCATENATE lv_btime+0(2) lwa_day_psp-begzt+2(4) INTO lv_btime.
* IF lwa_day_psp-endzt GE ls_p2001-enduz.
* ELSE
IF ( lv_btime = ls_p2001-enduz ) OR ( ls_p2001-enduz BETWEEN lv_btime AND ls_p2001-enduz ).
IF ls_p2001-enduz GE lwa_day_psp-endzt.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '046'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
IF ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'ERNO' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
* "" Special Casual Leave
IF lx_p2001-subty = 'SCAL'.
IF ls_p2001-subty = 'CASL' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'OT2A' OR
ls_p2001-subty = 'CMLL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* "" Special Disability Leave
IF lx_p2001-subty = 'SPDL'.
IF lx_p2001-subty = 'SPDL'
AND ls_p2001-stdaz LT 7.
IF ls_p2001-subty = 'CASL'.
READ TABLE psp INTO lwa_day_psp WITH KEY datum = ls_p2001-begda.
IF sy-subrc = 0.
IF lwa_day_psp-begzt+0(2) GE 21.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 4.
ELSE.
lv_btime+0(2) = lwa_day_psp-begzt+0(2) + 04.
ENDIF.
CONCATENATE lv_btime+0(2) lwa_day_psp-begzt+2(4) INTO lv_btime.
* IF lwa_day_psp-endzt GE ls_p2001-enduz.
* ELSE
IF ( lv_btime = ls_p2001-enduz ) OR ( ls_p2001-enduz BETWEEN lv_btime AND ls_p2001-enduz ).
IF ls_p2001-enduz GE lwa_day_psp-endzt.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '046'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
IF ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'HPAL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
* "" Settling time leave
IF lx_p2001-subty = 'STTL'.
IF ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'DOFF' OR
ls_p2001-subty = 'OT2A' OR
ls_p2001-subty = 'NRAL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*COFF Compensatory Off
*DOFF Dharma OFF
IF lx_p2001-subty = 'COFF' OR
lx_p2001-subty = 'DOFF' OR
lx_p2001-subty = 'RESL' .
IF ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'CASL' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'DOFF' OR
ls_p2001-subty = 'OT2A' OR
ls_p2001-subty = 'RESL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*MATL Maternity Leave
IF lx_p2001-subty = 'MATL'.
IF lx_p2001-subty = 'MATL'
AND ls_p2001-stdaz LT 7.
IF ls_p2001-subty = 'CASL'.
READ TABLE psp INTO lwa_day_psp WITH KEY datum = ls_p2001-begda.
IF sy-subrc = 0.
IF lwa_day_psp-begzt+0(2) GE 21.
lv_btime+0(2) = lwa_day_psp-endzt+0(2) - 4.
ELSE.
lv_btime+0(2) = lwa_day_psp-begzt+0(2) + 04.
ENDIF.
CONCATENATE lv_btime+0(2) lwa_day_psp-begzt+2(4) INTO lv_btime.
* IF lwa_day_psp-endzt GE ls_p2001-enduz.
* ELSE
IF ( lv_btime = ls_p2001-enduz ) OR ( ls_p2001-enduz BETWEEN lv_btime AND ls_p2001-enduz ).
IF ls_p2001-enduz GE lwa_day_psp-endzt.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '046'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ELSE.
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'METR' OR
ls_p2001-subty = 'MEDT' OR
ls_p2001-subty = 'MEDL' OR
ls_p2001-subty = 'NRAL' .
ELSE.
msg-msgid = 'ZHR'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
*NRAL NR Absence
IF lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' .
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'SDYL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space
.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
**********************************************************************
* FOR Employee Group D Absence Type 2
* Leave Restriction For Labour Confirmation
**********************************************************************
ELSEIF i503-konty = 2.
* ERNL Earned Leave- Reg Labour
* MEDL Medi Leave- Confirm Labour
* SPDL Special Disability Leave
* MATL Maternity Leave
* NRAL NR Absence
* UNAL Unauthorised Absence
* OSTR On Strike
* EORO Extra Ordinary Leave
IF lx_p2001-subty = 'ERNL' OR
lx_p2001-subty = 'SPDL' OR
lx_p2001-subty = 'MATL' OR
lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'EORO' OR
lx_p2001-subty = 'MEDL' .
IF ls_p2001-subty = 'ERNL' OR
ls_p2001-subty = 'MEDL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*COFF Compensatory Off
*DOFF Dharma OFF
IF lx_p2001-subty = 'COFF' OR
lx_p2001-subty = 'DOFF' OR
lx_p2001-subty = 'SCAL' OR
lx_p2001-subty = 'CSLL' .
IF ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'CSLL' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'DOFF' OR
ls_p2001-subty = 'OT2A'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* Employee Sub Group 4
ELSEIF i503-konty = 4 .
" Rectriction For Earned Leave Reg, Half Pay Leave
IF lx_p2001-subty = 'ELPR' OR
lx_p2001-subty = 'HPAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'CHCL' OR
lx_p2001-subty = 'CMLL' .
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'ELPR' OR
ls_p2001-subty = 'NRAL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* Casual Leave- Regular
IF lx_p2001-subty = 'CSRP'.
IF ls_p2001-subty = 'CSRP' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'STTL' OR
ls_p2001-subty = 'SACL' OR
ls_p2001-subty = 'OSTR' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* "" Extra Ordinary Leave
IF lx_p2001-subty = 'EORO'.
IF ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'ERNO' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* "" Special Casual Leave
IF lx_p2001-subty = 'SCAL'.
IF ls_p2001-subty = 'CSRP' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'ERNO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'CMLL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* Special Disability Leave
IF lx_p2001-subty = 'SPDL'.
IF ls_p2001-subty = 'ERPR' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'HPAL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* "" Settling time leave
IF lx_p2001-subty = 'STTL'.
IF ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'OSTR' OR
ls_p2001-subty = 'RESL' OR
ls_p2001-subty = 'NRAL'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*COFF Compensatory Off
*DOFF Dharma OFF
IF lx_p2001-subty = 'DOFF' OR
lx_p2001-subty = 'RESL' .
IF ls_p2001-subty = 'COFF' OR
ls_p2001-subty = 'CSRP' OR
ls_p2001-subty = 'SCAL' OR
ls_p2001-subty = 'RESL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*MATL Maternity Leave
IF lx_p2001-subty = 'MATL' .
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'ELPR' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'NRAL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
*NRAL NR Absence
IF lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' .
.
IF ls_p2001-subty = 'CMLL' OR
ls_p2001-subty = 'ELPR' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'HPAL' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'SDYL' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ELSEIF i503-konty = 6.
* NRAL NR Absence
IF lx_p2001-subty = 'METR' OR
lx_p2001-subty = 'EORO' OR
lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'MATL'.
IF ( lx_p2001-subty = 'METR' OR
lx_p2001-subty = 'EORO' OR
lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'MATL' ) AND ls_p2001-stdaz LT 7.
ELSE.
IF ls_p2001-subty = 'METR' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'OSTR'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF.
IF lx_p2001-subty = 'CSRT' OR
lx_p2001-subty = 'COFF'.
IF ls_p2001-subty = 'CSRT' OR
ls_p2001-subty = 'COFF' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
* Absence Combination Restriction For Trainee Labours
ELSEIF i503-konty = 5.
*MEDT Medi Leave- Labour Trainee
*EORO Extra Ordinary Leave
*MATL Maternity Leave
*MTPL MTP Leave
*UNAL Unauthorised Absence
*OSTR On Strike
IF lx_p2001-subty = 'MEDT' OR
lx_p2001-subty = 'EORO' OR
lx_p2001-subty = 'NRAL' OR
lx_p2001-subty = 'UNAL' OR
lx_p2001-subty = 'OSTR' OR
lx_p2001-subty = 'MATL' OR
lx_p2001-subty = 'SPDL' OR
lx_p2001-subty = 'MTPL'.
IF ls_p2001-subty = 'MEDT' OR
ls_p2001-subty = 'EORO' OR
ls_p2001-subty = 'MATL' OR
ls_p2001-subty = 'NRAL' OR
ls_p2001-subty = 'UNAL' OR
ls_p2001-subty = 'SPDL' OR
ls_p2001-subty = 'OSTR'.
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
IF lx_p2001-subty = 'CSLT' OR
lx_p2001-subty = 'COFF'.
IF ls_p2001-subty = 'CSLT' OR
ls_p2001-subty = 'COFF' .
ELSE.
msg-msgid = 'ZHR'."'YHBN'.
msg-msgty = 'E'.
msg-msgno = '031'.
CALL METHOD message_handler->add_message
EXPORTING
message = msg
cause = message_handler->unknown.
is_ok = space.
badi_message_handler->add_messages( message_handler ).
RAISE error_with_message.
EXIT.
ENDIF.
ENDIF.
ENDIF. " Check For Absence Type
ENDIF. "" Check For Dates
ENDLOOP.
ENDIF.
ENDIF.
ENDMETHOD.