ABAP Date Conversion - DD.MM.YYYY to YYYYMMDD - SAP Function Module
There are two function modules available in SAP but don't get confused.
1. CONVERSION_EXIT_PDATE_INPUT
2. CONVERSION_EXIT_SDATE_INPUT
In SAP both function module shows to be doing the same thing but that's not the case.
CONVERSION_EXIT_PDATE_INPUT
This FM should be used where there is a need to validate Date of Birth.
So this function module will no doubt convert the date from DD.MM.YYYY to YYYYMMDD, but only for past date.
CONVERSION_EXIT_SDATE_INPUT
This is the correct function module for date conversion from DD.MM.YYYY to YYYYMMDD.
Syntax:
DATA: lv_dd_mm_yyyy(10) type c,
lv_yyyymmdd type sy-datum.
CALL FUNCTION 'CONVERSION_EXIT_SDATE_INPUT'
EXPORTING
input = lv_dd_mm_yyyy
IMPORTING
output = lv_yyyymmdd.