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

function module to find no of days between two dates

hi everybody i want a function module to find no of days between two dates

Add a comment
10|10000 characters needed characters exceeded

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2007 at 06:35 PM

    Hi. You can use function module HR_99S_INTERVAL_BETWEEN_DATES. If you just want the number of days, you can use code like below:

    DATA ws_begin_date type sy-datum.

    DATA ws_end_date type sy-datum.

    DATA days_between type i.

    CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

    EXPORTING

    begda = ws_begin_date

    endda = ws_end_date

    IMPORTING

    days = days_between.

    I hope this helps.

    - April King

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2007 at 07:05 AM

    HR_HK_DIFF_BT_2_DATES check this FM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2007 at 07:08 AM

    /SDF/CMO_DATETIME_DIFFERENCE

    check this

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 19, 2007 at 07:10 AM

    Refer the FMs -

    SD_DATETIME_DIFFERENCE

    C14B_DIFF_BT_2_DATES

    But easiest is -

    data: v_dat type dats,

    v_dat1 type dats,

    v_int type I.

    v_dat = sy-datum.

    v_dat1 = sy-datum - 10.

    v_int = v_dat - v_dat1.

    write: v_int.

    Regards,

    Amit

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2007 at 08:11 AM

    Function module /SDF/CMO_DATETIME_DIFFERENCE

    Uppercase/Lowercase

    Runtime: 59,629 Microseconds

    Import parameters Value

    DATE1 01.01.2007

    TIME1 00:00:00

    DATE2 31.12.2007

    TIME2 00:00:00

    Export parameters Value

    DATEDIFF 364 TIMEDIFF 0

    EARLIEST 1

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 26, 2014 at 06:43 AM

    Hi Ankit,

    You can use following function moduled to get number of days:

    1. CONVERT_DATE_TO_INTERNAL- Used to convert DD.MM.YYYY format date to YYYYMMDD format

    2. HR_99S_INTERVAL_BETWEEN_DATES- Used to get days where input date should be in YYYYMMDD format.

    Regards,

    Sudeesh Soni


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 18, 2016 at 09:26 AM

    Try FM WFCS_FCAL_WDAYS_GET_S

    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.