11-22-2007 8:09 AM
Hi Abapers,
I need a FM which can convert date: YYYYMMDD to MM/DD/YYYY.
I have used the FM '/SAPDII/SPP05_CONVERT_DATE' to achieve this. but the problem is it doesnt handle exceptions. so it may lead to dump in some scenarios. kindly suggest me some Fm which can handle exceptions too.
Regards,
Radhika.
11-22-2007 8:12 AM
11-22-2007 8:15 AM
Hi Prem,
Do like this
YYYYMMDD to MM/DD/YYYY
Data: date1 type sy-datum,
date2(10) type c.
Date1 = sy-datum. " This will be in YYYYMMDD format
Concatenate date1+4(2) date1+6(2) + date1+0(4) into date2 seperated by '/'.
write date2.
<b>Reward Points if this helps,</b>
Satish
11-22-2007 8:16 AM
hi
may this will help u..
data: gd_date(10). "field to store output date
Converts SAP date from 20020901 to 01.09.2002
write sy-datum to gd_date dd/mm/yyyy.
Converts SAP date from 20020901 to 01.09.02
write sy-datum to gd_date dd/mm/yy.
Prarthan
11-22-2007 8:27 AM
Hi,
Try this FM
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
date_internal = lv_date
IMPORTING
date_external = lv_date1
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.
Regards,
Prashant
11-23-2007 1:27 PM
to convert yyyymmdd to dd.mm.yyyy
data : wa1 type sy-datum,
wa2(10).
concatenate wa1+6(2)'.'
wa1+4(2)'.'
wa1(4) into wa2.