2007 Dec 17 9:29 AM
Hey everybody!
I´m writing my diploma thesis in the field of BW and I have to do a little time conversion.
I hav a date like "22.01.1980" in my source and two destination fields CALYEAR (YYYY) and CALMONTH (MM/YYYY like 01/1980).
What is the easiest way to convert the date with ABAP or is there a predefined function?
Thanks in advance!
Philipp
2007 Dec 17 9:37 AM
Hi,
REPORT ychatest.
DATA: int_datum LIKE sy-datum VALUE '20070705',
ext_datum(11) TYPE c.
CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
EXPORTING
input = int_datum
IMPORTING
output = ext_datum.
TRANSLATE ext_datum USING '.-'.
WRITE : ext_datum.
Regards,
Omkar.
2007 Dec 17 10:29 AM
Seems your requirement is you have input date in format "22.01.1980".
you need output as CALYEAR (YYYY) and CALMONTH (MM/YYYY like 01/1980).
Solution:
1. Call function module CONVERSION_EXIT_SDATE_INPUT, giving the input date in '22.01.1980' (current user format).
2. The function module will return the date in sy-datum format. ie, YYYYMMDD.
3. CALYEAR = returndate+0(4).
4. CALMONTH = returndate4(2) '/' returndate6(2).