<?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: Tricky dynamic date variant in ABAP query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783875#M337715</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the answers, but it still did not solve the problem. I am using the dynamic date calculation but can not fill the values as desired: the &amp;lt;b&amp;gt;from date&amp;lt;/b&amp;gt; field should be blank and the &amp;lt;b&amp;gt;to date&amp;lt;/b&amp;gt; field should show the current date - 90 days&lt;/P&gt;&lt;P&gt;Thanks for any help&lt;/P&gt;&lt;P&gt;Ronen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 Dec 2006 11:13:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-17T11:13:43Z</dc:date>
    <item>
      <title>Tricky dynamic date variant in ABAP query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783872#M337712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;In an abap query there is a date field in the selection screen with from &amp;amp; to values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to create a dynamic variant that will fill the following data into those fields:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From date: will be left blank&lt;/P&gt;&lt;P&gt;To date: will show today's date - 90 days&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, if today's date is 01/12/2006 the variant should fill the following data into the fields:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From date: &amp;lt;blank&amp;gt;&lt;/P&gt;&lt;P&gt;To date: 01/09/2006&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried all the methods I know with dynamic dates calculation in the variant definition but did not manage to create such variant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help will be very appreciated and points would be rewarded generously !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much,&lt;/P&gt;&lt;P&gt;Ronen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Dec 2006 08:44:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783872#M337712</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-17T08:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky dynamic date variant in ABAP query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783873#M337713</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;u can use this FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: wa_date like sy-datum,
        wa_date_new like sy-datum.

wa_date = sy-datum.

call function 'RP_CALC_DATE_IN_INTERVAL'
exportingdate = wa_date
days = 90
months = 0
signum = '-'
years = 0
importing
calc_date = wa_date_new .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa_date_new&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;  will contain the 90 days back date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Dec 2006 08:50:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783873#M337713</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-12-17T08:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky dynamic date variant in ABAP query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783874#M337714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you choose the dynamic selection while saving the variant. There for a date field you will find different options, right? Were you not able to find current date - 90 days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF you see the screen shot provided in the link here, you can find the Current date +/- xxx days. That should be useful for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw2004s/helpdata/en/c0/98039be58611d194cc00a0c94260a5/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/c0/98039be58611d194cc00a0c94260a5/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;P&gt;Note - Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Dec 2006 08:54:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783874#M337714</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-17T08:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky dynamic date variant in ABAP query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783875#M337715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the answers, but it still did not solve the problem. I am using the dynamic date calculation but can not fill the values as desired: the &amp;lt;b&amp;gt;from date&amp;lt;/b&amp;gt; field should be blank and the &amp;lt;b&amp;gt;to date&amp;lt;/b&amp;gt; field should show the current date - 90 days&lt;/P&gt;&lt;P&gt;Thanks for any help&lt;/P&gt;&lt;P&gt;Ronen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Dec 2006 11:13:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783875#M337715</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-17T11:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky dynamic date variant in ABAP query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783876#M337716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah !! Ronen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The from value always have to be lower than the to value. So, that looks the issue in this case. How can be the from date be blank and the To date have a value, we are talking about SELECT - OPTIONS here right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, when you are specifying a range how can you specify only the upper limit and not specify the lower limit. So, shouldn't be Current Date to Current Date - 90 or in fact it should be Current Date - 90 to Current Date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Dec 2006 11:31:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783876#M337716</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-17T11:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky dynamic date variant in ABAP query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783877#M337717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anybody have a response for how this date selection can be done?  I also need the same date selection in my variant. I need to pick up where the date field is blank or is today&lt;EM&gt;3.  I have tried to save multiple date selections, but to use the Dynamic date calculation for today&lt;/EM&gt;3, I have been unsuccessful.  Just looking to see if there is any way to do this date selection.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Anna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2007 17:43:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783877#M337717</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-17T17:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky dynamic date variant in ABAP query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783878#M337718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the "from" date is meant to be left blank (beginning of time) and the "to" date is some date plus or minus number of days from today, you use the "current +/- days" dynamic date calculation format as was mentioned earlier.  Likewise if the "from" date is some date plus or minus today's date, and the "to" date is infinity -- you only need the one Dynamic Date calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To do this, first don't think about this as a date range, think of your Dynamic Date calculation as if this were a single parameter and not a select-option.  You are really saying "my date is anything LT/LE this date" or "my date is anything GT/GE this date" -- not a range &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Save Variant screen, find the desired date select-option and:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Choose in column "Selection Variable", a "D" (Dynamic date calculation)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Use F4 in the "Name of Variable" column&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Find "Current date +/- ??? days" or "Current date +/- ??? work days" in the popup, as appropriate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. For "I/E" (include/exclude) column select as appropriate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. For "Option" column, choose "LE", "LT", "GE", "GT", "NE" as appropriate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. After clicking green check mark, enter your plus or minus days (and factory calendar if using work days).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7. Finish saving your variant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;8. You may not see your changes in your variant until you back all the way out of the variant and then redisplay it.  You'll see a greyed out date along with the symbol matching your choice (LT, LE, etc.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately if you don't have infinity on either end of the date you are limited to 999 days differences as far as I am aware.  If that is the case you can populate TVARVC table with parameter or selection variables, maintain them with STVARV transaction by hand, or use an ABAP program in batch to regularly calculate the values.  Then you can reference the TVARVC values in your variant instead of the Dynamic Date calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If someone knows a way to bypass the use of TVARVC for date ranges that are more than 999 days apart please let me know.  TVARVC works well but it is extra effort whereas Dynamic Date calculation would be much easier to maintain if the date range could be made larger than 999 days.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jun 2010 17:32:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tricky-dynamic-date-variant-in-abap-query/m-p/1783878#M337718</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-30T17:32:22Z</dc:date>
    </item>
  </channel>
</rss>

