‎2009 Jan 06 4:57 PM
Hello all,
I am having a legacy file in which the date format is yyddd ( e.g 07129 ).
Can any of you experts suggest me how can i convert these date format in SAP date format i.e YYYYMMDD.
Please suggest.
Arun
‎2009 Jan 06 5:57 PM
you would need to add the century to the legacy date somehow sto make it yyyyddd format atleast. then you can call SAP Fm to convert Julian date to YYYY-MM-DD format.
or check OIUH_PWFROMJULIANDT functioan module and write code yourself,
‎2009 Jan 06 5:58 PM
Hi, Arun
May be the following code will help you in this way,
data: date like sy-datum,
year(4),
month(2),
day(2).
year = '2006'.
month = '12'.
day = '01'.
date+0(4) = year.
date+4(2) = month.
date+6(2) = day.Replay if any problem,
Kind Regards,
Faisal
Edited by: Faisal Altaf on Jan 6, 2009 11:00 PM
‎2009 Jan 06 6:04 PM
Hi Arun date in that format is called Julian date format. check the link below:
[Need Func Mod that provides Julian Date|http://www.sapfans.com/forums/viewtopic.php?f=13&t=10077]
‎2009 Jan 06 6:53 PM
Hi,
Check this code..
REPORT ZTEST_NP.
PARAMETERS: P_JDATE(5) TYPE N DEFAULT '07129'.
DATA: P_DATE TYPE D,
L_YEAR TYPE N,
L_DATE TYPE D.
START-OF-SELECTION.
P_DATE+0(2) = '20'.
L_YEAR = P_JDATE+0(2) - 1.
P_DATE+2(2) = L_YEAR.
P_DATE+4(4) = '0000'.
L_DATE = P_DATE.
L_DATE+4(4) = '1231'.
P_DATE = L_DATE + P_JDATE+2(3).
WRITE: P_JDATE,
/ P_DATE.
Regards,
Omkaram.
‎2009 Jan 06 7:02 PM
Hi,
You can use RP_CALC_DATE_IN_INTERVAL function Module
Say for year 2007.....you need to give the start date as the first date of that year
i.e. 01/01/2007 (20070101 in sap format). And then add the days that you have in DDD field.
You can go in the loop as this function module only takes 99 days max that you can add at one go.
Hope this helps.
Regards,
Bharati
‎2009 Jan 08 8:04 PM