<?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: Problem with Binary Search. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168060#M753747</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;Sort the internal table with all other fields, if you look at BKPF table you have BUKRS, BELNR, GJAHR and Monat are key fields. So sort based on these fields. Then read the table using binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then  also if you are facing problem. Then better to delete the Binary search, sometimes binary search leads to incorrect data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Dec 2007 07:12:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-18T07:12:21Z</dc:date>
    <item>
      <title>Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168051#M753738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus.&lt;/P&gt;&lt;P&gt;I am using binary search to read data from internal table with approx more than 3lacs records. Also my table is sorted by BUKRS BELNR. But the problem is that i am getting records from lower half of table only and first half of table is ignoring, so i am not able to get all records. If i use nornal search, i am geting 7856 records and if i use binary search, i am geting only 1786 records....Can anyone help me why this is happening????&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 04:45:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168051#M753738</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-18T04:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168052#M753739</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 you pls paste the code  so that we can check it &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;siva chalasani.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 04:49:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168052#M753739</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-18T04:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168053#M753740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The internal table must be sorted in ascending order by the specified search key and make sure it doesn't have duplicates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 04:52:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168053#M753740</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-18T04:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168054#M753741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi PV&lt;/P&gt;&lt;P&gt;Actually my table contain line items. I am reading header data from bkpf for a single day. and for that document nos i am fetching line items. But if i use join or for all entries, i will get time exceed errror. so i get Period of that single day and taking data for that period from BSIS and then reading BKPF.. and only taking that line items for which document no in BKPF...&lt;/P&gt;&lt;P&gt;my code is like&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: cpudt FOR sy-datum DEFAULT '20030102'.&lt;/P&gt;&lt;P&gt;SELECT bukrs belnr gjahr monat FROM bkpf&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE ibkpf&lt;/P&gt;&lt;P&gt;WHERE ( cpudt IN cpudt OR aedat IN cpudt ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ibkpf1[] = ibkpf[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ibkpf1 BY monat.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM ibkpf1 COMPARING monat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ibkpf1[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;  SELECT * FROM bsis INTO TABLE ibsis&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN ibkpf1 WHERE gjahr = ibkpf1-gjahr&lt;/P&gt;&lt;P&gt;                                 AND monat = ibkpf1-monat.&lt;/P&gt;&lt;P&gt;  SORT ibsis BY bukrs belnr.&lt;/P&gt;&lt;P&gt;  LOOP AT ibsis.&lt;/P&gt;&lt;P&gt;    READ TABLE ibkpf WITH KEY bukrs = ibsis-bukrs&lt;/P&gt;&lt;P&gt;                              belnr = ibsis-belnr&lt;/P&gt;&lt;P&gt;                              BINARY SEARCH.&lt;/P&gt;&lt;P&gt;    IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;      DELETE ibsis.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 05:07:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168054#M753741</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-18T05:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168055#M753742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;create  one workarea  and read the internal table into work area  like loop at  itab into wa_itab..&lt;/P&gt;&lt;P&gt;than it will work, whenever we use Read statement work area has to be defined...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Tirumal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 05:36:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168055#M753742</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-18T05:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168056#M753743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi PKB,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create one workarea and read the internal table into work area like loop at itab into wa_itab..than it will work, whenever we use Read statement work area has to be defined...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: cpudt FOR sy-datum DEFAULT '20030102'.&lt;/P&gt;&lt;P&gt;SELECT bukrs belnr gjahr monat FROM bkpf&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE ibkpf&lt;/P&gt;&lt;P&gt;WHERE ( cpudt IN cpudt OR aedat IN cpudt ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ibkpf1] = ibkpf[.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ibkpf1 BY monat.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM ibkpf1 COMPARING monat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ibkpf1[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;SELECT * FROM bsis INTO TABLE ibsis&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN ibkpf1 WHERE gjahr = ibkpf1-gjahr&lt;/P&gt;&lt;P&gt;AND monat = ibkpf1-monat.&lt;/P&gt;&lt;P&gt;SORT ibsis BY bukrs belnr.&lt;/P&gt;&lt;P&gt;LOOP AT ibsis.&lt;/P&gt;&lt;P&gt;*&lt;STRONG&gt;READ TABLE ibkpf  into wa_ibsis WITH KEY bukrs = ibsis-bukrs&lt;/STRONG&gt;*&lt;/P&gt;&lt;P&gt;belnr = ibsis-belnr&lt;/P&gt;&lt;P&gt;BINARY SEARCH.&lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;DELETE&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 07:04:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168056#M753743</guid>
      <dc:creator>former_member402443</dc:creator>
      <dc:date>2007-12-18T07:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168057#M753744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me regarding this problem..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 07:06:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168057#M753744</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-18T07:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168058#M753745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi PKB,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create one workarea and read the internal table into work area like loop at itab into wa_itab..than it will work, whenever we use Read statement work area has to be defined...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ibkpf1[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;SELECT * FROM bsis INTO TABLE ibsis&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN ibkpf1 WHERE gjahr = ibkpf1-gjahr&lt;/P&gt;&lt;P&gt;AND monat = ibkpf1-monat.&lt;/P&gt;&lt;P&gt;SORT ibsis BY bukrs belnr.&lt;/P&gt;&lt;P&gt;LOOP AT ibsis.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;READ TABLE ibkpf  into wa_ibsis WITH KEY bukrs = ibsis-bukrs&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;belnr = ibsis-belnr&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;and rest of the your code is okye.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rewards points if useful&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Manoj Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 07:07:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168058#M753745</guid>
      <dc:creator>former_member402443</dc:creator>
      <dc:date>2007-12-18T07:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168059#M753746</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;Sort the internal table with all other fields, if you look at BKPF table you have BUKRS, BELNR, GJAHR and Monat are key fields. So sort based on these fields. Then read the table using binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then  also if you are facing problem. Then better to delete the Binary search, sometimes binary search leads to incorrect data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 07:10:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168059#M753746</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-18T07:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168060#M753747</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;Sort the internal table with all other fields, if you look at BKPF table you have BUKRS, BELNR, GJAHR and Monat are key fields. So sort based on these fields. Then read the table using binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then  also if you are facing problem. Then better to delete the Binary search, sometimes binary search leads to incorrect data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 07:12:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168060#M753747</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-18T07:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168061#M753748</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;Sort the internal table with all other fields, if you look at BKPF table you have BUKRS, BELNR, GJAHR and Monat are key fields. So sort based on these fields. Then read the table using binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then  also if you are facing problem. Then better to delete the Binary search, sometimes binary search leads to incorrect data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 07:14:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168061#M753748</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-18T07:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Binary Search.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168062#M753749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi PKB,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whenever we are going to use READ TABLE using Binary Search what are the fields we are giving in the where condition that fields must be sorted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Selva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2007 07:51:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-binary-search/m-p/3168062#M753749</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-18T07:51:58Z</dc:date>
    </item>
  </channel>
</rss>

