Skip to Content
avatar image
Former Member

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

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 22, 2007 at 11:37 AM

    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>

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 22, 2007 at 11:33 AM

    Check function module- FIMA_DAYS_AND_MONTHS_AND_YEARS

    <b>-Alpesh</b>

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 22, 2007 at 11:35 AM

    Hi,

    This function module should solve your problem.

    ' RP_CALC_DATE_IN_INTERVAL'

    Reward points if helpful.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 22, 2007 at 11:35 AM

    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

    Add comment
    10|10000 characters needed characters exceeded