cancel
Showing results for 
Search instead for 
Did you mean: 

Need a Function Module that converts the date into the nth. day of YEAR

Former Member
0 Kudos

Hi Guys.

I need a function module that converts the given date into the nth. day of the year. For example, if i give 02-Feb,2007 it will return 33. This function needs to be done vice versa so that the nth day can again be converted back to the date of the year.

Thanks a lot for your answers.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use thhe following FM.

<b>Create date = 1/1/2007 hard code it.

prdate = date you supply.

your o/p = day</b>CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'

EXPORTING

beg_da = creadate

end_da = prdate

IMPORTING

NO_DAY = day

  • NO_MONTH =

  • NO_YEAR =

no_cal_day = days

EXCEPTIONS

dateint_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

<i><b>regards

Debjani

Reward points for all helpful answer</b></i>

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi!

Try this:

DATA: gv_date LIKE sy-datum,

gv_year_start LIKE sy-datum,

gv_days TYPE i.

CONCATENATE sy-datum(4) '0101' TO gv_year_start.

CONCATENATE sy-datum(4) '0203' TO gv_date.

gv_days = gv_date - gv_year_start.

Regards

Tamás

Message was edited by:

Tamás Nyisztor

Former Member
0 Kudos

Hi,

This function module should solve your problem.

' RP_CALC_DATE_IN_INTERVAL'

Reward points if helpful.

alpesh_saparia3
Active Contributor
0 Kudos

Check function module- FIMA_DAYS_AND_MONTHS_AND_YEARS

<b>-Alpesh</b>