<< Start-Of-Selection
*&---------------------------------------------------------------------*
*& Form GET_NEXT_LAST_WORKING_DAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_P_DATE text
* <--P_GV_NDATE text
*----------------------------------------------------------------------*
form get_next_last_working_day using pa_date changing p_nendd.
clear gi_holi[].
data :
lv_date type sy-datum,
lv_numdy type numdy,
lv_endd type sy-datum.
call function 'DETERMINE_END_OF_MONTH'
exporting
i_datum = pa_date
importing
* E_KZ_ULT =
e_tt = lv_numdy
.
lv_endd = p_date.
lv_endd+6(2) = lv_numdy.
do.
call function 'HOLIDAY_GET'
exporting
holiday_calendar = 'T1'
factory_calendar = 'T1'
date_from = lv_endd
date_to = lv_endd
* IMPORTING
* YEAR_OF_VALID_FROM =
* YEAR_OF_VALID_TO =
* RETURNCODE =
tables
holidays = gi_holi
exceptions
factory_calendar_not_found = 1
holiday_calendar_not_found = 2
date_has_invalid_format = 3
date_inconsistency = 4
others = 5
.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
read table gi_holi with key date = lv_endd.
* FREEDAY = 'X'
* HOLIDAY = 'X'.
if sy-subrc eq 0.
lv_endd = lv_endd - 1.
else.
p_nendd = lv_endd.
exit.
endif.
endif.
enddo.
p_nendd = p_nendd + 1.
endform. " GET_NEXT_LAST_WORKING_DAY
<< Start-Of-Selection
ไม่มีความคิดเห็น:
แสดงความคิดเห็น