Application Development and Automation 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: 
Read only

Date Format

Former Member
0 Likes
810

Hi,

How to convert the Date format from MM/DD/YYYY to YYYYMMDD using Function module.I need Function module only for converting this date.Please give me some idea about this?

Regards,

AnuRaadha.

7 REPLIES 7
Read only

Former Member
0 Likes
748

hi ,

use fm DSVAS_FL_DATE_INT2EXT.

Message was edited by:

kasi raman

Read only

Former Member
0 Likes
748

Hi Anu

Use the following function module to convert into the required format:

CONVERSION_EXIT_IDATE_INPUT

PLZREWARD POINTS IF HELPFUL

Read only

Former Member
0 Likes
748

hi AnuvRaadha,

check the below code.... may be helpful for you

FORM check_date USING p_l_date

p_l_valid.

DATA:l_error,

date(8).

CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'

EXPORTING

datum = p_l_date

dtype = 'DATS'

IMPORTING

idate = date

error = l_error.

IF l_error = c_x.

p_l_valid = c_x.

ELSE.

p_l_date = date.

ENDIF.

*-In case the date is of the format '00000000'

IF p_l_date EQ c_date1.

CLEAR p_l_valid.

ENDIF.

ENDFORM. " CHECK_DATE

or check below....

The following statement will do your requirement without using function module.

L_ENDDATE = '12/17/2006'.

CONCATENATE L_ENDDATE6(4) L_ENDDATE0(2) L_ENDDATE+3(2) INTO gw_flatfile-zzenddate.

Now gw_flatfile-zzenddate will have 20061217.

or check below link for date conversion function module Anuraadha

http://www.geocities.com/victorav15/sapr3/abapfun.html

I got this info from the below link

~~Guduri

Read only

Former Member
0 Likes
748

Hi Anu,

Please refer the link,

Regards,

Hema.

    • Reward points if it is useful.

Read only

Former Member
0 Likes
748

Hi,

you can use:

CONVERT_DATE_TO_INTERNAL

Regards

Subramanian

Read only

0 Likes
748

refer this code , i don think u can convert MM/DD/YYYY to YYYYMMDD via Fm -

parameters p_date(10).

data d_date(8).

d_date0(4) = p_date6(4).

d_date4(2) = p_date0(2).

d_date6(2) = p_date3(2).

write: d_date.

Read only

Former Member
0 Likes
748

try this code .

data : idate(10) type c value '12/31/2006',

outdate type d,

outchar(8).

CALL FUNCTION 'DATE_STRING_CONVERT'

EXPORTING

DATE_FORMAT = '2'

DATE_STRING = idate

  • START_DATE = SY-DATUM

IMPORTING

RESULT_DATE = outdate

.

outchar = outdate.

write : / outchar.

here date_format = '2' is for your MM/DD/YYYY.

just check in table USR01-DATFM whether it is 2 for your case or not .

for me it is working fine with the above code.

regards

shiba dutta