‎2006 Jul 13 6:48 AM
Hi All,
Please tell me is there any Function Module for the conversion of date formats??
My requirement is to get date in this format DD.MM.YYYY even when the user uses any XYZ format.
Thanks in Advance!!!
Seema.
‎2006 Jul 13 7:05 AM
Hi Seema,
Since your Date format is not decided(xyz format), I think you need to decide your approach.
To dispaly the Date form System Format to User Format the FM <b>'CONVERT_DATE_TO_EXTERNAL'</b> is used.
Consider this code.
REPORT zztest_arun_2.
DATA: e_date(10) type c VALUE '2/2/2006',
i_date(10).
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = e_date
IMPORTING
date_internal = i_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
WRITE : / 'CONVERT_DATE_TO_INTERNAL',
/ 'My Date:' , e_date ,
'Conv Date:', i_date.
skip 2.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = sy-datum
IMPORTING
DATE_EXTERNAL = e_date
EXCEPTIONS
DATE_INTERNAL_IS_INVALID = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE : / 'CONVERT_DATE_TO_EXTERNAL',
/ 'My Date:' , sy-datum,
'Conv Date:', e_date.
Regards,
Arun Sambargi.
‎2006 Jul 13 6:52 AM
‎2006 Jul 13 7:04 AM
hi,
or simply use command: write... to (using edit mask)
->look F1 to write to
A.
‎2006 Jul 13 6:56 AM
Hi,
U can use,
CONVERT_DATE_TO_EXTERNAL : Converts date from system storage format to users specified display format .
Also,
http://www.sapdevelopment.co.uk/fmodules/fmssap.htm
might help you.
‎2006 Jul 13 7:00 AM
Hi Seema,
I do not think that there will be any FM that will convert 'any XYZ format' to the date format DD.MM.YYYY.You first have to specify the date format that you want to change.
‎2006 Jul 13 7:05 AM
Hi Seema,
Since your Date format is not decided(xyz format), I think you need to decide your approach.
To dispaly the Date form System Format to User Format the FM <b>'CONVERT_DATE_TO_EXTERNAL'</b> is used.
Consider this code.
REPORT zztest_arun_2.
DATA: e_date(10) type c VALUE '2/2/2006',
i_date(10).
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = e_date
IMPORTING
date_internal = i_date
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
WRITE : / 'CONVERT_DATE_TO_INTERNAL',
/ 'My Date:' , e_date ,
'Conv Date:', i_date.
skip 2.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = sy-datum
IMPORTING
DATE_EXTERNAL = e_date
EXCEPTIONS
DATE_INTERNAL_IS_INVALID = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE : / 'CONVERT_DATE_TO_EXTERNAL',
/ 'My Date:' , sy-datum,
'Conv Date:', e_date.
Regards,
Arun Sambargi.