Skip to Content
author's profile photo Former Member
Former Member

Dates and Intervals

Hi all,

1) I wish to attain the interval for a pair of dates (e.g. 20 Jan 2007 and 27 Jan 2007). It should result me with 7 days.

2) There is a given number of days (e.g. 3 days), and also a starting date (9 Feb 2007). It should result me with 14 Feb 2007 since 10 Feb and 11 Feb are non-working days. Is there any function module to perform the above?

Many thanks and regards,

Patrick

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Feb 27, 2007 at 11:04 AM

    1) Simple substraction would do.

    v_diff = date2 - date1. 'V-diff should be of int type.

    2)use the fm K_ABC_WORKDAYS_FOR_PERIODS_GET

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2007 at 11:04 AM

    Hi Patrick,

    1) Just define a variable of type i and subtract the two days.

    2) Use FM DATE_CONVERT_TO_FACTORYDATE

    DATA:

    zlv_days TYPE i,

    zlv_workday TYPE c.

    ev_date = iv_date.

    zlv_days = iv_days.

    WHILE zlv_days GT 0.

    ev_date = ev_date + 1.

    CLEAR:

    zlv_workday.

    CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'

    EXPORTING

    date = ev_date

    factory_calendar_id = iv_fabkl

    IMPORTING

    workingday_indicator = zlv_workday

    EXCEPTIONS

    calendar_buffer_not_loadable = 1

    correct_option_invalid = 2

    date_after_range = 3

    date_before_range = 4

    date_invalid = 5

    factory_calendar_not_found = 6

    OTHERS = 7.

    IF syst-subrc <> 0.

    EXIT.

    ENDIF.

    IF zlv_workday = space.

    SUBTRACT 1 FROM zlv_days.

    ENDIF.

    ENDWHILE.

    Regards,

    John.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2007 at 11:03 AM

    hi Patrik,

    Date :

    Date Conversion

    DATE_COMPUTE_DAY : Returns weekday for a date

    DATE_GET_WEEK : Returns week for a date

    DAY_ATTRIBUTES_GET : Returns attributes for a range of dates specified

    MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.

    END_OF_MONTH_DETERMINE_2 : Determines the End of a Month.

    HR_HK_DIFF_BT_2_DATES : Find the difference between two dates in years, months and days.

    FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.

    MONTH_NAMES_GET : Get the names of the month

    WEEK_GET_FIRST_DAY : Get the first day of the week

    HRGPBS_HESA_DATE_FORMAT : Format the date in dd/mm/yyyy format

    SD_CALC_DURATION_FROM_DATETIME : Find the difference between two date/time and report the difference in hours

    L_MC_TIME_DIFFERENCE : Find the time difference between two date/time

    HR_99S_INTERVAL_BETWEEN_DATES : Difference between two dates in days, weeks, months

    LAST_DAY_OF_MONTHS : Returns the last day of the month

    Regards,

    Santosh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2007 at 11:06 AM

    hi,

    use the following FM

    RP_CALC_DATE_IN_INTERVAL

    RP_LAST_DAY_OF_MONTHS

    SD_DATETIME_DIFFERENCE

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 28, 2007 at 12:05 AM

    Thanks dude!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.