2007 Jan 18 3:59 AM
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.
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
2007 Jan 18 4:04 AM
hi ,
use fm DSVAS_FL_DATE_INT2EXT.
Message was edited by:
kasi raman
2007 Jan 18 4:07 AM
Hi Anu
Use the following function module to convert into the required format:
CONVERSION_EXIT_IDATE_INPUT
PLZREWARD POINTS IF HELPFUL
2007 Jan 18 4:07 AM
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
2007 Jan 18 4:08 AM
2007 Jan 18 4:09 AM
2007 Jan 18 4:18 AM
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.
2007 Jan 18 4:50 AM
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
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |