<?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: problem while calculating date based on the selection in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652703#M1445191</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Helpfull answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Mar 2010 20:27:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-01T20:27:44Z</dc:date>
    <item>
      <title>problem while calculating date based on the selection</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652697#M1445185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On my selection screen i have 2 fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) 1 WEEK&lt;/P&gt;&lt;P&gt;b) 2 weeks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now when the user enters value yes in 1 week it should display the data which are less than one week old from current date and if user enters yes in 2weeks field then it should display the data which are less than 2 weeks old from the current date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie : in my internal table i have a date field zdate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now i should check if the ZDATE is within one week range  ( for 1WEEK FIELD ) it should display only that data.&lt;/P&gt;&lt;P&gt;similary i should check for ( 2week field on the selection scree)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i do that...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any function modules available for the above requirment.&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;Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Feb 2010 14:27:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652697#M1445185</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-22T14:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: problem while calculating date based on the selection</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652698#M1445186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;1. Create a variable of type date .&lt;/P&gt;&lt;P&gt;2. Populate the variable l_var = sy-datum -7 or sy-datum - 14 depending on 1 week or 2 week is filled.&lt;/P&gt;&lt;P&gt;3. Create a range table Sign = E, option = BW , low = sy-datum, high = l_var.&lt;/P&gt;&lt;P&gt;4. delete i_tab where zdate in l_var.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Feb 2010 14:37:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652698#M1445186</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-22T14:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: problem while calculating date based on the selection</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652699#M1445187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can check if the ZDATE field lies in between the 2 dates as ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"p_date = 1 week or 2 weeks. &amp;lt;--- depends on your selection&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at &amp;lt;internal table&amp;gt; where ZDATE between p_date and sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Feb 2010 14:40:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652699#M1445187</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-22T14:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: problem while calculating date based on the selection</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652700#M1445188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anurag..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SY-DATUUM - X does not work when the month and year changes..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example if the current date is 02/01/2010&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now if i say sy-datum  - 7 , the system will not recognise the month and year change here...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for that reason iam looking for a function module which reterns the date if i enter the current date ie : what is the 7 days before date for 1 week and what is the 14 days week for 2 weeks.&lt;/P&gt;&lt;P&gt;Please let me know if any such function modules exists&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Feb 2010 14:58:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652700#M1445188</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-22T14:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: problem while calculating date based on the selection</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652701#M1445189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any update on this...&lt;/P&gt;&lt;P&gt;Does any such function module exists..?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Feb 2010 15:52:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652701#M1445189</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-22T15:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: problem while calculating date based on the selection</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652702#M1445190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SY-DATUUM - X does not work when the month and year changes..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example if the current date is 02/01/2010&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now if i say sy-datum - 7 , the system will not recognise the month and year change here...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure what you're saying here is accurate.  I created the following piece of code to check;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data l_var type datum.

l_var = '20100102'.

l_var = l_var - 7.

Write: / L_var.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The value of l_var at the end was 26.12.2009, which seems to work for me. Anurag's answer seems to be correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nick&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. Your question actually breaks the forum rules, questions on manipulating dates have been asked many times before and the answers typically only require basic arithmatic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Feb 2010 16:01:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652702#M1445190</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-22T16:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: problem while calculating date based on the selection</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652703#M1445191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Helpfull answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Mar 2010 20:27:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-calculating-date-based-on-the-selection/m-p/6652703#M1445191</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-01T20:27:44Z</dc:date>
    </item>
  </channel>
</rss>

