<?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: Please explain how to use binary search in this loop. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765695#M1462325</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry. My bad !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont understand why your BINARY SEARCH fails ? Do you have multiple records for the same keys in you table IT_EKBZ1 ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Apr 2010 06:45:35 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2010-04-06T06:45:35Z</dc:date>
    <item>
      <title>Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765686#M1462316</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;I want to use the binary search in below Read please give me solution....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;     
LOOP AT it_vbfa_temp ASSIGNING &amp;lt;fs_vbfa_temp&amp;gt;.

      CLEAR is_ekbz1.
      READ TABLE it_ekbz1 INTO is_ekbz1 WITH KEY xblnr = &amp;lt;fs_vbfa_temp&amp;gt;-deliv flag = space.

      IF  sy-subrc = 0.

        w_tabix = sy-tabix.

        is_ekbz1-tknum = &amp;lt;fs_vbfa_temp&amp;gt;-shipno.
        is_ekbz1-flag  = 'X'.

        MODIFY it_ekbz1 FROM is_ekbz1 INDEX w_tabix TRANSPORTING tknum flag.

 ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 03:03:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765686#M1462316</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T03:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765687#M1462317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="blue" __jive_macro_name="color"&gt;Hi Srinivas,
&amp;lt;li&amp;gt;If you want to use BINARY SEARCH with READ statement, First thing , Table must be sorted by Key fields which you mention in WITH KEY &amp;lt;key1&amp;gt; &amp;lt;key2&amp;gt;.
&lt;PRE&gt;&lt;CODE&gt;
SORT it_ekbz1 by xblnr flag.
"Then use read with BINARY SEARCH.
&lt;/CODE&gt;&lt;/PRE&gt;

Thanks
Venkat.O&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 03:19:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765687#M1462317</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2010-04-06T03:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765688#M1462318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Srininas ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please do like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SORT it_ekbz1 by xblnr.

LOOP AT it_vbfa_temp ASSIGNING &amp;lt;fs_vbfa_temp&amp;gt;.
 
      CLEAR is_ekbz1.
      READ TABLE it_ekbz1 INTO is_ekbz1 WITH KEY xblnr = &amp;lt;fs_vbfa_temp&amp;gt;-deliv flag = space BINARY SEARCH.
 
      IF  sy-subrc = 0.
 
        w_tabix = sy-tabix.
 
        is_ekbz1-tknum = &amp;lt;fs_vbfa_temp&amp;gt;-shipno.
        is_ekbz1-flag  = 'X'.
 
        MODIFY it_ekbz1 FROM is_ekbz1 INDEX w_tabix TRANSPORTING tknum flag.
 
 ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chinmay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chinmay Kumar Ghosh on Apr 6, 2010 9:08 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 03:38:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765688#M1462318</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T03:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765689#M1462319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Srininas, &lt;/P&gt;&lt;P&gt;  To use binary search you need to first sort the table preferabely with the field you want to use as the key in the read statement.&lt;/P&gt;&lt;P&gt;Once you have done this you can use the addition Binary search in the read statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in your case before the Loop statement use&lt;/P&gt;&lt;P&gt;Sort table it_ekbz1 by xblnr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the modified read statement will look like &lt;/P&gt;&lt;P&gt;READ TABLE it_ekbz1 INTO is_ekbz1 WITH KEY xblnr = &amp;lt;fs_vbfa_temp&amp;gt;-deliv flag = space binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 03:48:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765689#M1462319</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T03:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765690#M1462320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First sort the internal table on the key fields used in the read statement, then add the keyword "BINARY SEARCH" at the end of Read Statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 04:02:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765690#M1462320</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T04:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765691#M1462321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we are modifying any field which is using in the binary search in side the loop the binary search will not work ..Thats why i am unable to use binary search woth sorting the key Fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i have to use binary beacuse of the more number of records in both the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagrds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 06:21:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765691#M1462321</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T06:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765692#M1462322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Venkat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am modifying the key filed which is using in the search. If i used the binary search it is failing in lot of cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagrds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 06:24:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765692#M1462322</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T06:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765693#M1462323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How have you defined the table IT_EKBZ1 ? And in the code snippet you have posted i do not see you modifying the key field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 06:30:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765693#M1462323</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-04-06T06:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765694#M1462324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Suhas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am modifying the fieild FLAG which is using in the Read Statement inside the loop. Thats why i am unable to sort it before the loop and unable to use Binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagrds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 06:34:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765694#M1462324</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T06:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765695#M1462325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry. My bad !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont understand why your BINARY SEARCH fails ? Do you have multiple records for the same keys in you table IT_EKBZ1 ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 06:45:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765695#M1462325</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-04-06T06:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765696#M1462326</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;Thanks for the inputs given.. Please find the solution for the same ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 

   CLEAR is_ekbz1.
    is_ekbz1-flag = 'X'.
    MODIFY it_ekbz1 FROM is_ekbz1 TRANSPORTING flag WHERE flag IS INITIAL.

    SORT it_ekbz1 BY ebeln xblnr lifnr flag.


  LOOP AT it_vbfa_temp ASSIGNING &amp;lt;fs_vbfa_temp&amp;gt;.
 
      CLEAR is_ekbz1.
      READ TABLE it_ekbz1 INTO is_ekbz1 WITH KEY xblnr = &amp;lt;fs_vbfa_temp&amp;gt;-deliv flag = 'X' BINARY SEARCH.
 
      IF  sy-subrc = 0.
 
        w_tabix = sy-tabix.
 
        is_ekbz1-tknum = &amp;lt;fs_vbfa_temp&amp;gt;-shipno.
        is_ekbz1-flag  = space.
 
        MODIFY it_ekbz1 FROM is_ekbz1 INDEX w_tabix TRANSPORTING tknum flag.
 
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Srininas on Apr 6, 2010 12:16 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Srininas on Apr 6, 2010 12:17 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 06:45:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765696#M1462326</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T06:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765697#M1462327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;CLEAR is_ekbz1.&lt;/P&gt;&lt;P&gt;    is_ekbz1-flag = 'X'.&lt;/P&gt;&lt;P&gt;    MODIFY it_ekbz1 FROM is_ekbz1 TRANSPORTING flag WHERE flag IS INITIAL.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    SORT it_ekbz1 BY ebeln xblnr lifnr flag.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  LOOP AT it_vbfa_temp ASSIGNING &amp;lt;fs_vbfa_temp&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      CLEAR is_ekbz1.&lt;/P&gt;&lt;P&gt;      READ TABLE it_ekbz1 INTO is_ekbz1 WITH KEY xblnr = &amp;lt;fs_vbfa_temp&amp;gt;-deliv flag = 'X' BINARY SEARCH.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      IF  sy-subrc = 0.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        w_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        is_ekbz1-tknum = &amp;lt;fs_vbfa_temp&amp;gt;-shipno.&lt;/P&gt;&lt;P&gt;        is_ekbz1-flag  = space.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        MODIFY it_ekbz1 FROM is_ekbz1 INDEX w_tabix TRANSPORTING tknum flag.&lt;/P&gt;&lt;P&gt;        SORT it_ekbz1 BY ebeln xblnr lifnr flag.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 07:04:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765697#M1462327</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T07:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain how to use binary search in this loop.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765698#M1462328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sry In my las reply sorting wrong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Correct one is SORT it_ekbz1 By xblnr flag.&lt;/P&gt;&lt;P&gt;&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;Srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 08:22:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-how-to-use-binary-search-in-this-loop/m-p/6765698#M1462328</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T08:22:03Z</dc:date>
    </item>
  </channel>
</rss>

