<?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: How to read an internal table using binary search. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756994#M327890</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balaji,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to SORT the internal table with the field you are using in BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB BY MATNR.&lt;/P&gt;&lt;P&gt;READ TABLE ITAB WITH KEY MATNTR = &amp;lt;VALUE&amp;gt; BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Nov 2006 14:13:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-29T14:13:41Z</dc:date>
    <item>
      <title>How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756988#M327884</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;          when I was reading an internal table with binary search I was not getting proper results but when I was reading internable without binary search means I was getting perfect results .What might be the reason.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Balaji.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2006 14:09:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756988#M327884</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-29T14:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756989#M327885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A pre-requisite to use binary search is that you should have sorted the table by the field with which you are searching.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you done that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;P&gt;Note - Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2006 14:10:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756989#M327885</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-29T14:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756990#M327886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balaji,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort the internal table, before you use the binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sort itab by key1.
read table itab with key key1 = value1 binary search.
       &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2006 14:11:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756990#M327886</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-29T14:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756991#M327887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balaji,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before read the internal table you have to sort the internal table what you are reading for example&lt;/P&gt;&lt;P&gt;SORT IT_EKKO BY EBELN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    READ TABLE IT_EKKO WITH KEY EBELN = IT_EKPO-EBELN BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Vikranth Khimavath&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Khimavath Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2006 14:12:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756991#M327887</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-29T14:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756992#M327888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Balaji,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb373d358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb373d358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&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, 29 Nov 2006 14:13:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756992#M327888</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-29T14:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756993#M327889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;Sort the internal table on the key  always before using binary search.&lt;/P&gt;&lt;P&gt;Sort itab by key1.&lt;/P&gt;&lt;P&gt;read table itab with key1 = value binary earch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2006 14:13:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756993#M327889</guid>
      <dc:creator>Sandeep_Panghal</dc:creator>
      <dc:date>2006-11-29T14:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756994#M327890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balaji,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to SORT the internal table with the field you are using in BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB BY MATNR.&lt;/P&gt;&lt;P&gt;READ TABLE ITAB WITH KEY MATNTR = &amp;lt;VALUE&amp;gt; BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2006 14:13:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756994#M327890</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-29T14:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756995#M327891</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 internal table should be sorted by the key (all the fields in WITH KEY) what you are using for READ. Use the fields in &amp;lt;b&amp;gt;Order&amp;lt;/b&amp;gt; in both the places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Surya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2006 14:15:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756995#M327891</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-29T14:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756996#M327892</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 is required to sort the internal table by the fields that you are using to read the table.&lt;/P&gt;&lt;P&gt;If you want to read table t_itab with vbeln and posnr and use binary search then you need to sort &lt;/P&gt;&lt;P&gt;t_itab by vbeln posnr.&lt;/P&gt;&lt;P&gt;read table t_itab into wa_itab with key vbeln = &amp;lt;sales order&amp;gt;&lt;/P&gt;&lt;P&gt;                                                        posnr = &amp;lt;item &amp;gt;&lt;/P&gt;&lt;P&gt;                                                        binary search.&lt;/P&gt;&lt;P&gt;If the table is sorted then only binary search works else not..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this makes it clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shahu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2006 14:24:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756996#M327892</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-29T14:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756997#M327893</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;          thanks for all your replies.I sorted the internal table as u all said.Suppose I have three fields    field1,field2,field3 in the internal table itab.I am sorting using only field1 and field2 but not field3.I am reading the internal table with all the three fields.In this scenarion I am using binary search .But the results are not perfect .The results are perfect in the absence of binary search in this scenario.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So do I need to sort all the three fields field1,field2,field3 to get correct results.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Balaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2006 16:45:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756997#M327893</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-29T16:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756998#M327894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes.&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, 29 Nov 2006 16:47:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/1756998#M327894</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-29T16:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an internal table using binary search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/13710507#M2028157</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;sort your internal table.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;SORT&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;itab&amp;nbsp;&lt;SPAN class=""&gt;BY&amp;nbsp;&lt;/SPAN&gt;EBELN.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;!--  StartFragment   --&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;LOOP&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;AT&amp;nbsp;&lt;/SPAN&gt;itab2&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;ASSIGNING&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;FIELD&lt;/SPAN&gt;&lt;SPAN class=""&gt;-&lt;/SPAN&gt;&lt;SPAN class=""&gt;SYMBOL&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&amp;lt;WA_ITM&amp;gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;!--  StartFragment   --&gt;&amp;nbsp;&lt;SPAN class=""&gt;READ&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;TABLE&amp;nbsp;&lt;/SPAN&gt;itab&amp;nbsp;&lt;SPAN class=""&gt;INTO&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;DATA&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;WA)&amp;nbsp;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;WITH&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;KEY&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;EBELN&amp;nbsp;&lt;SPAN class=""&gt;= &amp;lt;WA_ITM&amp;gt;-ebeln&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class=""&gt;BINARY&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;SEARCH&lt;/SPAN&gt;&lt;SPAN class=""&gt;.&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;endloop.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 09:40:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-read-an-internal-table-using-binary-search/m-p/13710507#M2028157</guid>
      <dc:creator>Muthyal_Reddy</dc:creator>
      <dc:date>2024-05-23T09:40:07Z</dc:date>
    </item>
  </channel>
</rss>

