Importing:
IM_DISPLAY TYPE CHAR1 - Display only? (no selection)
IM_ELPEI TYPE TPRG-PRGBZ (OPTIONAL) - External date type
Exporting:
EX_EEIND TYPE RVDAT-EXTDATUM - External date
EX_ELPEI TYPE TPRG-PRGBZ - External date type
FAILED - Failed
method f4_for_date.
data: l_eindt type workflds-gkday,
ls_tprg type tprg,
l_display type char1.
if im_display eq 'D'.
l_display = 'X'.
endif.
*- check date type
if im_elpei is initial.
ls_tprg-prgrs = '1'.
else.
select single * from tprg into ls_tprg
where spras eq sy-langu
and prgbz eq im_elpei.
if sy-subrc ne 0.
* message e346(v1) with e_lpein.
message s346(v1) with im_elpei.
raise failed.
endif.
endif.
*- call F4 for date
call function 'F4_DATE'
exporting
date_for_first_month = sy-datlo
display = l_display
importing
select_date = l_eindt
exceptions
others = 8.
if sy-subrc ne 0.
* message e845(06).
message s845(06).
raise failed.
endif.
*- Convert to external format
if not l_eindt is initial.
call function 'PERIOD_AND_DATE_CONVERT_OUTPUT'
exporting
internal_date = l_eindt
internal_period = ls_tprg-prgrs
importing
external_date = ex_eeind
external_period = ex_elpei.
endif.
endmethod.