<?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: How to define this SQL ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981180#M72011</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;I've used NO-EXTENSION for S_CDATE,&lt;/P&gt;&lt;P&gt;but I still can select the signs from the field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jul 2005 10:46:53 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-07-14T10:46:53Z</dc:date>
    <item>
      <title>How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981157#M71988</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;&lt;/P&gt;&lt;P&gt;I'm going to retrieve a field whose content contain date and time, i.e. 2005071300045678.&lt;/P&gt;&lt;P&gt;I only want to retrive the date, i.e. the first 8 offsets.&lt;/P&gt;&lt;P&gt;I've done something like:&lt;/P&gt;&lt;P&gt;Select * from db where field1+0(8) = '20050713'.&lt;/P&gt;&lt;P&gt;But the system can't identify field1+0(8),&lt;/P&gt;&lt;P&gt;what should I do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 03:47:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981157#M71988</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T03:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981158#M71989</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;P&gt;select * from db where field1 like '20050713%'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is not working, then select all the records from the db.&lt;/P&gt;&lt;P&gt;Then try like this inside the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt;if wa-field1+0(7) ne '20050713'.&lt;/P&gt;&lt;P&gt;delete itab where field1 = wa-field1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 03:55:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981158#M71989</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-07-13T03:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981159#M71990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply, this is very useful to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I have a variable of type c storing the field2 (select * from db where field1 like field2)&lt;/P&gt;&lt;P&gt;remember field1 is type d, e.g. 20050713&lt;/P&gt;&lt;P&gt;but field2 is type c, i got '13072005%'&lt;/P&gt;&lt;P&gt;How to change the field2 to '20050713%'?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 04:04:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981159#M71990</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T04:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981160#M71991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;U can gtry using &amp;lt;b&amp;gt;HAVING Clause...&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:  COUNT TYPE I, AVG TYPE F. &lt;/P&gt;&lt;P&gt;DATA:  CONNID LIKE SBOOK-CONNID. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT CONNID COUNT( * ) AVG( LUGGWEIGHT ) &lt;/P&gt;&lt;P&gt;       INTO (CONNID, COUNT, AVG) &lt;/P&gt;&lt;P&gt;       FROM SBOOK &lt;/P&gt;&lt;P&gt;       WHERE &lt;/P&gt;&lt;P&gt;         CARRID   = 'LH'       AND &lt;/P&gt;&lt;P&gt;         FLDATE   = '19950228' &lt;/P&gt;&lt;P&gt;       GROUP BY CONNID &lt;/P&gt;&lt;P&gt;       HAVING AVG( LUGGWEIGHT ) &amp;gt; '20.0'. &lt;/P&gt;&lt;P&gt;  WRITE: / CONNID, COUNT, AVG. &lt;/P&gt;&lt;P&gt;ENDSELECT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Try this &lt;/P&gt;&lt;P&gt;Select * from db where field1 = lv_field+0(8).&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 04:08:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981160#M71991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T04:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981161#M71992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works simply by using the MOVE statement.&lt;/P&gt;&lt;P&gt;Thanks anyway. &lt;SUP&gt;.&lt;/SUP&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 04:11:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981161#M71992</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T04:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981162#M71993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'd like to ask what if field2 is a select options?&lt;/P&gt;&lt;P&gt;The SQL works fine for a single value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select options field2 for xxx-yyy.&lt;/P&gt;&lt;P&gt;select * from db where field1 like field2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to make the SQL to search for a range?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 08:36:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981162#M71993</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T08:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981163#M71994</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 search for a range using &amp;lt;b&amp;gt;IN&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg:&lt;/P&gt;&lt;P&gt;select options field2 for xxx-yyy.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;select * from db where field1 IN field2.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTION: matnr for s_matnr.&lt;/P&gt;&lt;P&gt;SELECT * FROM MARA WHERE matnr IN s_matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Judith.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 08:50:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981163#M71994</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T08:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981164#M71995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Macy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for ranges try that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RANGES r_d FOR bsik-zuonr.&lt;/P&gt;&lt;P&gt;  r_d-low = '200507*'.&lt;/P&gt;&lt;P&gt;  r_d-option = 'CP'.&lt;/P&gt;&lt;P&gt;  r_d-sign = 'I'.&lt;/P&gt;&lt;P&gt;  APPEND r_d.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT        * FROM  bsik&lt;/P&gt;&lt;P&gt;         WHERE  bukrs  = bukrs&lt;/P&gt;&lt;P&gt;         AND    gjahr  = sy-datum(4)&lt;/P&gt;&lt;P&gt;         AND    lifnr  IN lifnr&lt;/P&gt;&lt;P&gt;         AND    zuonr  IN r_d.&lt;/P&gt;&lt;P&gt;   ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 09:12:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981164#M71995</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2005-07-13T09:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981165#M71996</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;IN is used in normal case for ranges,&lt;/P&gt;&lt;P&gt;The problem is that, I have to use &lt;/P&gt;&lt;P&gt;select * from db where field1 like field2.&lt;/P&gt;&lt;P&gt;but field2 is a select options, I can't simply use select * from db where field1 in field2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 09:15:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981165#M71996</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T09:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981166#M71997</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;You have to use ranges.&lt;/P&gt;&lt;P&gt;That range should contain one more character than the select-option field.Suppose if the select-option field2 is 3 characters,then make the range for 4 character.Append % manually for each value inside the loop.Then use IN ranges in select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data v(3).&lt;/P&gt;&lt;P&gt;data v1(4).&lt;/P&gt;&lt;P&gt;select-options s_matnr for v.&lt;/P&gt;&lt;P&gt;ranges r_matnr for v1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at s_matnr.&lt;/P&gt;&lt;P&gt;concatenate s_matnr-low '%' into r_matnr-low.&lt;/P&gt;&lt;P&gt;concatenate s_matnr-high '%' into r_matnr-high .&lt;/P&gt;&lt;P&gt;r_matnr-sign = s_matnr-sign.&lt;/P&gt;&lt;P&gt;r_matnr-option = s_matnr-option.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data itab type standard table of mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from mara into table itab where matnr in r_matnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;write 'good'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 09:37:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981166#M71997</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-07-13T09:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981167#M71998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;Thanks a lot for your detailed code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it retrieves so many irrelevant entries which is not desirable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from db into table itab where field1 in r_field1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your reference,&lt;/P&gt;&lt;P&gt;field1 is 2005071311111111,&lt;/P&gt;&lt;P&gt;r_field1-low is '20050713%'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 10:03:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981167#M71998</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T10:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981168#M71999</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;In your first post,you mentioned as below.That's why I thought that you need all the values starting from 20050713.&lt;/P&gt;&lt;P&gt;I'm going to retrieve a field whose content contain date and time, i.e. 2005071300045678.&lt;/P&gt;&lt;P&gt;I only want to retrive the date, i.e. the first 8 offsets.&lt;/P&gt;&lt;P&gt;I've done something like:&lt;/P&gt;&lt;P&gt;Select * from db where field1+0(8) = '20050713'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please explain with an example actually what you from database?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose if you enter '20050713' in select-option,then what you want the database to fetch?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 10:08:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981168#M71999</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-07-13T10:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981169#M72000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry that I didn't say clearly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm getting the spool id from db table TSP02 according to the creation date range specified on the selection screen.&lt;/P&gt;&lt;P&gt;So, the SQL is &lt;/P&gt;&lt;P&gt;SELECT-OPTIONS S_CDATE FOR SY-DATUM.&lt;/P&gt;&lt;P&gt;DATA TXT TYPE C '9'.&lt;/P&gt;&lt;P&gt;CONCATENATE S_CDATE-LOW '%' INTO TXT.&lt;/P&gt;&lt;P&gt;SELECT PJIDENT FROM TSP02 WHERE PJCREATIME LIKE TXT.&lt;/P&gt;&lt;P&gt;this works fine,&lt;/P&gt;&lt;P&gt;but what should be the SQL if users specifies the range in the selection screen , e.g. 20050201 to 20050208 ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 10:15:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981169#M72000</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T10:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981170#M72001</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;If the user is entering one value,suppose '20050201'.Then the select statement will fetch '20050201111111','2005020122222',etc.,&lt;/P&gt;&lt;P&gt;If he enters the range 20050201 to 20050208 ,then obviously the select statement should fetch all the items in the range.i.e., for 20050201,20050202,20050203,...20050208.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then the select statement should fetch&lt;/P&gt;&lt;P&gt;'20050201111111','2005020122222',etc.,&lt;/P&gt;&lt;P&gt;'20050202111111','2005020222222',etc.,&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;'20050208111111','2005020822222',etc.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the details are not irrelevant.Since it is in select-options,we are supposed to do like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this answered your question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 10:23:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981170#M72001</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-07-13T10:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981171#M72002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;My problem is the system is fetching 20000808111111 although i input 20050201 on the selection screen.&lt;/P&gt;&lt;P&gt;This is totally irrelevant....&amp;gt;&amp;lt;....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 10:27:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981171#M72002</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-13T10:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981172#M72003</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;If you are using no-extension,then you can use between.. and .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the sample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data v(8).&lt;/P&gt;&lt;P&gt;data itab type standard table of TSP02.&lt;/P&gt;&lt;P&gt;data wa type TSP02.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS S_CDATE FOR v &amp;lt;b&amp;gt;no-extension&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;DATA TXT(9) TYPE C .&lt;/P&gt;&lt;P&gt;ranges r_cdate for txt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at s_cdate.&lt;/P&gt;&lt;P&gt;CONCATENATE s_cdate-low&lt;EM&gt;0(2) s_cdate-low&lt;/EM&gt;2(2) s_cdate-low+4(2)&lt;/P&gt;&lt;P&gt;s_cdate-low+6(2) '%' into r_cdate-low.&lt;/P&gt;&lt;P&gt;CONCATENATE s_cdate-high&lt;EM&gt;0(2) s_cdate-high&lt;/EM&gt;2(2) s_cdate-high+4(2)&lt;/P&gt;&lt;P&gt;s_cdate-high+6(2) '%' into r_cdate-high .&lt;/P&gt;&lt;P&gt;r_cdate-sign = s_cdate-sign.&lt;/P&gt;&lt;P&gt;r_cdate-option = s_cdate-option.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;select * from TSP02 into table itab&lt;/P&gt;&lt;P&gt;where PJCREATIME between r_cdate-low&lt;/P&gt;&lt;P&gt; and r_cdate-high.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by pjcreatime.&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt;write : / wa-PJIDENT , wa-pjcreatime.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise,it's very much complicated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2005 11:53:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981172#M72003</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-07-13T11:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981173#M72004</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;Thanks for your help.&lt;/P&gt;&lt;P&gt;That is what I want.&lt;/P&gt;&lt;P&gt;But there is a retrieval problem for r_cdate-high.&lt;/P&gt;&lt;P&gt;Say I input S_CDATE from 10.07.2005 to 13.07.2005&lt;/P&gt;&lt;P&gt;But the SQL only retrieves the data from 10.07.2005 up to 12.07.2005.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there anything wrong? (The database table does contain data for 13.07.2005)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2005 03:13:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981173#M72004</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-14T03:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981174#M72005</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;I am also able to see the problem.&lt;/P&gt;&lt;P&gt;Here is the modified sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data v(8).&lt;/P&gt;&lt;P&gt;data itab type standard table of TSP02.&lt;/P&gt;&lt;P&gt;data wa type TSP02.&lt;/P&gt;&lt;P&gt;DATA TXT(9) TYPE C .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS S_CDATE FOR v no-extension.&lt;/P&gt;&lt;P&gt;ranges r_cdate for txt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE s_cdate-low&lt;EM&gt;0(2) s_cdate-low&lt;/EM&gt;2(2) s_cdate-low+4(2)&lt;/P&gt;&lt;P&gt;s_cdate-low+6(2) '%' into r_cdate-low.&lt;/P&gt;&lt;P&gt;CONCATENATE s_cdate-high&lt;EM&gt;0(2) s_cdate-high&lt;/EM&gt;2(2) s_cdate-high+4(2)&lt;/P&gt;&lt;P&gt;s_cdate-high+6(2) '%' into r_cdate-high .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from TSP02 into table itab&lt;/P&gt;&lt;P&gt;where PJCREATIME between r_cdate-low and r_cdate-high or&lt;/P&gt;&lt;P&gt;pjcreatime like r_cdate-high.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by pjcreatime.&lt;/P&gt;&lt;P&gt;loop at itab into wa.&lt;/P&gt;&lt;P&gt;write : / wa-PJIDENT , wa-pjcreatime.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this meets your requirement.If so,could you please reward points for useful answers and close the thread?&lt;/P&gt;&lt;P&gt;If you need more clarifications,get back.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2005 03:42:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981174#M72005</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-07-14T03:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981175#M72006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much, &lt;/P&gt;&lt;P&gt;I just added 1 day to the s_cdate. It works too. &lt;SUP&gt;.&lt;/SUP&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2005 04:30:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981175#M72006</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-14T04:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to define this SQL ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981176#M72007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By the way,&lt;/P&gt;&lt;P&gt;I just found a bug.&lt;/P&gt;&lt;P&gt;If I only specify the s_cdate-low to be &amp;gt;=20050710 on the selection screen,&lt;/P&gt;&lt;P&gt;it only retrieves the date with 20050710, but the date like 20050711, 20050712, 20050713 cannot be retrieved.&lt;/P&gt;&lt;P&gt;What should I do ?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2005 09:11:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-this-sql/m-p/981176#M72007</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-14T09:11:27Z</dc:date>
    </item>
  </channel>
</rss>

