Pages

Sunday, April 4, 2010

Convert Date to external format

FORM date_to_external CHANGING p_input TYPE sy-datum
p_output TYPE char10.

IF p_input+4(2) GE '13'.
p_input+0(4) = p_input+0(4) + 1."Increment Year
ENDIF.

CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
date_internal = p_input
IMPORTING
date_external = p_output
EXCEPTIONS
date_internal_is_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
p_output = p_input.
ENDIF.


ENDFORM. " DATE_TO_EXTERNAL

Date FM: to get difference between 2 dates in different formats

* Check difference between Input Date and current date

*Program should pay attention to only the month and the year
************************************************************
CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
EXPORTING
begda = p_input_dt
endda = p_check_dt
* TAB_MODE = ' '
IMPORTING
* DAYS =
* C_WEEKS =
c_months = lv_months
c_years = lv_years
* WEEKS =
* MONTHS =
* YEARS =
* D_MONTHS =
* MONTH_TAB =
.