<?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  for weekend dates, Data not coming properly in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-range-for-weekend-dates-data-not-coming-properly/m-p/3568034#M858700</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why are you using r_date1?&lt;/P&gt;&lt;P&gt;Of course is bringing dates from 03/30 to 04/12, because r_date1 has both conditions, if you only want to select that weekend range change&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
r_date1-sign = 'I'.
r_date1-option = 'BT'.
r_date1-low = p_dates-low - 6.
r_date1-high = p_dates-low .
append r_date1.
clear r_date1.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
refresh r_date1.
r_date1-sign = 'I'.
r_date1-option = 'BT'.
r_date1-low = p_dates-low - 6.
r_date1-high = p_dates-low .
append r_date1.
clear r_date1.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 31 Mar 2008 14:56:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-31T14:56:26Z</dc:date>
    <item>
      <title>Date Range  for weekend dates, Data not coming properly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-range-for-weekend-dates-data-not-coming-properly/m-p/3568033#M858699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All, &lt;/P&gt;&lt;P&gt; I had posted the query for  getting weekend dates  if an user enters  a date range . Most of them had answerded it .  Next I  wanted  ( Cheques, invoices, amount) data in those ranges, Mr Srinivas gurram Reddy had given the solution for it but Iam not getting the data properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is the code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 

TABLES: PAYR.

DATA: v_RWBTR1(20) TYPE C,
      v_RWBTR2(20) TYPE C,
      v_RWBTR3(20) TYPE C,
      v_RWBTR4(20) TYPE C,
      v_count1(20) TYPE C,
      v_count2(20) TYPE C,
      v_count3(20) TYPE C,
      v_count4(20) TYPE C.

DATA  IT_PAYR LIKE PAYR OCCURS 100 WITH HEADER LINE.

DATA: wk_dow       TYPE C,
      wk_days      TYPE i.

DATA: WK1 LIKE SY-DATUM.
DATA: PD LIKE SY-DATUM.

RANGES: r_weekend FOR sy-datum.

SELECT-OPTIONS:
    p_dates   FOR sy-datum.

START-OF-SELECTION.

  WHILE p_dates-low LE p_dates-high.
    CALL FUNCTION 'DATE_COMPUTE_DAY'
         EXPORTING
              date = p_dates-low
         IMPORTING
              day  = wk_dow.

    IF WK_DOW = '1'.
    WK1 = P_DATES-LOW.
    ENDIF.

    IF wk_dow = '6'.
*    OR wk_dow = '7' .
      r_weekend = 'IEQ'.
      r_weekend-low = p_dates-low.
      APPEND r_weekend.
*      WRITE:/ p_dates-low.

r_date1-sign = 'I'.
r_date1-option = 'BT'.
r_date1-low = p_dates-low - 6.
r_date1-high = p_dates-low .
append r_date1.
clear r_date1.

CLEAR:  v_RWBTR1,
            v_count1.

SELECT * FROM PAYR  WHERE  ZALDT in R_DATE1.
      MOVE-CORRESPONDING PAYR TO IT_PAYR.
      APPEND IT_PAYR.
   ENDSELECT.

  SORT IT_PAYR BY ZALDT.
LOOP AT IT_PAYR.

v_RWBTR1 = v_RWBTR1 + it_payr-RWBTR.
v_count1 = v_count1 + 1.

ENDLOOP.
WRITE:/ P_DATES-LOW, V_COUNT1, V_RWBTR1.
    ENDIF.
    p_dates-low = p_dates-low + 1.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If iam giving  the range (the range can be from 01/01/2008 to 12/31/2008.)  as 0401/2008 to 04/30/2008 for the 1st record  I get the weekend date as 04/05/2008  and the data like invoices, cheques are getting calculated for the range 03/30/2008 to  04/05/2008 and coming properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the 2nd record or 2nd time  Iam getting weekend data properly, but data for cheques  and cheque amount are getting calculated for the range  03/30/2008 to  04/12/2008 * the correct range is  04/06/2008 to  04/12/2008 *.  &lt;/P&gt;&lt;P&gt;The problem I think is with r_date1 , Can  anyone please help me to get the desired results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: daniel reaves on Mar 31, 2008 4:35 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Mar 2008 14:34:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-range-for-weekend-dates-data-not-coming-properly/m-p/3568033#M858699</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-31T14:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: Date Range  for weekend dates, Data not coming properly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-range-for-weekend-dates-data-not-coming-properly/m-p/3568034#M858700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why are you using r_date1?&lt;/P&gt;&lt;P&gt;Of course is bringing dates from 03/30 to 04/12, because r_date1 has both conditions, if you only want to select that weekend range change&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
r_date1-sign = 'I'.
r_date1-option = 'BT'.
r_date1-low = p_dates-low - 6.
r_date1-high = p_dates-low .
append r_date1.
clear r_date1.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
refresh r_date1.
r_date1-sign = 'I'.
r_date1-option = 'BT'.
r_date1-low = p_dates-low - 6.
r_date1-high = p_dates-low .
append r_date1.
clear r_date1.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Mar 2008 14:56:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-range-for-weekend-dates-data-not-coming-properly/m-p/3568034#M858700</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-31T14:56:26Z</dc:date>
    </item>
  </channel>
</rss>

