<?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 quarters in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/quarters/m-p/3004926#M710034</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;if the user enters 2 dates n selection screen and if i get the quarter of in which the selct-option-low and select-option-high lies how can i get the mioddle qaurter??&lt;/P&gt;&lt;P&gt;eg..from: 20/02/2007   to 29/09/2007&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20/02/2007   lies in 1st quarter and 29/09/2007 lies in 3rd qaurter how can i get the middle quarters start and end date??its urgent!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Nov 2007 05:10:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-02T05:10:26Z</dc:date>
    <item>
      <title>quarters</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/quarters/m-p/3004926#M710034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;if the user enters 2 dates n selection screen and if i get the quarter of in which the selct-option-low and select-option-high lies how can i get the mioddle qaurter??&lt;/P&gt;&lt;P&gt;eg..from: 20/02/2007   to 29/09/2007&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20/02/2007   lies in 1st quarter and 29/09/2007 lies in 3rd qaurter how can i get the middle quarters start and end date??its urgent!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2007 05:10:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/quarters/m-p/3004926#M710034</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-02T05:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: quarters</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/quarters/m-p/3004927#M710035</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;Try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

 TYPES: BEGIN OF type_date,
                 low TYPE sydatum,
                 high TYPE sydatum,
              END OF type_date. 

DATA: t_date     type standard table of type_date.
DATA: s_date     type type_date.
DATA: t_final     type standard table of type_date.
DATA: v_low_found.
DATA: v_high_found.
RANGES: r_date for sy-datum.


** have the four quarters in an internal table.
*" First quarter.
  s_date-low(4) = sy-datum(4).      " Store the current year.
  s_date-low+4(4) = '0101'.           " date and month.
  s_date-high(4) = sy-datum(4)     " Store the current year.
  s_date-high+4(4) = '0331'.          " date and month.
  APPEND s_date to T_DATE.

*" second quarter.
  s_date-low(4) = sy-datum(4).      " Store the current year.
  s_date-low+4(4) = '0401'.           " date and month.
  s_date-high(4) = sy-datum(4)     " Store the current year.
  s_date-high+4(4) = '0630'.          " date and month.
  APPEND s_date to T_DATE.

*" third quarter.
  s_date-low(4) = sy-datum(4).      " Store the current year.
  s_date-low+4(4) = '0701'.           " date and month.
  s_date-high(4) = sy-datum(4)     " Store the current year.
  s_date-high+4(4) = '0930'.          " date and month.
  APPEND s_date to T_DATE.

*" fourth quarter.
  s_date-low(4) = sy-datum(4).      " Store the current year.
  s_date-low+4(4) = '1001'.           " date and month.
  s_date-high(4) = sy-datum(4)     " Store the current year.
  s_date-high+4(4) = '1231'.          " date and month.
  APPEND s_date to T_DATE.

*"Read the select-option internal table.
  READ TABLE so_date INDEX 1.

  LOOP AT t_date INTO s_date.

*" Build the range.
   refresh: r_date.
   r_date-sign = 'I'.
   r_date-option = 'BT'.
   r_date-low = s_date-low.
   r_date-high = s_date-high.
   append r_date.

**" Check if the selection scren date so-date-low and high is in which quarters     
     IF s_date-low IN r_date AND s_date-high IN r_date.

*** Found..low and high is within the same quarter.
       APPEND s_date to t_final.
       EXIT.

     ENDIF.


***" Check if the selection screen date low is with in the range.
     IF s_date-low IN r_date.

*" Set the v_low_found flag.
         V_LOW_found = 'X'.
         CONTINUE.          " Process the next record.
        
     ENDIF.

***" Check if the selection screen date high is with in the range.
    IF s_date-high IN r_date.
      EXIT.         " Exit the loop.
    ENDIF.

     IF v_low_found = 'X'.
**" append the final internal table.
       append s_date TO t_final.

    ENDIF.


  ENDLOOP.

**" Now the t_final internal table will have the middle quarters start and end date.
  LOOP AT t_final INTO s_date.
    WRITE: / s_date.
  ENDLOOP.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Nov 2007 02:17:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/quarters/m-p/3004927#M710035</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-04T02:17:11Z</dc:date>
    </item>
  </channel>
</rss>

