<?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: select query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547088#M853381</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;*p_carr is the selection parameter.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;declare a dummy variable to hold the *, here tmp2 is used&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;PARAMETER : p_carr TYPE sflight-carrid.&lt;/P&gt;&lt;P&gt;tmp = p_carr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SPLIT tmp AT '&lt;STRONG&gt;' INTO tmp tmp2.  " here the characters before '&lt;/STRONG&gt;' is moved to tmp.&lt;/P&gt;&lt;P&gt;CONCATENATE tmp '%' INTO tmp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;  FROM sflight&lt;/P&gt;&lt;P&gt;     INTO TABLE it_sflight&lt;/P&gt;&lt;P&gt;WHERE carrid LIKE tmp.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Mar 2008 10:06:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-28T10:06:27Z</dc:date>
    <item>
      <title>select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547083#M853376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now im encountered with one big issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok now my scenario is based on user inputs i need to display some values to table control from data base.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on user inputs means if user enters a* means i need to displays all data's that are starting with a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For that i tried with this following select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select * from sflight into corresponding fields of table itab_sflight where carrid like 'a%' .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above code is working fine. But my problem is the user input is stored in one variable. For example the user input now stored in variable 'Temp'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now how can i write the select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select * from sflight into corresponding fields of table itab_sflight where carrid like temp% .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;every body knows the above select quey is not working. So i want to replace the above variable 'temp' to data 'a'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope i explained clearly. Other wise i'll come again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and points will rewarded for all responces.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2008 08:43:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547083#M853376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-28T08:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547084#M853377</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;Do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameter: p_string type string.

data: gv_string type string.

start-of-selection.

gv_string = p_string+1(1) "To take only 1st position

concatenate gv_string '%' into gv_string.

select * from sflight into corresponding fields of table itab_sflight where carrid eq gv_string.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2008 08:50:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547084#M853377</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-28T08:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547085#M853378</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;The second statement wont accept since the special chars are mentioned which are not allowed &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the % should within the quote or move it to a variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the below code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameter:  temp type sflight-carrid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : itab_sflight type standard table of sflight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate temp  '%' into temp.&lt;/P&gt;&lt;P&gt;select * from sflight into corresponding fields of table itab_sflight&lt;/P&gt;&lt;P&gt; up to 10 rows&lt;/P&gt;&lt;P&gt;where carrid like temp.&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;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2008 08:55:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547085#M853378</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-28T08:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547086#M853379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi do like this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;      matnr like mara-matnr,&lt;/P&gt;&lt;P&gt;      end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      select matnr from mara into table itab up to 10 rows where matnr like '0%'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        loop at itab where matnr ca '0'.&lt;/P&gt;&lt;P&gt;        write:/ itab-matnr.&lt;/P&gt;&lt;P&gt;        endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2008 08:59:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547086#M853379</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-28T08:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547087#M853380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your answer is almost correct. You gave the answer like 'carrid eq gv_string'. But it should be 'carrid like gv_string'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siva Solves the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway thanks experts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2008 09:23:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547087#M853380</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-28T09:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547088#M853381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;*p_carr is the selection parameter.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;declare a dummy variable to hold the *, here tmp2 is used&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;PARAMETER : p_carr TYPE sflight-carrid.&lt;/P&gt;&lt;P&gt;tmp = p_carr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SPLIT tmp AT '&lt;STRONG&gt;' INTO tmp tmp2.  " here the characters before '&lt;/STRONG&gt;' is moved to tmp.&lt;/P&gt;&lt;P&gt;CONCATENATE tmp '%' INTO tmp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;  FROM sflight&lt;/P&gt;&lt;P&gt;     INTO TABLE it_sflight&lt;/P&gt;&lt;P&gt;WHERE carrid LIKE tmp.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2008 10:06:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3547088#M853381</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-28T10:06:27Z</dc:date>
    </item>
  </channel>
</rss>

