<?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: Efficiently deleting lines from internal table based on column comparison in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578074#M1433946</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;&lt;DEL&gt;DELETE my_tab WHERE col2 EQ col3.&lt;/DEL&gt;   &lt;/P&gt;&lt;P&gt;sorry, its my fault&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marcel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: MarcelKucharek on Feb 4, 2010 10:10 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: MarcelKucharek on Feb 4, 2010 10:11 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Feb 2010 08:55:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-02-04T08:55:14Z</dc:date>
    <item>
      <title>Efficiently deleting lines from internal table based on column comparison</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578068#M1433940</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;&lt;/P&gt;&lt;P&gt;let's assume, I have the following internal table MY_TAB:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
COL_1 | COL_2 | COL_3
A       1       1
B       2       2
C       3       3
D       3       4
E       3       5
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to delete all rows, where the values in COL_2 and COL_3 are equal. That is, in the above table, the rows for A, B and C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What's the most performant / fastest and efficient way to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any hints in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Philipp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Feb 2010 16:47:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578068#M1433940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-02T16:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently deleting lines from internal table based on column comparison</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578069#M1433941</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;Copy the internal table into Temp table say My_tab_tmp.&lt;/P&gt;&lt;P&gt;append line of my_tab to my_tab_tmp.&lt;/P&gt;&lt;P&gt;sort my_tab_tmp by col2 col3.&lt;/P&gt;&lt;P&gt;delete duplicate entries from my_tab_tmp by comparing col1 col2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at my_tab_tmp into wa_my_tab_tmp.&lt;/P&gt;&lt;P&gt;read tbale my_tab into wa_tab with key col1 = wa_my_tab_tmp-col1 binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (wa_my_tab_tmp-col2 = wa_tab-col2) and (wa_my_tab_tmp-col3 = wa_tab-col3).&lt;/P&gt;&lt;P&gt;delete my_tab from wa_tab where col1 = wa_my_tab_tmp-col1.&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;Regards,&lt;/P&gt;&lt;P&gt;Bharani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Feb 2010 16:55:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578069#M1433941</guid>
      <dc:creator>BH2408</dc:creator>
      <dc:date>2010-02-02T16:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently deleting lines from internal table based on column comparison</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578070#M1433942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do not understand other proposal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The are two solutions possible&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT itab INTO wa.

   IF ( wa-col2 = wa-col3).
     DELETE itab INDEX sy-tabix.
   ENDIF.

ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If memory is not an issue and if many lines are to be deleted, then the APPEND in a new table is better.#&lt;/P&gt;&lt;P&gt;I would use that one in all cases where the conditions are complicated. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT itab INTO wa.
   IF ( wa-col2 &amp;lt;&amp;gt; wa-col3).
     APPEND wa TO itab2.
   ENDIF.
ENDLOOP.
refresh itab.
itab[] = itab2[].
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 09:44:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578070#M1433942</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-03T09:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently deleting lines from internal table based on column comparison</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578071#M1433943</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;  Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  
  field-symbols: &amp;lt;f&amp;gt; like line of itab.

  loop at itab assigning &amp;lt;f&amp;gt;.
     if &amp;lt;f&amp;gt;-col1 = &amp;lt;f&amp;gt;-col2.
        delete itab index sy-tabix.
     endif.
  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;Edited by: Diego Alvarez on Feb 3, 2010 5:45 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Feb 2010 16:45:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578071#M1433943</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-03T16:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently deleting lines from internal table based on column comparison</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578072#M1433944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;Assigning field symbols or looping the internal table  by comnparison would be the best solution.&lt;/P&gt;&lt;P&gt;Siva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Feb 2010 06:49:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578072#M1433944</guid>
      <dc:creator>sivaprasad_ml</dc:creator>
      <dc:date>2010-02-04T06:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently deleting lines from internal table based on column comparison</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578073#M1433945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if the table has only short fields as above then ASSIGNING has no advantage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use it with broader tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But overall, the ASSIGNING is an additional contribution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The wrong command for the DELETE gives a completely different scaling !!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Feb 2010 08:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578073#M1433945</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-04T08:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently deleting lines from internal table based on column comparison</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578074#M1433946</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;&lt;DEL&gt;DELETE my_tab WHERE col2 EQ col3.&lt;/DEL&gt;   &lt;/P&gt;&lt;P&gt;sorry, its my fault&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marcel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: MarcelKucharek on Feb 4, 2010 10:10 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: MarcelKucharek on Feb 4, 2010 10:11 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Feb 2010 08:55:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578074#M1433946</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-04T08:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently deleting lines from internal table based on column comparison</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578075#M1433947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Siegfred,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  The aim of using "assigning" is to avoid copying each line of the table to the header structure and only change the memory address that is pointed by the field-symbol. In small tables, will not be noticeable difference, but when you have many thousands of lines you will notice it is faster, you will avoid the step of copying data from one place to another... I think so, though I could be wrong &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Feb 2010 09:09:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578075#M1433947</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-04T09:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently deleting lines from internal table based on column comparison</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578076#M1433948</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;&lt;/P&gt;&lt;P&gt;I think you gave me some useful hints for my problem! Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I might run some performance test and see what solution is the fastest...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Philipp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Feb 2010 11:18:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/efficiently-deleting-lines-from-internal-table-based-on-column-comparison/m-p/6578076#M1433948</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-07T11:18:14Z</dc:date>
    </item>
  </channel>
</rss>

