<?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 a sorted internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375323#M184067</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ryan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the prerequisite for a binary search on an internal table is it should be sorted.&lt;/P&gt;&lt;P&gt;READ TABLE itab WITH KEY k1 = v1 ... kn = vn &lt;/P&gt;&lt;P&gt;[BINARY SEARCH] [additions].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;The system evaluates the specified key to identify the correct line. If the type of a value is not compatible with the type of the corresponding key field, the system uses MOVE logic to convert the value into the type of the component before reading the table. This is an asymmetric comparison logic, in which the component type takes precedence over the value type. &lt;/P&gt;&lt;P&gt;The way in which the system looks for an entry in the table depends on its table type. The system optimizeds the key access whenever possible&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORTED TABLE: &lt;/P&gt;&lt;P&gt;If the specified key fields form a left-justified extract of the table key or are identical with the entire table key, the search is binary, otherwise sequential.&lt;/P&gt;&lt;P&gt;HOPE THIS HELPS,&lt;/P&gt;&lt;P&gt;priya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Jun 2006 15:54:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-07T15:54:46Z</dc:date>
    <item>
      <title>Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375321#M184065</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;Can I do a binary search for a sorted internal table? I used to use binary search in a standard table after sort it. But I really don't know how I can use the binary search for the defined sorted internal table. For example:&lt;/P&gt;&lt;P&gt;DATA IT_TBL LIKE SORTED TABLE OF SER03 WITH NON-UNIQUE KEY ZEILE MBLNR WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Ryan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 15:53:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375321#M184065</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T15:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375322#M184066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;read table itab with key field1 = v_field binary search.&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 15:54:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375322#M184066</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T15:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375323#M184067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ryan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the prerequisite for a binary search on an internal table is it should be sorted.&lt;/P&gt;&lt;P&gt;READ TABLE itab WITH KEY k1 = v1 ... kn = vn &lt;/P&gt;&lt;P&gt;[BINARY SEARCH] [additions].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;The system evaluates the specified key to identify the correct line. If the type of a value is not compatible with the type of the corresponding key field, the system uses MOVE logic to convert the value into the type of the component before reading the table. This is an asymmetric comparison logic, in which the component type takes precedence over the value type. &lt;/P&gt;&lt;P&gt;The way in which the system looks for an entry in the table depends on its table type. The system optimizeds the key access whenever possible&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORTED TABLE: &lt;/P&gt;&lt;P&gt;If the specified key fields form a left-justified extract of the table key or are identical with the entire table key, the search is binary, otherwise sequential.&lt;/P&gt;&lt;P&gt;HOPE THIS HELPS,&lt;/P&gt;&lt;P&gt;priya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 15:54:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375323#M184067</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T15:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375324#M184068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Ryan,&lt;/P&gt;&lt;P&gt;   Binary Search is generally used for Read Statement statement I am not sure that you can use the same for Internal tables too i.e, the way in which you have used...&lt;/P&gt;&lt;P&gt;  i.e, &amp;lt;b&amp;gt;READ TABLE ITAB WITH KEY MATNR = IT_MATNR binary search.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 15:55:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375324#M184068</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T15:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375325#M184069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi u should binary search for a sorted internal tables, that makes sense otherwise the performance is the same as it was previously... generally used with the read statements...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT T_VBRK_VBRP.
    V_SYTAB = SY-TABIX.
    AT NEW VBELN.
      READ TABLE T_VBRK_VBRP INDEX V_SYTAB.
      &amp;lt;b&amp;gt;READ TABLE IT_VBRK WITH KEY VBELN = T_VBRK_VBRP-VBELN BINARY SEARCH.&amp;lt;/b&amp;gt;      
IF SY-SUBRC = 0.
        T_VBRK_VBRP-FKDAT = IT_VBRK-FKDAT.
        MODIFY T_VBRK_VBRP  TRANSPORTING FKDAT
                  WHERE VBELN = IT_VBRK-VBELN.
      ENDIF.
    ENDAT.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please award points if found helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 15:56:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375325#M184069</guid>
      <dc:creator>rahulkavuri</dc:creator>
      <dc:date>2006-06-07T15:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375326#M184070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes you can.. press F1 on Binary &amp;amp; SAP help explains you the way it searches on  a SORTED table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suresh Datti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 15:56:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375326#M184070</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2006-06-07T15:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375327#M184071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, Ravi that is the way I try to use. It works for the standard table after I sort it. But it doesn't work for the defined sorted table. When I use&lt;/P&gt;&lt;P&gt;read table it_tbl with table key mblnr = m zeile = z binary search.&lt;/P&gt;&lt;P&gt;The error is:&lt;/P&gt;&lt;P&gt;The addition "binary search" cannot be used with index access or general table search.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 15:59:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375327#M184071</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T15:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375328#M184072</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 need to use ZEILE MBLNR keys while using binary serach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;read table itab with key zeile = '000'
                         MBLNR = v_mblnr binary search.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 15:59:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375328#M184072</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T15:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375329#M184073</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;Yes you can do that but you will be able to use only the keys which are already define for the sorted table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use any other key than the already defined once you will get error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You acn check the define keys by double clicking the type and going to key tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points if it helps.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 15:59:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375329#M184073</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T15:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375330#M184074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;remove table &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;read table it_tbl with &amp;lt;b&amp;gt;table&amp;lt;/b&amp;gt; key mblnr = m zeile = z binary search.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and use it.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;read table it_tbl with key mblnr = m zeile = z binary search.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 16:01:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375330#M184074</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T16:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375331#M184075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  Since it is sorted table u cant sort the table again by any other key. &lt;/P&gt;&lt;P&gt;sorted table are alawys in sorted order .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u can use binary search for sorted table with the key define for sorting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u cant use any other key to sort the table again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 16:05:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375331#M184075</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T16:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Binary search a sorted internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375332#M184076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;after remove TABLE, it works. thanks for you all!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2006 16:06:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-a-sorted-internal-table/m-p/1375332#M184076</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-07T16:06:12Z</dc:date>
    </item>
  </channel>
</rss>

