<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Difference between dates in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029926#M716600</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chaaya ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can find the &amp;lt;b&amp;gt;number of working days&amp;lt;/b&amp;gt; using the Fm "WDKAL_DATE_ADD_FKDAYS".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward If Useful.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chitra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Nov 2007 09:04:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-12T09:04:25Z</dc:date>
    <item>
      <title>Difference between dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029922#M716596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi can anyone psl give me code for the below reqiremet&lt;/P&gt;&lt;P&gt;if i give a date range i need the diff between that dates excluding non-working days so by using FM DATE_CHECK_WORKINGDAY any pls help me&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 08:29:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029922#M716596</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T08:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029923#M716597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form BILLING_DAY_IS_WORKING_DAY&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Using the date passed in next_date, verify that the date is&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;a working day in the factory calendar the user specifies. This form&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;calls the standard ABAP function for determining if a date is a&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;"working day". The function first determines if the day of the week&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;corresponding to the calendar date entered is a billing day. Then&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;it checks to see if the calendar date is a holiday. If either are&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;true the date_no_workingday flag is passed back as "X" and this&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;routine passes back "X" to the calling routine in the parameter&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;p_billing_flag.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM CURRENT_DAY_IS_WORKING_DAY USING P_NEXT_DATE TYPE D&lt;/P&gt;&lt;P&gt;CHANGING P_NOT_BILLING_DAY TYPE C.&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;DATE = P_NEXT_DATE&lt;/P&gt;&lt;P&gt;FACTORY_CALENDAR_ID = FACTCALD&lt;/P&gt;&lt;P&gt;MESSAGE_TYPE = 'I'&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;DATE_AFTER_RANGE = 1&lt;/P&gt;&lt;P&gt;DATE_BEFORE_RANGE = 2&lt;/P&gt;&lt;P&gt;DATE_INVALID = 3&lt;/P&gt;&lt;P&gt;DATE_NO_WORKINGDAY = 4&lt;/P&gt;&lt;P&gt;FACTORY_CALENDAR_NOT_FOUND = 5&lt;/P&gt;&lt;P&gt;MESSAGE_TYPE_INVALID = 6&lt;/P&gt;&lt;P&gt;OTHERS = 7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE SY-SUBRC.&lt;/P&gt;&lt;P&gt;WHEN '0'.&lt;/P&gt;&lt;P&gt;CLEAR P_NOT_BILLING_DAY.&lt;/P&gt;&lt;P&gt;WHEN '4'.&lt;/P&gt;&lt;P&gt;IF SY-DATUM &amp;gt; CURRENT_BDATE.&lt;/P&gt;&lt;P&gt;P_NOT_BILLING_DAY = SPACE.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;P_NOT_BILLING_DAY = 'X'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;WHEN OTHERS.&lt;/P&gt;&lt;P&gt;CONCATENATE: 'Error Accessing Calendar with ID: ' FACTCALD&lt;/P&gt;&lt;P&gt;INTO ZZMSG_TAB2.&lt;/P&gt;&lt;P&gt;APPEND ZZMSG_TAB2.&lt;/P&gt;&lt;P&gt;CLEAR ZZMSG_TAB2.&lt;/P&gt;&lt;P&gt;V_LEVEL = 'E'.&lt;/P&gt;&lt;P&gt;PERFORM F_ERROR_MESSAGE.&lt;/P&gt;&lt;P&gt;MESSAGE E305 WITH FACTCALD.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;ENDFORM. " BILLING_DAY_IS_WORKING_DAY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form BILLING_DAY_IS_WORKING_DAY&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Using the date passed in next_date, verify that the date is&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;a working day in the factory calendar the user specifies. This form&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;calls the standard ABAP function for determining if a date is a&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;"working day". The function first determines if the day of the week&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;corresponding to the calendar date entered is a billing day. Then&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;it checks to see if the calendar date is a holiday. If either are&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;true the date_no_workingday flag is passed back as "X" and this&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;routine passes back "X" to the calling routine in the parameter&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;p_billing_flag.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM BILLING_DAY_IS_WORKING_DAY USING P_NEXT_DATE TYPE D&lt;/P&gt;&lt;P&gt;CHANGING P_NOT_BILLING_DAY TYPE C.&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'DATE_CHECK_WORKINGDAY'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;DATE = P_NEXT_DATE&lt;/P&gt;&lt;P&gt;FACTORY_CALENDAR_ID = FACTCALD&lt;/P&gt;&lt;P&gt;MESSAGE_TYPE = 'I'&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;DATE_AFTER_RANGE = 1&lt;/P&gt;&lt;P&gt;DATE_BEFORE_RANGE = 2&lt;/P&gt;&lt;P&gt;DATE_INVALID = 3&lt;/P&gt;&lt;P&gt;DATE_NO_WORKINGDAY = 4&lt;/P&gt;&lt;P&gt;FACTORY_CALENDAR_NOT_FOUND = 5&lt;/P&gt;&lt;P&gt;MESSAGE_TYPE_INVALID = 6&lt;/P&gt;&lt;P&gt;OTHERS = 7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE SY-SUBRC.&lt;/P&gt;&lt;P&gt;WHEN '0'.&lt;/P&gt;&lt;P&gt;CLEAR P_NOT_BILLING_DAY.&lt;/P&gt;&lt;P&gt;WHEN '4'.&lt;/P&gt;&lt;P&gt;P_NOT_BILLING_DAY = 'X'.&lt;/P&gt;&lt;P&gt;WHEN OTHERS.&lt;/P&gt;&lt;P&gt;CONCATENATE: 'Error Accessing Calendar with ID: ' FACTCALD&lt;/P&gt;&lt;P&gt;INTO ZZMSG_TAB2.&lt;/P&gt;&lt;P&gt;APPEND ZZMSG_TAB2.&lt;/P&gt;&lt;P&gt;CLEAR ZZMSG_TAB2.&lt;/P&gt;&lt;P&gt;V_LEVEL = 'E'.&lt;/P&gt;&lt;P&gt;PERFORM F_ERROR_MESSAGE.&lt;/P&gt;&lt;P&gt;MESSAGE E305 WITH FACTCALD.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;ENDFORM. " BILLING_DAY_IS_WORKING_DAY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="427242"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="404226"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="401368"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 08:39:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029923#M716597</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T08:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029924#M716598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use the following code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:startdate like sy-datum,&lt;/P&gt;&lt;P&gt;        enddate like sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no_of_dates = (enddate -  startdate) - noofnonworking days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use the FM for getting the noofnonworking dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward me the points if you find this will solve your purpose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 08:42:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029924#M716598</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T08:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029925#M716599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;is there any FM for finding the noof nonworking days between dates&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 08:56:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029925#M716599</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T08:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029926#M716600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chaaya ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can find the &amp;lt;b&amp;gt;number of working days&amp;lt;/b&amp;gt; using the Fm "WDKAL_DATE_ADD_FKDAYS".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward If Useful.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chitra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 09:04:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029926#M716600</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T09:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029927#M716601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;I wrote small program to find diff between working days and non working days...&lt;/P&gt;&lt;P&gt;...because in your case you must use Factory calendar so better option is &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATE_CHECK_WORKINGDAY.

check this..

DATA : date LIKE  scal-date.
SELECT-OPTIONS : s_date FOR sy-datum.
DATA: non_work_days TYPE i,
      work_days TYPE i,
      tot_days TYPE i.

CHECK s_date-high IS NOT INITIAL .
date = s_date-low.
DO.
  ADD 1 TO tot_days.
  CHECK date IN s_date.
  IF sy-subrc NE 0.
    EXIT.
  ENDIF.
  CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
    EXPORTING
      date                       = date
      factory_calendar_id        = 'VC'  "your factory calendar id
      message_type               = 'S'
    EXCEPTIONS
      date_after_range           = 1
      date_before_range          = 2
      date_invalid               = 3
      date_no_workingday         = 4
      factory_calendar_not_found = 5
      message_type_invalid       = 6
      OTHERS                     = 7.
  IF sy-subrc &amp;lt;&amp;gt; 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    ADD 1 TO work_days.
  ENDIF.
  date = date + 1.
ENDDO.
non_work_days = tot_days - work_days.

WRITE :/   work_days, tot_days, non_work_days.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 09:31:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029927#M716601</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T09:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029928#M716602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Use FM SD_DATETIME_DIFFERENCE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if it helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 09:37:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-dates/m-p/3029928#M716602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-12T09:37:53Z</dc:date>
    </item>
  </channel>
</rss>

