<?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 Range . in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-range/m-p/4421867#M1050196</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES : bsis.
data: year TYPE i,
     day type i.
select-OPTIONS so_date for bsis-budat OBLIGATORY no-EXTENSION.

AT SELECTION-SCREEN.

  CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
    EXPORTING
      BEG_DA              = so_date-low
      END_DA              = so_date-high
   IMPORTING
     NO_DAY              = day
*     NO_MONTH            =
     NO_YEAR             = year
*     NO_CAL_DAY          =
*   EXCEPTIONS
*     DATEINT_ERROR       = 1
*     OTHERS              = 2
            .
  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.
  ENDIF.

if year GT 1 or year EQ 1 AND day GT 0.
  MESSAGE 'Error- More than an year' TYPE 'E'.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Sep 2008 08:36:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-10T08:36:22Z</dc:date>
    <item>
      <title>Date Range .</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-range/m-p/4421864#M1050193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guru's , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need  date range on my selection screen upto 1 year , beyond that it should give a error message orit should exit . can you please tell me how to execute it . &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;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2008 08:16:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-range/m-p/4421864#M1050193</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-10T08:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Date Range .</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-range/m-p/4421865#M1050194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Peter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this way :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Select-options:
   s_date for sy-datum.

at selection-screen.

    if s_date-low+0(4) ne sy-datum+0(4)
   or s_date-high+0(4) ne sy-datum+0(4).

       message 'Enter Current year' type 'E'.

    endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swapna.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: NagaSwapna Thota on Sep 10, 2008 2:04 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2008 08:31:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-range/m-p/4421865#M1050194</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-10T08:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Date Range .</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-range/m-p/4421866#M1050195</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;HR_HK_DIFF_BT_2_DATES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the above fm to find the range between two dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Input :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; DATE1                           14.01.2008&lt;/P&gt;&lt;P&gt; DATE2                           15.01.2007&lt;/P&gt;&lt;P&gt; OUTPUT_FORMAT                   05&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; YEARS                           1,0000&lt;/P&gt;&lt;P&gt; MONTHS                         0,0000&lt;/P&gt;&lt;P&gt; DAYS                              0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the condition like the following,&lt;/P&gt;&lt;P&gt;1, year should not exceed 1&lt;/P&gt;&lt;P&gt;2, if year is 1, month and days should not exceed 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Harish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2008 08:34:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-range/m-p/4421866#M1050195</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-10T08:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Date Range .</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-range/m-p/4421867#M1050196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES : bsis.
data: year TYPE i,
     day type i.
select-OPTIONS so_date for bsis-budat OBLIGATORY no-EXTENSION.

AT SELECTION-SCREEN.

  CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
    EXPORTING
      BEG_DA              = so_date-low
      END_DA              = so_date-high
   IMPORTING
     NO_DAY              = day
*     NO_MONTH            =
     NO_YEAR             = year
*     NO_CAL_DAY          =
*   EXCEPTIONS
*     DATEINT_ERROR       = 1
*     OTHERS              = 2
            .
  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.
  ENDIF.

if year GT 1 or year EQ 1 AND day GT 0.
  MESSAGE 'Error- More than an year' TYPE 'E'.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2008 08:36:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-range/m-p/4421867#M1050196</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-10T08:36:22Z</dc:date>
    </item>
  </channel>
</rss>

