05-19-2008 8:23 AM
hi
split date.
i am a fresher plz help me with this...
i am getting date from legasy system in the format mmddyy.
before uploading this into sap i need transfer that into sap format.
can u plz give me the code for this...using split.
Thanks & regards,
khasimsa
05-19-2008 8:31 AM
Hi,
You can try any one of these :
You can use Below FM :
CONVERT_DATE_TO_INTERNAL
This FM will convert date as internal format,i mean depends on user profile.
-
DATA: date(8) TYPE c.
ur field <date1>is in mmddyyyy format.
concatenate date14(2) date10(2) date1+2(2) into date.
write date to necessary variable.
-
parameters:p_date type d.
data: v_date1 type d.
.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
DATE_EXTERNAL = p_date
IMPORTING
DATE_INTERNAL = v_date1.
write:/ v_date1.
-
CONCATENATE field+4(4) field(4) INTO l_date_internal.
-
just copy paste and run this code.
DATA:V_DATE1(10),
V_DATE(10).
V_DATE = '03032008'. "-----> format of mmddyyyy
concatenate V_DATE4(4) '.' V_DATE2(2)'.' V_DATE+0(2) into V_DATE1.
Write:V_DATE1. "-------> will be of the format yyyy.mm.dd
-
Hope this helps.
Reward Points if found helpfull..
Cheers,
Chandra Sekhar.
05-19-2008 8:28 AM
Hi
use concatenate
concatenate str56(2) str54(2) str5+0(4) into str8 separated by '.'.
this will give the date in ddmmyyyy format.
Rewards points if helpful
05-19-2008 8:31 AM
Hi,
You can try any one of these :
You can use Below FM :
CONVERT_DATE_TO_INTERNAL
This FM will convert date as internal format,i mean depends on user profile.
-
DATA: date(8) TYPE c.
ur field <date1>is in mmddyyyy format.
concatenate date14(2) date10(2) date1+2(2) into date.
write date to necessary variable.
-
parameters:p_date type d.
data: v_date1 type d.
.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
DATE_EXTERNAL = p_date
IMPORTING
DATE_INTERNAL = v_date1.
write:/ v_date1.
-
CONCATENATE field+4(4) field(4) INTO l_date_internal.
-
just copy paste and run this code.
DATA:V_DATE1(10),
V_DATE(10).
V_DATE = '03032008'. "-----> format of mmddyyyy
concatenate V_DATE4(4) '.' V_DATE2(2)'.' V_DATE+0(2) into V_DATE1.
Write:V_DATE1. "-------> will be of the format yyyy.mm.dd
-
Hope this helps.
Reward Points if found helpfull..
Cheers,
Chandra Sekhar.
05-19-2008 8:35 AM
05-19-2008 9:42 AM
05-19-2008 8:37 AM
Hi,
Use the below code.
data: v_char(6) value '051908',
v_year like WORKFLDS-YEARN,
v_date like sy-datum,
v_month like WORKFLDS-MONTH.
v_month = v_char+4(2).
CALL FUNCTION 'CONVERT_YEAR_WITH_THRESHOLD'
EXPORTING
INPUT = v_month
THRESHOLD = 50
IMPORTING
OUTPUT = v_year
.
concatenate v_year v_char+0(4) into v_date.
write:/ v_date.
05-19-2008 9:10 AM
Hi,
Check this sample code.
DATA: leg_date TYPE char8,
l_date TYPE sy-datum,
l_string TYPE char10.
leg_date = '051908'.
CONCATENATE '20' leg_date4(2) leg_date0(2) leg_date+2(2)
INTO l_string.
l_date = l_string.
WRITE: l_date.
Regards,
Ramkumar.K