<?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 two dates in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057303#M424831</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this function module&lt;/P&gt;&lt;P&gt;DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc. &lt;/P&gt;&lt;P&gt;DATE_IN_FUTURE Calculate a date N days in the future. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Mar 2007 12:40:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-03-06T12:40:43Z</dc:date>
    <item>
      <title>difference between two dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057295#M424823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;I have a doubt. I have two dates D1 and D2. I need to see that if D1 is a date that falls within next 2 years of D2 then it should throw an error. Can you please tell me how to go about that.&lt;/P&gt;&lt;P&gt;thanks and regards,&lt;/P&gt;&lt;P&gt;Gaurav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 12:19:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057295#M424823</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-06T12:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057296#M424824</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;1. variant&lt;/P&gt;&lt;P&gt;lv_diff = d2 - d1.&lt;/P&gt;&lt;P&gt;If lv_diff &amp;gt; 730.&lt;/P&gt;&lt;P&gt;*error&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.nd variant&lt;/P&gt;&lt;P&gt;lv_diff = d2(4) - d1(4).&lt;/P&gt;&lt;P&gt;IF lv_diff &amp;gt; 2.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;error&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Tamá&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 12:21:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057296#M424824</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-06T12:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057297#M424825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can use this FM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIMA_DAYS_AND_MONTHS_AND_YEARS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 12:22:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057297#M424825</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-06T12:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057298#M424826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Helo Gaurav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

Data: lv_datum like sy-datum.

d3 = d2 + 730 .  " for two years.

if D1 between d2 and d3.
error message.                 " error message
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 12:22:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057298#M424826</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-06T12:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057299#M424827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;chk this from other thread

REPORT ZDATEDIFF.
 
DATA: EDAYS   LIKE VTBBEWE-ATAGE,
      EMONTHS LIKE VTBBEWE-ATAGE,
      EYEARS  LIKE VTBBEWE-ATAGE.
 
PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
            TODATE   LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
 
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
  exporting
    i_date_from          = FROMDATE
    i_date_to            = TODATE
*   I_FLG_SEPARATE       = ' '
  IMPORTING
    E_DAYS               = EDAYS
    E_MONTHS             = EMONTHS
    E_YEARS              = EYEARS.
 
if EYEARS  &amp;lt; 2 years throw an error&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 12:23:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057299#M424827</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-06T12:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057300#M424828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Gaurav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try the following logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data:
    l_date type sy-datum,
    l_date2 type sy-datum,
    l_diff type i,
    l_diff_years type i.

    l_date = '20050101'.
    l_date2 = '200070110'.
  CALL FUNCTION 'C14B_DIFF_BT_2_DATES'
  EXPORTING
      i_date_from                     = l_date    
      i_date_to                       = l_date2      
  IMPORTING
      E_DAYS                          = l_diff
      E_YEARS                       = l_diff_years
  EXCEPTIONS
      PLAUSIBILITY_CHECK_FAILED       = 1
      OTHERS                          = 2.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
if l_diff &amp;gt; 730 ." 731 in case a leap year is included
* throw error message
endif.     
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Sajan Joseph.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 12:30:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057300#M424828</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-06T12:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057301#M424829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: v_date LIKE RM06B-EEIND. Say this as D2
DATA: date LIKE sy-datum.
v_date = '01/01/2007'. D2
CALL FUNCTION 'DATE_IN_FUTURE'
  EXPORTING
    anzahl_tage                   = '24'
    import_datum                  = v_date
 IMPORTING
*   EXPORT_DATUM_EXT_FORMAT       =
   EXPORT_DATUM_INT_FORMAT       = date
          .
If ( D1 &amp;lt;=  date 
and D1 &amp;gt;= D2 ). ( Check if it is between D2 and date- 2years+D2 )
Message e000 with 'Error;.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will explain u teh logic if any mistakes are there check and change it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The FM is used to get the next two years from the given date, that is y i have paseed 24 if u want previous 24 u can pass -24.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I am checking whether the date D1 is between the date D2 and the next two years, if so error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if this helsp.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 12:32:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057301#M424829</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-06T12:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057302#M424830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gaurav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use function Module "&amp;lt;b&amp;gt;HR_HK_DIFF_BT_2_DATES&amp;lt;/b&amp;gt;" as follows :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********************************************************************************&lt;/P&gt;&lt;P&gt;parameters : d1 type sy-datum,&lt;/P&gt;&lt;P&gt;             d2 type sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : years type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    DATE1                         = d1&lt;/P&gt;&lt;P&gt;    DATE2                         = d2&lt;/P&gt;&lt;P&gt;   OUTPUT_FORMAT                 = '07'&lt;/P&gt;&lt;P&gt; IMPORTING&lt;/P&gt;&lt;P&gt;   YEARS                         = years&lt;/P&gt;&lt;P&gt; EXCEPTIONS&lt;/P&gt;&lt;P&gt;   INVALID_DATES_SPECIFIED       = 1&lt;/P&gt;&lt;P&gt;   OTHERS                        = 2&lt;/P&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt; MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if years &amp;gt; 2.&lt;/P&gt;&lt;P&gt;**your error message&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;******************************************************************************************&lt;/P&gt;&lt;P&gt; here make sure that the date that u pass &amp;lt;b&amp;gt;DATE1 should be grater than the date DATE2&amp;lt;/b&amp;gt;, otherwise it will raise an exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so Gaurav...u r done with this problem of yours ...cheers... &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Reward points for useful answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tejas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 12:36:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057302#M424830</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-06T12:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057303#M424831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this function module&lt;/P&gt;&lt;P&gt;DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc. &lt;/P&gt;&lt;P&gt;DATE_IN_FUTURE Calculate a date N days in the future. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 12:40:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057303#M424831</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-06T12:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057304#M424832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hai Gaurav try it....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: DATE1 LIKE SY-DATUM,&lt;/P&gt;&lt;P&gt;      DATE2 LIKE SY-DATUM,&lt;/P&gt;&lt;P&gt;      DATE3 LIKE SY-DATUM.&lt;/P&gt;&lt;P&gt;DATE1 = SY-DATUM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATE2 = '20080203'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATE3 = DATE1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADD 2 TO DATE3+0(4).            " Date after 2 years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF DATE2 BETWEEN DATE1 AND DATE3.&lt;/P&gt;&lt;P&gt;  Error Message.......&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2007 12:43:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-two-dates/m-p/2057304#M424832</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-06T12:43:15Z</dc:date>
    </item>
  </channel>
</rss>

