<?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: Binary Search in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143143#M451712</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;it will be better if u write like first statement, bcoz it is as per standard.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you for this and for your previous post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Award all helpful answers and close the post as answered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Apr 2007 12:04:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-10T12:04:32Z</dc:date>
    <item>
      <title>Binary Search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143139#M451708</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;data: begin of t_kna1 occurs 0,&lt;/P&gt;&lt;P&gt;        kunnr like kna1-kunnr,&lt;/P&gt;&lt;P&gt;        name1 like kna1-name1,&lt;/P&gt;&lt;P&gt;        end of t_kna1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select kunnr name1 from kna1 into table t_kna1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort t_kna1 by kunnr name1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_bseg. &lt;/P&gt;&lt;P&gt;read table t_kna1 with key kunnr = t_bseg-kunnr  name1 = t_bseg-name1&lt;/P&gt;&lt;P&gt;                                                                                binary search.&lt;/P&gt;&lt;P&gt;............&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at t_bseg. &lt;/P&gt;&lt;P&gt;read table t_kna1 with key name1 = t_bseg-name1&lt;/P&gt;&lt;P&gt;                                       kunnr = t_bseg-kunnr binary search.&lt;/P&gt;&lt;P&gt;............&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above sample code we are reading the table t_kna1 with different key sequence.What is difference in that which should be followed why? whether the second one is wrong or what?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2007 11:57:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143139#M451708</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-10T11:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143140#M451709</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 can only use the binary search for fields on which the table is sorted.&lt;/P&gt;&lt;P&gt;So the first READ TABLE is working, the second IS NOT !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can add a SORT T_KNA BY NAME1 KUNNR before the second loop-statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Hans&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward all helpful answers !!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2007 12:00:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143140#M451709</guid>
      <dc:creator>h_senden2</dc:creator>
      <dc:date>2007-04-10T12:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143141#M451710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In both cases no need to use NAME1 field as key field to read, as it is a description field.&lt;/P&gt;&lt;P&gt;Right thing is:&lt;/P&gt;&lt;P&gt;read table t_kna1 with key kunnr = t_bseg-kunnr binary search.&lt;/P&gt;&lt;P&gt;binary search reads data fast.&lt;/P&gt;&lt;P&gt;But you must sort the internal table first with that field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if useful&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;ANJI&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2007 12:01:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143141#M451710</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-10T12:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143142#M451711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shri,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It depends on the requirement for searching in the internal table..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both are correct but you have to sort for that particular fields which you are using as key.( not to sort all the fields when one is required..)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2007 12:01:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143142#M451711</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-10T12:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143143#M451712</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;it will be better if u write like first statement, bcoz it is as per standard.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you for this and for your previous post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Award all helpful answers and close the post as answered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2007 12:04:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143143#M451712</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-10T12:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Search</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143144#M451713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sri ram,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there might be littel difference in reading the records from the internal table "&amp;lt;b&amp;gt;t_kna1&amp;lt;/b&amp;gt; " for the second and first case as the key sequence in the read statement is different.... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the &amp;lt;b&amp;gt;first case&amp;lt;/b&amp;gt; the records are read firstly based upon  the kunnnr and then based upon the name field...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whereas in the &amp;lt;b&amp;gt;second case&amp;lt;/b&amp;gt; as per the key sequnece in the read statement &lt;/P&gt;&lt;P&gt;the filtering of the read statement is done initially by the name 1 field and then the kunnr field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards ,&lt;/P&gt;&lt;P&gt;Ginni.&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2007 12:04:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search/m-p/2143144#M451713</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-10T12:04:36Z</dc:date>
    </item>
  </channel>
</rss>

