<?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: conditional deletion in Internal Table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294174#M1725440</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sebastian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not going to write full code for this but I want to give you some hints. &lt;/P&gt;&lt;P&gt;I am missing also condition what happens if there are many 1 and many 0 for Handling Code (I guess we leave only rows with 1 and ignores rows with 0).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt; For such summarized algorithms I would use AT NEW and AT END OF statements within a loop as these are useful for statistics internal table processing.&lt;/LI&gt;&lt;LI&gt;First sort table by Vorgangsnummer and Zahler (ascending, descending, depending on your algorithm preferences).&lt;/LI&gt;&lt;LI&gt;Program actions when new Vorgangsnummer is found in AT NEW and optionally when sequence with same Vorgangsnummer is ending in AT END OF. These actions will be triggered for first and last row with same Vorgangsnummer (may be same row). I propose to reset counts of 0/1 values for zahler.&lt;/LI&gt;&lt;LI&gt;Program actions inside the loop, like if there is first row with zahler = 0 then add it to result table, for next zahler = 0 ( l_zahler_zero_count &amp;gt; 1) rows ignore it&amp;nbsp; etc.&lt;/LI&gt;&lt;LI&gt;Instead of counters you can also keep last row if you need data from it.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;LOOP AT lt_table into ls_row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AT NEW vorgangsnummer. " reset counters&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_zahler_zero_count = 0.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_zahler_one_count = 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF ( ls_row-zahler = 0 ).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADD 1 TO l_zahler_zero_count.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSEIF ( ls_row-zahler = 1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADD 1 TO l_zahler_one_count.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF ( ... ).&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; " If your condition is fullfiled and row is needed then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; APPEND ls_row TO lt_new_result_table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AT END OF vorgangsnummer. " optionally do summary action before we switch to new Handling Code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I let you build solution according to your own imagination &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1214/images/emoticons/wink.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1214/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Feb 2013 13:09:57 GMT</pubDate>
    <dc:creator>adam_krawczyk1</dc:creator>
    <dc:date>2013-02-26T13:09:57Z</dc:date>
    <item>
      <title>conditional deletion in Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294173#M1725439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to delete selective rows based on the following conditions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As seen in the screenshot, the first column contains Handling Codes and the last column contains counter values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If a Handling Code contains MULTIPLE rows with counter value '0', ONLY ONE row must be displayed. It could be the first or last. (0000379651)&lt;/P&gt;&lt;P&gt;If a Handling Code contains only a SINGLE row with counter value '0', it must be displayed. (0000379831)&lt;/P&gt;&lt;P&gt;If a Handling Code contains MULTIPLE rows with counter value '1', ALL rows must be displayed. (0000379834)&lt;/P&gt;&lt;P&gt;If a Handling Code contains MULTIPLE rows with counter values '1' and '0', ALL rows containing value '1' must be displayed and those containing '0' must be omitted. (0000380009)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plainly said all highlighted rows have to be deleted/suppressed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I achieve this in a routine which I am programming in an APD?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls Help. Many Thanks.&lt;/P&gt;&lt;P&gt;SD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/189406" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;MOderator Message&lt;/SPAN&gt;: &lt;A __default_attr="3314522" __jive_macro_name="thread" class="jive_macro jive_macro_thread" href="https://community.sap.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Kesavadas Thekkillath&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 12:30:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294173#M1725439</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-02-26T12:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: conditional deletion in Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294174#M1725440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sebastian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not going to write full code for this but I want to give you some hints. &lt;/P&gt;&lt;P&gt;I am missing also condition what happens if there are many 1 and many 0 for Handling Code (I guess we leave only rows with 1 and ignores rows with 0).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt; For such summarized algorithms I would use AT NEW and AT END OF statements within a loop as these are useful for statistics internal table processing.&lt;/LI&gt;&lt;LI&gt;First sort table by Vorgangsnummer and Zahler (ascending, descending, depending on your algorithm preferences).&lt;/LI&gt;&lt;LI&gt;Program actions when new Vorgangsnummer is found in AT NEW and optionally when sequence with same Vorgangsnummer is ending in AT END OF. These actions will be triggered for first and last row with same Vorgangsnummer (may be same row). I propose to reset counts of 0/1 values for zahler.&lt;/LI&gt;&lt;LI&gt;Program actions inside the loop, like if there is first row with zahler = 0 then add it to result table, for next zahler = 0 ( l_zahler_zero_count &amp;gt; 1) rows ignore it&amp;nbsp; etc.&lt;/LI&gt;&lt;LI&gt;Instead of counters you can also keep last row if you need data from it.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;LOOP AT lt_table into ls_row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AT NEW vorgangsnummer. " reset counters&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_zahler_zero_count = 0.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_zahler_one_count = 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF ( ls_row-zahler = 0 ).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADD 1 TO l_zahler_zero_count.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSEIF ( ls_row-zahler = 1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADD 1 TO l_zahler_one_count.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF ( ... ).&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; " If your condition is fullfiled and row is needed then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; APPEND ls_row TO lt_new_result_table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AT END OF vorgangsnummer. " optionally do summary action before we switch to new Handling Code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I let you build solution according to your own imagination &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1214/images/emoticons/wink.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1214/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 13:09:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294174#M1725440</guid>
      <dc:creator>adam_krawczyk1</dc:creator>
      <dc:date>2013-02-26T13:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: conditional deletion in Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294175#M1725441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A possible approach:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;1. sort your table on Vorgangsnummer and Zahler&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;2. remove any duplicates comparing those 2 fields&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: line-through;"&gt;3. check the remaining contents in the table on occurences of both 0 and 1 for a Vorgangsnummer and delete the occurance of Vorgansnummer with Zahler 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just noticed you want to keep the rows with only Zahler 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. copy all entries with Zahler 1 to a second table B&lt;/P&gt;&lt;P&gt;2. remove all entries with Zahler 1 from your original table&lt;/P&gt;&lt;P&gt;3. sort your original table on Vorgangsnummer and Zahler&lt;/P&gt;&lt;P&gt;4. remove any duplicates comparing Vorgangsnummer and Zahler&lt;/P&gt;&lt;P&gt;5. merge your original table with the contents from table B but make sure if there's a Vorgangsnummer in Zahler 0 in your orignal table, you remove that entry first.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 13:28:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294175#M1725441</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-02-26T13:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: conditional deletion in Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294176#M1725442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;OL&gt;&lt;LI&gt;If a Handling Code contains MULTIPLE rows with counter value '0', ONLY ONE row must be displayed. It could be the first or last. (0000379651)&lt;/LI&gt;&lt;LI&gt;If a Handling Code contains only a SINGLE row with counter value '0', it must be displayed. (0000379831)&lt;/LI&gt;&lt;/OL&gt;&lt;UL&gt;&lt;LI&gt;Get the rows with &lt;STRONG&gt;counter values as zeros&lt;/STRONG&gt; in a separate internal table.&lt;/LI&gt;&lt;LI&gt;Sort by handling code and counter.&lt;/LI&gt;&lt;LI&gt;Delete adjacent duplicates comparing Handling code&amp;nbsp; counter.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If a Handling Code contains MULTIPLE rows with counter value '1', ALL rows must be displayed. (0000379834)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; No need to do anything here as you want all lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If a Handling Code contains MULTIPLE rows with counter values '1' and '0', ALL rows containing value '1' must be displayed and those containing '0' must be omitted. (0000380009)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get all counter ones in an internal table itab1. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop at itab1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; read main itab with handling code = itab1-handling code and counter = 0 .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete entry from main itab where handling code = itab1-handling code and counter = 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endif.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the end append lines of the temp itabs that you used into a final output internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 13:39:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294176#M1725442</guid>
      <dc:creator>Azeemquadri</dc:creator>
      <dc:date>2013-02-26T13:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: conditional deletion in Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294177#M1725443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 11.818181991577148px; background-color: #ffffff; color: #333333;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;Hi Sebastian,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11.818181991577148px; background-color: #ffffff; color: #333333;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;Here u need to use the loop inside the loop where first loop handling code is compared with inner loop handling code and more over set a flag when counter becomes 0 for outer &lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;loop&lt;/SPAN&gt;(first loop), if flag is set then only compare the first loop handling code with second loop handling code. Here the comparsion should be from second record onwards for inner loop. If both are matched the delete the record from internal table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11.818181991577148px; background-color: #ffffff; color: #333333;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11.818181991577148px; background-color: #ffffff; color: #333333;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;B. Vineesh &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 18:18:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294177#M1725443</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-02-26T18:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: conditional deletion in Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294178#M1725444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Maen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your reply. I have used the following logic...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. copied all records with counter value '0' in internal table it_1&lt;/P&gt;&lt;P&gt;2. deleted adjacent duplicates in it_1. Hence i am left with the desired records&lt;/P&gt;&lt;P&gt;3. copied all records with counter value '1' in internal table it_2&lt;/P&gt;&lt;P&gt;4. merged it_1 and it_2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This logic works fine. The only problem is that in case of handling number 0000380009 I am left with 2 records i.e. one record with value '1' and the other with value '0'. How do I overcome this? I have attached the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;SD&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 13:27:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294178#M1725444</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-02-28T13:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: conditional deletion in Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294179#M1725445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please replace your second merging loop with this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at the table which contains all zero counters and check if the handling code is already exist in the table which contains all 1 counters. if sy-subrc equal 0 dont append the record else append the record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_XX_TAB1 INTO STR_TAB1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; read table it_xx_tab2 into str_tab2 where str_tab1-&amp;lt;handling code&amp;gt;.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if sy-subrc NE 0.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; assign the values and append record.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endif.&lt;/P&gt;&lt;P&gt;&amp;nbsp; endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 14:07:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/conditional-deletion-in-internal-table/m-p/9294179#M1725445</guid>
      <dc:creator>former_member183073</dc:creator>
      <dc:date>2013-02-28T14:07:18Z</dc:date>
    </item>
  </channel>
</rss>

