Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

fuction module

Former Member
0 Kudos

Hi all,

Is there any fuction module to convert date of format YYYYMMDD to DDMMYYYY

or DD-MM-YYYY.

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

<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

8 REPLIES 8

Former Member
0 Kudos

conversion_exit_pdate_output.

give the input as 20070214 " YYYYMMDD

and execute

check this.

regards,

vijay

0 Kudos
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.

Former Member
0 Kudos

<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

sreeramkumar_madisetty
Active Contributor
0 Kudos

Hi

Use the FM:

CONVERT_DATE_TO_EXTERNAL

Which converts the date to SAP format to User defined format.

Regards,

kumar

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Use this FM

CONVERSION_EXIT_PDATE_OUTPUT

enter the date as 20070214

the o/p will

as per ur systemt setting

regards

Shiva

Former Member
0 Kudos

Hi Alex,

use FM -- <b>CY_CONVERT_DATE</b>

reward if useful.

Former Member
0 Kudos

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