<?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 Query in Select query operation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-query-operation/m-p/1493850#M229432</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please excuse me for posting this again.&lt;/P&gt;&lt;P&gt;I'm stuck up with this for 3 days. Lenghty post pls do read and help me.&lt;/P&gt;&lt;P&gt;How is the select query going to be changed in the SAP so that the original database behind it understands it. I want to know the operation of IN operation in where clause where in we can use ranges.&lt;/P&gt;&lt;P&gt;I'm asking this because I'm facing a problem using Native SQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Query is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN C1 for &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT field1 from table@domain where field2 IN :ABAP_VAR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL.&lt;/P&gt;&lt;P&gt;FETCH C1 NEXT INTO :VAR1 , :VAR2&lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oracle usually recognises this statement IN ( '2222' , '3658' , '6895' )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But here this field that is build dynamically like this is not recognising them as seperate fileds but instead it is taking them as a single string and not selecting anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if a single value is passed it is fetching the data into the cursor. And the code is working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help in this is highly appreciable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Aug 2006 04:57:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-08-18T04:57:33Z</dc:date>
    <item>
      <title>Query in Select query operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-query-operation/m-p/1493850#M229432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please excuse me for posting this again.&lt;/P&gt;&lt;P&gt;I'm stuck up with this for 3 days. Lenghty post pls do read and help me.&lt;/P&gt;&lt;P&gt;How is the select query going to be changed in the SAP so that the original database behind it understands it. I want to know the operation of IN operation in where clause where in we can use ranges.&lt;/P&gt;&lt;P&gt;I'm asking this because I'm facing a problem using Native SQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Query is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN C1 for &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT field1 from table@domain where field2 IN :ABAP_VAR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL.&lt;/P&gt;&lt;P&gt;FETCH C1 NEXT INTO :VAR1 , :VAR2&lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oracle usually recognises this statement IN ( '2222' , '3658' , '6895' )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But here this field that is build dynamically like this is not recognising them as seperate fileds but instead it is taking them as a single string and not selecting anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if a single value is passed it is fetching the data into the cursor. And the code is working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help in this is highly appreciable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2006 04:57:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-query-operation/m-p/1493850#M229432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-18T04:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Query in Select query operation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-query-operation/m-p/1493851#M229433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"if a in r_range" is is effectively: does the value held in 'a' comply with the values held in range 'r_range'. Ranges can hold NE, patterns etc so this can get quite complex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see that it is very different from the SQL type IN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your range hold several values you could unstrip it into a string varaible so that it ended up having a value something like: ( '2222' , '3658' , '6895' ). Not sure if you need the '(' but it would be something like this:&lt;/P&gt;&lt;P&gt;eg,&lt;/P&gt;&lt;P&gt;assuming your range is simple and only holds 'I' and 'EQ' values:&lt;/P&gt;&lt;P&gt;data v_string type string.&lt;/P&gt;&lt;P&gt;loop at r_range.&lt;/P&gt;&lt;P&gt;concatenate v_string '@''' r_range-low  '''@' into v_string. &lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;REPLACE &lt;/P&gt;&lt;P&gt;  ALL OCCURRENCES OF '@' &lt;/P&gt;&lt;P&gt;  IN v_string&lt;/P&gt;&lt;P&gt;  WITH ' '.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can use:&lt;/P&gt;&lt;P&gt;SELECT field1 from table@domain where field2 IN :v_string.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2006 05:18:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-query-operation/m-p/1493851#M229433</guid>
      <dc:creator>former_member186741</dc:creator>
      <dc:date>2006-08-18T05:18:14Z</dc:date>
    </item>
  </channel>
</rss>

