2006 Jan 05 1:34 AM
Hi,
Does anyone know if there's a function module that converts a current date to a julian date?
Thanks!
Rob
2006 Jan 05 2:48 AM
Hi Robby,
I dont think there is a function module that does the conversion.. but you can use the following piece of code..
data: W_JULIAN_DATE(6).
PERFORM CONVERT_DATE_TO_YYDDD(RFFOGB_T) USING
SY-DATUM W_JULIAN_DATE.
write:/ W_JULIAN_DATE.
Regards,
Suresh Datti
2006 Jan 05 2:48 AM
Hi Robby,
I dont think there is a function module that does the conversion.. but you can use the following piece of code..
data: W_JULIAN_DATE(6).
PERFORM CONVERT_DATE_TO_YYDDD(RFFOGB_T) USING
SY-DATUM W_JULIAN_DATE.
write:/ W_JULIAN_DATE.
Regards,
Suresh Datti
2006 Jan 05 3:09 AM
Robby,
It is not a func mod... but it is pretty straight forward.
data: julian_day(3) type n,
date_aux type d,
date_I_need type d.
first day of the year
concatenate date_I_need(4) '0101' into date_aux.
julian_day = date_I_need - date_aux.
julian_day = julian_day + 1.
2006 Jan 05 3:13 PM
2006 Jan 05 3:17 PM
I know that you problem is already solved, but I had this code sample that I thought I might share. It uses a local class.
report zrich_0002 .
***********************************************************************
* CLASS lcl_julian_day DEFINITION
***********************************************************************
class lcl_julian_day definition.
public section.
types: t_juld(3) type n.
class-data:
julian_day type t_juld,
date type sy-datum.
class-methods:
get_julian_day importing im_date type sy-datum.
endclass.
parameters: p_date type sy-datum.
start-of-selection.
call method lcl_julian_day=>get_julian_day( p_date ).
write:/ lcl_julian_day=>date,
lcl_julian_day=>julian_day.
***********************************************************************
* CLASS lcl_julian_day IMPLEMENTATION
***********************************************************************
class lcl_julian_day implementation.
method get_julian_day.
date = im_date.
data: firstofyear type sy-datum value 'XXXX0101'.
replace 'XXXX' with date+0(4) into firstofyear.
julian_day = ( date - firstofyear ) + 1.
endmethod.
endclass.
Regards,
Rich Heilman