<?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 with Dynamic Tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-with-dynamic-tables/m-p/7392686#M1545657</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sven,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No need to build your own Binary Search algo &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; You can use dynamic tokens with SORT &amp;amp; READ TABLE commands.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this code snippet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS: &amp;lt;itab&amp;gt; TYPE STANDARD TABLE.

SORT &amp;lt;itab&amp;gt; BY ('FIELD1') ('FIELD2').

READ TABLE &amp;lt;itab&amp;gt; TRANSPORTING NO FIELDS 
WITH KEY ('FIELD1') = VAL1
         ('FIELD2') = VAL2 BINARY SEARCH.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here FIELD1 &amp;amp; FIELD2 are components of the dynamic table &amp;lt;itab&amp;gt;.&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>Fri, 12 Nov 2010 09:13:48 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2010-11-12T09:13:48Z</dc:date>
    <item>
      <title>Binary Search with Dynamic Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-with-dynamic-tables/m-p/7392684#M1545655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i created a dynamic table using following code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
call method cl_alv_table_create=&amp;gt;create_dynamic_table
     exporting
       it_fieldcatalog = LT_FIELDCATALOG
     importing
       ep_table = r_dyn_table
...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;btw: that part creates a dynamic table with a flexible/dynamic structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After that i filled the dynamic table with thousands of datarecords.&lt;/P&gt;&lt;P&gt;later in my program i try to update one specific row of that table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, i need a binary search mechanism for my dynamic table. is there already a possibility to do that easyly or do i have to write my own binary search mechanism ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;sven&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sven Delangle on Nov 12, 2010 9:51 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sven Delangle on Nov 12, 2010 9:57 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 08:51:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-with-dynamic-tables/m-p/7392684#M1545655</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-12T08:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Search with Dynamic Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-with-dynamic-tables/m-p/7392685#M1545656</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 internal table I guess is filled with data from database tables which is dynamic here in your name. What you could do is do a select on DD03L and get the tabname, fieldname where AS4LOCAL = active and keyflag = 'X'. You will get the list of key fields. Put them into an internal table against the table name. Loop at this internal table and assign the key field names into separate variables (key fields wouldn't obviously be more in number)&lt;/P&gt;&lt;P&gt;Sort your dynamic internal table based on the table name using these variables like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SORT itab BY (lv_field1) (lv_field2).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have never tried out. So not sure how effective this would be.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 09:08:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-with-dynamic-tables/m-p/7392685#M1545656</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-12T09:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Search with Dynamic Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-with-dynamic-tables/m-p/7392686#M1545657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sven,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No need to build your own Binary Search algo &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; You can use dynamic tokens with SORT &amp;amp; READ TABLE commands.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this code snippet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS: &amp;lt;itab&amp;gt; TYPE STANDARD TABLE.

SORT &amp;lt;itab&amp;gt; BY ('FIELD1') ('FIELD2').

READ TABLE &amp;lt;itab&amp;gt; TRANSPORTING NO FIELDS 
WITH KEY ('FIELD1') = VAL1
         ('FIELD2') = VAL2 BINARY SEARCH.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here FIELD1 &amp;amp; FIELD2 are components of the dynamic table &amp;lt;itab&amp;gt;.&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>Fri, 12 Nov 2010 09:13:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-with-dynamic-tables/m-p/7392686#M1545657</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-11-12T09:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Search with Dynamic Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-with-dynamic-tables/m-p/7392687#M1545658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could also use the RTTS to create your dynamic table directly as SORTED or HASHED, for even greater efficiency.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 10:08:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-with-dynamic-tables/m-p/7392687#M1545658</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2010-11-12T10:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Search with Dynamic Tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-with-dynamic-tables/m-p/7392688#M1545659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my problem was already solved by the previous post.&lt;/P&gt;&lt;P&gt;but thanks for the hint.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 10:33:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/binary-search-with-dynamic-tables/m-p/7392688#M1545659</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-11-12T10:33:26Z</dc:date>
    </item>
  </channel>
</rss>

