‎2007 Feb 14 6:47 AM
Hi all,
Is there any fuction module to convert date of format YYYYMMDD to DDMMYYYY
or DD-MM-YYYY.
Thanks in advance.
‎2007 Feb 14 6:51 AM
<b>CONVERT_DATE_TO_EXTERNAL</b> Converts date from system storage format to users specified display format
Data: v_date(10) TYPE c.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = SY-DATUM
IMPORTING
DATE_EXTERNAL = v_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.Output:
02/14/2006
Refer this link
http://www.sap-img.com/abap/abap-program-output-of-date-format.htm
Message was edited by:
Judith Jessie Selvi
‎2007 Feb 14 6:49 AM
conversion_exit_pdate_output.
give the input as 20070214 " YYYYMMDD
and execute
check this.
regards,
vijay
‎2007 Feb 14 6:52 AM
1)data lv_date1 type sy-datum.
data lv_date2(12).
lv_date1 = '20070123'.
concatenate lv_date1+6(2) lv_date1+4(2) lv_date1+0(4) into lv_date2
separated by '-' .
2) data lv_date1 type sy-datum.
data lv_date2(12).
lv_date1 = '20070123'.
concatenate lv_date1+6(2) lv_date1+4(2) lv_date1+0(4) into lv_date2
separated by SPACE.
‎2007 Feb 14 6:51 AM
<b>CONVERT_DATE_TO_EXTERNAL</b> Converts date from system storage format to users specified display format
Data: v_date(10) TYPE c.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = SY-DATUM
IMPORTING
DATE_EXTERNAL = v_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.Output:
02/14/2006
Refer this link
http://www.sap-img.com/abap/abap-program-output-of-date-format.htm
Message was edited by:
Judith Jessie Selvi
‎2007 Feb 14 6:53 AM
Hi
Use the FM:
CONVERT_DATE_TO_EXTERNAL
Which converts the date to SAP format to User defined format.
Regards,
kumar
‎2007 Feb 14 6:53 AM
HI,
Use the FM:
<b>CONVERT_DATE_TO_EXTERNAL</b> Converts date from system storage format to users specified display format
Hope this helps.
Reward if helpful.
Regards,
Sipra
‎2007 Feb 14 6:59 AM
Hi,
Use this FM
CONVERSION_EXIT_PDATE_OUTPUT
enter the date as 20070214
the o/p will
as per ur systemt setting
regards
Shiva
‎2007 Feb 14 7:03 AM
‎2007 Feb 14 7:38 AM
hi alex,
1)
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.
2)
DATA: ld_date(10) type c.
ld_date = '28.10.1979'.
*Finds all occurences of first char(.) & replaces them with second(-)
TRANSLATE ld_date using '.-'.
*ld_date will now contain '28-10-1979'
3)
CONVERSION_EXIT_LDATE_OUTPUT Converts date format .
CONVERT_DATE_INPUT Conversion exit routine for inverted date
CONVERT_DATE_TO_EXTERNAL Formats date from internal to display format
CONVERT_DATE_TO_INTERNAL Formats date from display to internal format
Regards,
Bijal