<?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: Date calculation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/2744134#M637794</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;Please use the code given below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : date_diff type p, earliest type C, timediff type p.&lt;/P&gt;&lt;P&gt;data : c_new type t, d_new type t.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen begin of block b1 with frame.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: date FOR sy-datum.&lt;/P&gt;&lt;P&gt;selection-screen end of block b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    date1                  = date-low&lt;/P&gt;&lt;P&gt;    time1                  = c_new&lt;/P&gt;&lt;P&gt;    date2                  = date-high&lt;/P&gt;&lt;P&gt;    time2                  = d_new&lt;/P&gt;&lt;P&gt; IMPORTING&lt;/P&gt;&lt;P&gt;   DATEDIFF               = date_diff&lt;/P&gt;&lt;P&gt;   TIMEDIFF               = timediff&lt;/P&gt;&lt;P&gt;   EARLIEST               = earliest&lt;/P&gt;&lt;P&gt; EXCEPTIONS&lt;/P&gt;&lt;P&gt;   INVALID_DATETIME       = 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;write : / date_diff.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope, it can help you,&lt;/P&gt;&lt;P&gt;Reward points, if helpful,&lt;/P&gt;&lt;P&gt;Sandeep Kaushik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 08 Sep 2007 12:49:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-08T12:49:57Z</dc:date>
    <item>
      <title>Date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/2744133#M637793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any FM for date calculation.&lt;/P&gt;&lt;P&gt;I have one scenario &lt;/P&gt;&lt;P&gt;In  selection screen we  have on Select Option field &amp;#145;Date&amp;#146;.&lt;/P&gt;&lt;P&gt;If I put  the some ranges in Date (selection field ) , we need to calculate how many dates in between.&lt;/P&gt;&lt;P&gt;Could you please help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Amjad Hussain,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2007 12:39:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/2744133#M637793</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-08T12:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/2744134#M637794</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;Please use the code given below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : date_diff type p, earliest type C, timediff type p.&lt;/P&gt;&lt;P&gt;data : c_new type t, d_new type t.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen begin of block b1 with frame.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: date FOR sy-datum.&lt;/P&gt;&lt;P&gt;selection-screen end of block b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    date1                  = date-low&lt;/P&gt;&lt;P&gt;    time1                  = c_new&lt;/P&gt;&lt;P&gt;    date2                  = date-high&lt;/P&gt;&lt;P&gt;    time2                  = d_new&lt;/P&gt;&lt;P&gt; IMPORTING&lt;/P&gt;&lt;P&gt;   DATEDIFF               = date_diff&lt;/P&gt;&lt;P&gt;   TIMEDIFF               = timediff&lt;/P&gt;&lt;P&gt;   EARLIEST               = earliest&lt;/P&gt;&lt;P&gt; EXCEPTIONS&lt;/P&gt;&lt;P&gt;   INVALID_DATETIME       = 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;write : / date_diff.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope, it can help you,&lt;/P&gt;&lt;P&gt;Reward points, if helpful,&lt;/P&gt;&lt;P&gt;Sandeep Kaushik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2007 12:49:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/2744134#M637794</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-08T12:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/2744135#M637795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi mohammed,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the following FM&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                   = higher date &lt;/P&gt;&lt;P&gt;          DATE2                   = lower date&lt;/P&gt;&lt;P&gt;          OUTPUT_FORMAT           = '02'&lt;/P&gt;&lt;P&gt;        IMPORTING&lt;/P&gt;&lt;P&gt;          DAYS                    = W_DAYS&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;      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;Based on output_format you can get years/days/months combination&lt;/P&gt;&lt;P&gt;OUTPUT_FORMAT           = '02'  will give you the days only as requested&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other function modules are also available like&lt;/P&gt;&lt;P&gt;FIMA_DAYS_AND_MONTHS_AND_YEARS&lt;/P&gt;&lt;P&gt;FIMA_DAYS_BETWEEN_TWO_DATES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Byju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2007 12:52:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/2744135#M637795</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-08T12:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Date calculation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/2744136#M637796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use below FM :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just use DAY_ATTRIBUTES_GET function module and give DATE_FROM and DATE_TO it it, and it will return an internal table with all the dates in between. It gives you more information than you need, but it is the easiest. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use other FM then if  date from and date to are in same year ,then it works .&lt;/P&gt;&lt;P&gt;if dates are not in same year,then it will not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to use DAY_ATTRIBUTES_GET -&amp;gt; it gives the all information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Seshu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Sep 2007 13:12:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-calculation/m-p/2744136#M637796</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-08T13:12:40Z</dc:date>
    </item>
  </channel>
</rss>

