<?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 when readign a table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797732#M1123521</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;if you want to use binary search then you should sort your internal table or else not required.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Nov 2008 05:37:24 GMT</pubDate>
    <dc:creator>GauthamV</dc:creator>
    <dc:date>2008-11-21T05:37:24Z</dc:date>
    <item>
      <title>BINARY SEARCH when readign a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797731#M1123520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ABAP experts,&lt;/P&gt;&lt;P&gt;I have a question on READ TABLE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an internal table say INT_TAB with say 5 fields already filled and 3 more that need to be filled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I loop at internal table into WA_TAB.&lt;/P&gt;&lt;P&gt;Then I read table INT_TAB2 INTO WA_TAB2 &lt;/P&gt;&lt;P&gt;WITH KEY field1 = WA_TAB-field1&lt;/P&gt;&lt;P&gt;AND          field2 = WA_TAB-field2&lt;/P&gt;&lt;P&gt; BINARY SEARCH.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before reading and before looping I sort INT_TAB2 by both the key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My observation is that when I use BINARY SEARCH, for some recods this field gets populated which is OKAY, but for some records it is blank, I then check in SE16 an find that actually the table-field has a non blank value which should have been read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However when I remove BINARY SEARCH, it does work, but I feel removing it may slow the processes and hamper performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2008 05:34:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797731#M1123520</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-21T05:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: BINARY SEARCH when readign a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797732#M1123521</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;if you want to use binary search then you should sort your internal table or else not required.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2008 05:37:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797732#M1123521</guid>
      <dc:creator>GauthamV</dc:creator>
      <dc:date>2008-11-21T05:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: BINARY SEARCH when readign a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797733#M1123522</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; The order of the field in sort should be same as in condition of Read Statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2008 05:38:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797733#M1123522</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-21T05:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: BINARY SEARCH when readign a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797734#M1123523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like you are doing everything right however what I did miss was what you are doing with SYS-SUBRC after the read with binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The read with binary search will position you to the right row (SYS-TABIX).&lt;/P&gt;&lt;P&gt;However the right row might be between keys (not found).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read up in the help about the various meanings of SYS-SUBRC after the read with binary search. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The read does not need to bring back any fields at all and may just be used for positioning. (transporting no fields).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have fun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2008 05:48:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797734#M1123523</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-21T05:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: BINARY SEARCH when readign a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797735#M1123524</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;check the order of field in which you are sorting and how you have applied them in WITH KEY condition ,they sould be same,secondly check How you have sorted it,It should always be sorted in &lt;STRONG&gt;Ascending Order&lt;/STRONG&gt; not in descending.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2008 05:50:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797735#M1123524</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-21T05:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: BINARY SEARCH when readign a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797736#M1123525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check following. it can give wrong result in both the cases.&lt;/P&gt;&lt;P&gt;Is internal table sorted with both the key fields ?&lt;/P&gt;&lt;P&gt;Are there multiple records with same values for key fields ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2008 05:56:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797736#M1123525</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-21T05:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: BINARY SEARCH when readign a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797737#M1123526</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;The problem for this might be with the sort condition,&lt;/P&gt;&lt;P&gt;you need to sort the table with the field, which you are using in the WITH KEY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have faced the same situation, when i checked it, i found that the problem is with the sorting thing.&lt;/P&gt;&lt;P&gt;so, better check the sorting condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;even if the problem persists, then post the same..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sunny.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: sunny suren chilievru on Nov 21, 2008 7:43 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2008 06:42:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797737#M1123526</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-21T06:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: BINARY SEARCH when readign a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797738#M1123527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The problem might be that you are sorting by f1,f2,f3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when reading you are reading with key f2,f1 and f3 .&lt;/P&gt;&lt;P&gt;the sorting and Read sequence should be same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sandipan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2008 07:11:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797738#M1123527</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-21T07:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: BINARY SEARCH when readign a table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797739#M1123528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you said, the sort condition is done. Assuming that &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop INT_TAB into wa_tab.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;read ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One question is that, do you have the required data in INT_TAB2? You said, you have the data in SE16. But is that fetched and updated in INT_TAB2?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2008 07:22:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-when-readign-a-table/m-p/4797739#M1123528</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-21T07:22:25Z</dc:date>
    </item>
  </channel>
</rss>

