<?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 function module for date in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-date/m-p/2743224#M637580</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Can someone pls help me with this.I need a function module which gets t last day of the week(Sun) date for a date range entered. For eg if i enter 3sep2007to 6th sep 2007 it should fetch me the sunday of that week ie 9 th sep.Also if i enter the range as a few months it should be able t fetch all t sun for t date entered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Sep 2007 10:05:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-06T10:05:57Z</dc:date>
    <item>
      <title>function module for date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-date/m-p/2743224#M637580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Can someone pls help me with this.I need a function module which gets t last day of the week(Sun) date for a date range entered. For eg if i enter 3sep2007to 6th sep 2007 it should fetch me the sunday of that week ie 9 th sep.Also if i enter the range as a few months it should be able t fetch all t sun for t date entered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 10:05:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-date/m-p/2743224#M637580</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T10:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: function module for date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-date/m-p/2743225#M637581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hii &lt;/P&gt;&lt;P&gt;for example if ur select option is s_date and if u provide s_date-high as parameter to the function module  'GET_WEEK_INFO_BASED_ON_DATE'  u wil get the week starting and week ending i.e prev sunday and 9 th sep monday. try it out if u have any dbts pls revert back&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 10:13:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-date/m-p/2743225#M637581</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T10:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: function module for date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-date/m-p/2743226#M637582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi KB,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you have mentioned 2 Requirments,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First: Get Last day of the week  for a given date range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Give the last date in FM GET_WEEK_INFO_BASED_ON_DATE you get the sunday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second: Get Last day for the given Month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We hava a function module to find all the sunday in a Year. I think that should be ok for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FM: TSTR_PERIODS_AMERICAN_WEEKS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try and Let me know if you have any issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Dont forget to reward points if useful,&lt;/P&gt;&lt;P&gt;Lijo Joseph&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 10:32:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-date/m-p/2743226#M637582</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T10:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: function module for date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-date/m-p/2743227#M637583</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 this FM   &lt;/P&gt;&lt;P&gt; WEEK_GET_FIRST_DAY &amp;#150; take input as YYYYWW and it gives first day of the week. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per ur req you can use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;reward if Helpful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 10:32:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-date/m-p/2743227#M637583</guid>
      <dc:creator>varma_narayana</dc:creator>
      <dc:date>2007-09-06T10:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: function module for date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-date/m-p/2743228#M637584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi KB,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The below code will satisfy your requirement 100%.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: s_date FOR sy-datum NO-EXTENSION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF it_sun_dates OCCURS 0,&lt;/P&gt;&lt;P&gt;       date TYPE sy-datum,&lt;/P&gt;&lt;P&gt;      END OF it_sun_dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: v_sun_date TYPE sy-datum.&lt;/P&gt;&lt;P&gt;DATA: v_high_date TYPE sy-datum.&lt;/P&gt;&lt;P&gt;DATA: v_wotnr TYPE p.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN OUTPUT.&lt;/P&gt;&lt;P&gt;  LOOP AT SCREEN.&lt;/P&gt;&lt;P&gt;    IF screen-name = 'S_DATE-LOW' OR&lt;/P&gt;&lt;P&gt;       screen-name = 'S_DATE-HIGH'.&lt;/P&gt;&lt;P&gt;      screen-required = 1.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    MODIFY SCREEN.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  v_high_date = s_date-high.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WHILE s_date-low LE s_date-high.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF NOT v_sun_date IS INITIAL.&lt;/P&gt;&lt;P&gt;      EXIT.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'DAY_IN_WEEK'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        datum = s_date-low&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        wotnr = v_wotnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF v_wotnr = 7.&lt;/P&gt;&lt;P&gt;      v_sun_date = s_date-low.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    s_date-low = s_date-low + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDWHILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF NOT v_sun_date IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    WHILE v_sun_date LE v_high_date.&lt;/P&gt;&lt;P&gt;      it_sun_dates-date = v_sun_date.&lt;/P&gt;&lt;P&gt;      APPEND it_sun_dates.&lt;/P&gt;&lt;P&gt;      v_sun_date = v_sun_date + 7.&lt;/P&gt;&lt;P&gt;    ENDWHILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'DAY_IN_WEEK'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        datum = v_high_date&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        wotnr = v_wotnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    v_wotnr = 7 - v_wotnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    it_sun_dates-date = v_high_date + v_wotnr.&lt;/P&gt;&lt;P&gt;    APPEND it_sun_dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'DAY_IN_WEEK'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        datum = v_high_date&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        wotnr = v_wotnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    v_wotnr = 7 - v_wotnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    it_sun_dates-date = v_high_date + v_wotnr.&lt;/P&gt;&lt;P&gt;    APPEND it_sun_dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE:/5 'The list of Sundays in the range'.&lt;/P&gt;&lt;P&gt;  SKIP.&lt;/P&gt;&lt;P&gt;  if not it_sun_dates[] is initial.&lt;/P&gt;&lt;P&gt;   sort it_sun_dates by date.&lt;/P&gt;&lt;P&gt;   delete adjacent duplicates from it_sun_dates  comparing date.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  LOOP AT it_sun_dates.&lt;/P&gt;&lt;P&gt;    WRITE:/5 it_sun_dates-date.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 12:19:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-date/m-p/2743228#M637584</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T12:19:48Z</dc:date>
    </item>
  </channel>
</rss>

