<?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: Complex queries in Open SQL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100767#M1183596</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've often used the OPEN SQL only when a very large number of records could be extracted from a database, because it can split the data to be extracted in many packages and then works with a single package.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solution can often improve the performance: I corrected a job it took about one day,now it takes only 40 minutes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Jan 2009 09:28:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-01-21T09:28:18Z</dc:date>
    <item>
      <title>Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100763#M1183592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moved to performance forum by moderator&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is more of a discussion rather than a question. I would like to know the advantages of Open SQL. It prevents you from writing complex queries, the kind of queries that you can write in native sql. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The biggest disadvantage I feel is that you have to fetch data into internal tables and loop. This takes a lot of processing time when you have a report having a lot of lines. A complex query using complex joins and subqueries will always perform better than having to loop and process data and simple things like generating sequence. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best thing about open sql is the way it handles select options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to get your opinions and suggestions how to write complex queries in ABAP with some code snippets if possible. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Warm Regards,&lt;/P&gt;&lt;P&gt;Abdullah&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Matt on Jan 21, 2009 6:54 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 08:49:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100763#M1183592</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-21T08:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100764#M1183593</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;Refer to this link [Open SQL vs Native SQL|http://www.itcserver.com/blog/2006/06/26/open-sql-vs-native-sql/]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 08:55:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100764#M1183593</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-21T08:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100765#M1183594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can I get a link to any site that explains about writing complex queries in &lt;STRONG&gt;open sql&lt;/STRONG&gt; or any book available in the market on the same?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 09:06:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100765#M1183594</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-21T09:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100766#M1183595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; The biggest disadvantage I feel is that you have to fetch data into internal tables and loop. This takes a lot of processing time when you have a report having a lot of lines. A complex query using complex joins and subqueries will always perform better than having to loop and process data and simple things like generating sequence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, you don't &lt;EM&gt;have&lt;/EM&gt; to work with internal tables, you can as well use SELECT ... ENDSELECT into a workarea and write your lines inside the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; The best thing about open sql is the way it handles select options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's a nice feature, but even better is that as an ABAP developer you (normally) need not care about the details of the underlying database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 09:18:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100766#M1183595</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2009-01-21T09:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100767#M1183596</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've often used the OPEN SQL only when a very large number of records could be extracted from a database, because it can split the data to be extracted in many packages and then works with a single package.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solution can often improve the performance: I corrected a job it took about one day,now it takes only 40 minutes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 09:28:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100767#M1183596</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-21T09:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100768#M1183597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select - endselect will query the database repeatedly and wont be any different from using a loop on internal table. the performance might still degrade. A complex query is still a single query.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 09:36:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100768#M1183597</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-21T09:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100769#M1183598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; select - endselect will query the database repeatedly and wont be any different from using a loop on internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's not true. See the last reply in the following thread. Or can you back up your statement with text references or own runtime measurements?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="thread" id="1202972"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have already asked to have your thread moved to that forum, looking forward to the discussions there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 09:54:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100769#M1183598</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2009-01-21T09:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100770#M1183599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From the help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"All Native SQL statements bypass SAP buffering. Automatic client handling is not performed."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, native SQL allows you to do some database specific operations (like translating to upper case).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 14:45:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100770#M1183599</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-21T14:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100771#M1183600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand why SAP hasn't tried to meet in the middle in terms of certain runtime functionality&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Most databases use substring, case, if/then evaluation, etc.  So why can't SAP implement a substring, uppercase, etc, that can be translated in the DBI to the native equivalent?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A lot of coding could be avoided if SAP would go in this direction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I (I'm dating myself) coded COBOL in the early 90s.  There are constructs in COBOL, which is probably older than most people in this forum, that are more powerful than ABAP.  For example, REDEFINES, Structure levels.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 15:08:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100771#M1183600</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-21T15:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100772#M1183601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Most databases use ...&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I think open SQL has to be all things to all database platforms. If &lt;EM&gt;any&lt;/EM&gt; platform doesn't support a construct, then it can't be used in open SQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 15:15:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100772#M1183601</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-21T15:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100773#M1183602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right.  But my point is if Oracle uses (for example) UPPER() and DB2 uses TO_UPPER(), why can't the DBI translate an operator in OpenSQL its the native equivalent?  That seems pretty easy to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ABAP's database interface is about the weakest I've ever worked with.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 15:29:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100773#M1183602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-21T15:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100774#M1183603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, my point was - what if any platform has no upper function at all?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 15:32:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100774#M1183603</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-21T15:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100775#M1183604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Agreed.  They would have to be common across all platforms.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2009 15:34:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100775#M1183604</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-21T15:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100776#M1183605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; select - endselect will query the database repeatedly and wont be any different from using a loop on&lt;/P&gt;&lt;P&gt;&amp;gt; internal table.&lt;/P&gt;&lt;P&gt;that is a  very common misunderstanding, but not true, it uses the arry interface, but gives you the possibility to react on every line. But interaction with DB is in blocks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The biggest advantage of Open SQL is the implementation of the table buffer, every Open SQL Statement checks the buffers first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other advantage, all statements changing table definitions are not allowed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And of course, as already said, it is a set of commands available on all DB platforms certified for SAP software, i.e. IBM, Oracle, Max DB and Microsoft.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Complex queries, even with the available joins you can write very very complex queries ... sometimes too complex. I see not advantage for a competetion of writing the most complex statement &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2009 09:32:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100776#M1183605</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-22T09:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Complex queries in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100777#M1183606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks a lot every one. The best option here I feel is to use native SQL for my scenario.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Mar 2009 13:58:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/complex-queries-in-open-sql/m-p/5100777#M1183606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-12T13:58:04Z</dc:date>
    </item>
  </channel>
</rss>

