<?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: Delete no duplicate records from internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829868#M662254</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;u can use this logic.................&lt;/P&gt;&lt;P&gt;data : temp like tablename-field1,&lt;/P&gt;&lt;P&gt;         temp2 like tablename-field1,&lt;/P&gt;&lt;P&gt;         tabix type i  .&lt;/P&gt;&lt;P&gt;sort itab by fieldname.&lt;/P&gt;&lt;P&gt;loop at itab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if temp2 ne itab1-fieldnamevalue.&lt;/P&gt;&lt;P&gt;   temp = itab-fieldnamealue.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;   countinue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;tabix = sytabix + 1.&lt;/P&gt;&lt;P&gt;read itab index tabix.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  if temp = itab-fieldnamevalue.&lt;/P&gt;&lt;P&gt;    temp2 = itab-fieldnamevalue.&lt;/P&gt;&lt;P&gt;    countine.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;     delete itab.&lt;/P&gt;&lt;P&gt;     temp2 = ''. &lt;/P&gt;&lt;P&gt;  end if. &lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;i tried pls do it........&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;karthik&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        karthikeyan sukumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Sep 2007 10:32:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-20T10:32:48Z</dc:date>
    <item>
      <title>Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829863#M662249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how can i delete no duplicate record from an internal table is there any command for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to delete only those record which is not duplicated in internal table means if there are 10 records in internal table 3 records are having duplicate entries and 2 records having single entries then only those 2 records should get deleted. exactly opposite to 'delete adjacent duplicate'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        amit manglik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 09:35:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829863#M662249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T09:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829864#M662250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;first SORT the ITAB with key fields&lt;/P&gt;&lt;P&gt;the use the command&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICTAES FROM ITAB comparing Field1 field2..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 09:36:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829864#M662250</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T09:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829865#M662251</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;Deleting Lines &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To delete a single line of any internal table, use the DELETE statement. You can either use the table key to find and delete a single line using its key, delete a set of lines that meet a condition, or find and delete neighboring duplicate entries. If the table has a non-unique key and there are duplicate entries, the first entry is deleted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Deleting a Line Using the Table Key&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use the table key of table &amp;lt;itab&amp;gt; as a search key, use one of the following statements: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE TABLE &amp;lt;itab&amp;gt; FROM &amp;lt;wa&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE TABLE &amp;lt;itab&amp;gt; WITH TABLE KEY &amp;lt;k1&amp;gt; = &amp;lt;f 1&amp;gt; ... &amp;lt;k n&amp;gt; = &amp;lt;f n&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the first case, &amp;lt;wa&amp;gt; must be a work area compatible with the line type of &amp;lt;itab&amp;gt;. The values of the key fields are taken from the corresponding components of the work area. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the second case, you have to supply the values of each key field explicitly. If you do not know the name of one of the key fields until runtime, you can specify it as the content of a field &amp;lt;n i &amp;gt; using the form (&amp;lt;n i &amp;gt;) = &amp;lt;f i &amp;gt;. If the data types of &amp;lt;f i &amp;gt; are not compatible with the key fields, the system converts them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The system searches for the relevant lines as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Standard tables&lt;/P&gt;&lt;P&gt;Linear search, where the runtime is in linear relation to the number of table entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorted tables&lt;/P&gt;&lt;P&gt;Binary search, where the runtime is in logarithmic relation to the number of table entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hashed tables&lt;/P&gt;&lt;P&gt;The entry is found using the hash algorithm of the internal table. The runtime is independent of the number of table entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the system finds a line, it deletes it from the table and sets SY-SUBRC to zero. Otherwise, SY-SUBRC is set to 4. If the table has a non-unique key and the system finds duplicate entries, it deletes the first entry. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Deleting Several Lines Using a Condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To delete more than one line using a condition, use the following statement: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE &amp;lt;itab&amp;gt; WHERE &amp;lt;cond&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This processes all of the lines that meet the logical condition &amp;lt;cond&amp;gt;. The logical condition can consist of more than one comparison. In each comparison, the first operand must be a component of the line structure. If the table lines are not structured, the first operand can also be the expression TABLE LINE. The comparison then applies to the entire line. If at least one line is deleted, the system sets SY-SUBRC to 0, otherwise to 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Deleting Adjacent Duplicate Entries&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To delete adjacent duplicate entries use the following statement: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATE  FROM &amp;lt;itab&amp;gt; &lt;/P&gt;&lt;P&gt;                                  [COMPARING &amp;lt;f1&amp;gt; &amp;lt;f 2&amp;gt; ... &lt;/P&gt;&lt;P&gt;                                             |ALL FIELDS].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The system deletes all adjacent duplicate entries from the internal table &amp;lt;itab&amp;gt;. Entries are duplicate if they fulfill one of the following compare criteria:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without the COMPARING addition, the contents of the key fields of the table must be identical in both lines. &lt;/P&gt;&lt;P&gt;If you use the addition COMPARING &amp;lt;f1&amp;gt; &amp;lt;f 2&amp;gt; ... the contents of the specified fields &amp;lt;f 1 &amp;gt; &amp;lt;f 2 &amp;gt; ... must be identical in both lines. You can also specify a field &amp;lt;f i &amp;gt; dynamically as the contents of a field &amp;lt;n i &amp;gt; in the form (&amp;lt;n i &amp;gt;). If &amp;lt;n i &amp;gt; is empty when the statement is executed, it is ignored. You can restrict the search to partial fields by specifying offset and length. &lt;/P&gt;&lt;P&gt;If you use the addition COMPARING ALL FIELDS the contents of all fields of both lines must be identical. &lt;/P&gt;&lt;P&gt;You can use this statement to delete all duplicate entries from an internal table if the table is sorted by the specified compare criterion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If at least one line is deleted, the system sets SY-SUBRC to 0, otherwise to 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Examples&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF LINE,&lt;/P&gt;&lt;P&gt;COL1 TYPE I,&lt;/P&gt;&lt;P&gt;COL2 TYPE I,&lt;/P&gt;&lt;P&gt;END OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ITAB LIKE HASHED TABLE OF LINE WITH UNIQUE KEY COL1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 4 TIMES.&lt;/P&gt;&lt;P&gt;LINE-COL1 = SY-INDEX.&lt;/P&gt;&lt;P&gt;LINE-COL2 = SY-INDEX ** 2.&lt;/P&gt;&lt;P&gt;INSERT LINE INTO TABLE ITAB.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE-COL1 = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE TABLE ITAB: FROM LINE,&lt;/P&gt;&lt;P&gt;WITH TABLE KEY COL1 = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB INTO LINE.&lt;/P&gt;&lt;P&gt;WRITE: / LINE-COL1, LINE-COL2.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output is: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         2        4&lt;/P&gt;&lt;P&gt;         4       16&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program fills a hashed table with a list of square numbers. The DELETE statement delete the lines from the table where the key field COL1 has the contents 1 or 3. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF LINE,&lt;/P&gt;&lt;P&gt;COL1 TYPE I,&lt;/P&gt;&lt;P&gt;COL2 TYPE I,&lt;/P&gt;&lt;P&gt;END OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ITAB LIKE HASHED TABLE OF LINE WITH UNIQUE KEY COL1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 4 TIMES.&lt;/P&gt;&lt;P&gt;  LINE-COL1 = SY-INDEX.&lt;/P&gt;&lt;P&gt;  LINE-COL2 = SY-INDEX ** 2.&lt;/P&gt;&lt;P&gt;INSERT LINE INTO TABLE ITAB.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE ITAB WHERE ( COL2 &amp;gt; 1 ) AND ( COL1 &amp;lt; 4 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB INTO LINE.&lt;/P&gt;&lt;P&gt;  WRITE: / LINE-COL1, LINE-COL2.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output is: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         1        1&lt;/P&gt;&lt;P&gt;         4       16&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program fills a hashed table with a list of square numbers. The DELETE statement deletes the lines of the table where the content of field COL2 is greater than 1 and the content of field COL1 is less than 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA OFF TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF LINE,&lt;/P&gt;&lt;P&gt;COL1 TYPE I,&lt;/P&gt;&lt;P&gt;COL2 TYPE C,&lt;/P&gt;&lt;P&gt;END OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ITAB LIKE STANDARD TABLE OF LINE &lt;/P&gt;&lt;P&gt;          WITH NON-UNIQUE KEY COL2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LINE-COL1 = 1. LINE-COL2 = 'A'. APPEND LINE TO ITAB.&lt;/P&gt;&lt;P&gt;LINE-COL1 = 1. LINE-COL2 = 'A'. APPEND LINE TO ITAB.&lt;/P&gt;&lt;P&gt;LINE-COL1 = 1. LINE-COL2 = 'B'. APPEND LINE TO ITAB.&lt;/P&gt;&lt;P&gt;LINE-COL1 = 2. LINE-COL2 = 'B'. APPEND LINE TO ITAB.&lt;/P&gt;&lt;P&gt;LINE-COL1 = 3. LINE-COL2 = 'B'. APPEND LINE TO ITAB.&lt;/P&gt;&lt;P&gt;LINE-COL1 = 4. LINE-COL2 = 'B'. APPEND LINE TO ITAB.&lt;/P&gt;&lt;P&gt;LINE-COL1 = 5. LINE-COL2 = 'A'. APPEND LINE TO ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OFF = 0. PERFORM LIST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM ITAB COMPARING ALL FIELDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OFF = 14. PERFORM LIST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM ITAB COMPARING COL1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OFF = 28. PERFORM LIST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OFF = 42. PERFORM LIST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM LIST.&lt;/P&gt;&lt;P&gt;  SKIP TO LINE 3.&lt;/P&gt;&lt;P&gt;  LOOP AT ITAB INTO LINE.&lt;/P&gt;&lt;P&gt;     WRITE: AT /OFF  LINE-COL1, LINE-COL2.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         1 A          1 A          1 A          1 A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         1 A          1 B          2 B          2 B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         1 B 2 B 3 B 5 A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         2 B          3 B          4 B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         3 B          4 B          5 A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         4 B 5 A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         5 A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example creates and fills a standard table. Here, the first DELETE statement deletes the second line from ITAB because the second line has the same contents as the first line. The second DELETE statement deletes the second line from the remaining table because the contents of the field COL1 is the same as in the first line. The third DELETE statement deletes the third and fourth line from the remaining table because the contents of the default key field COL2 are the same as on the second line. Although the contents of the default key are the same for the first and the fifth line, the fifth line is not deleted because it is not adjacent to the first line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REWARD points if u find useful..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 09:38:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829865#M662251</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2007-09-20T09:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829866#M662252</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 this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT itab BY &amp;lt;ur field&amp;gt;.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM itab.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 09:41:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829866#M662252</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T09:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829867#M662253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to delete the &lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;NON&lt;/P&gt; duplicated ones, you will need to find an algorythm by yourself, I doubt SAP would implement a FM for do that (but I can be wrong, as usual).&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to copy your internal table into another one, and work by looping the second one... something like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab1 into wa1.
  loop at itab2 into wa2 where field_list = field_list.
  endloop.
  if sy-tabix &amp;gt; 1.
    delete itab1 where field_list = wa1.
  endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It's not a real program, just some sort of pseudo-coding... it will be up to you to make it work &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wish someone with better knowledge about it can lend you a hand, if not, try to use my answer &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oh, and if you will use my "logic", remember to use sorted/hashed tables and not standard ones (if your tables are too big) to improve performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Vicenç Lozano&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 09:43:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829867#M662253</guid>
      <dc:creator>VXLozano</dc:creator>
      <dc:date>2007-09-20T09:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829868#M662254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;u can use this logic.................&lt;/P&gt;&lt;P&gt;data : temp like tablename-field1,&lt;/P&gt;&lt;P&gt;         temp2 like tablename-field1,&lt;/P&gt;&lt;P&gt;         tabix type i  .&lt;/P&gt;&lt;P&gt;sort itab by fieldname.&lt;/P&gt;&lt;P&gt;loop at itab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if temp2 ne itab1-fieldnamevalue.&lt;/P&gt;&lt;P&gt;   temp = itab-fieldnamealue.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;   countinue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;tabix = sytabix + 1.&lt;/P&gt;&lt;P&gt;read itab index tabix.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  if temp = itab-fieldnamevalue.&lt;/P&gt;&lt;P&gt;    temp2 = itab-fieldnamevalue.&lt;/P&gt;&lt;P&gt;    countine.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;     delete itab.&lt;/P&gt;&lt;P&gt;     temp2 = ''. &lt;/P&gt;&lt;P&gt;  end if. &lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;i tried pls do it........&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;karthik&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        karthikeyan sukumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 10:32:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829868#M662254</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T10:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829869#M662255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then you will must to find an algorythm to do it, as I said you in my first post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, for the next time you will need to clarify a question, use a reply, because lots of people do not see/look when a post has been modified once the flood of (wrong?) answers start.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the bold button or caps* the next time (as I did) to show you want the &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; duplicated ones, and (maybe) people will notice what do you want really &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;if you will use caps, please use them just for the word you want to emphasize, a message all in caps is unreadable and is like shouting in the net&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 10:34:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829869#M662255</guid>
      <dc:creator>VXLozano</dc:creator>
      <dc:date>2007-09-20T10:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829870#M662256</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;Use the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;num1 type i,&lt;/P&gt;&lt;P&gt;num2 type i,&lt;/P&gt;&lt;P&gt;end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data wa like itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: v_cnt type i,&lt;/P&gt;&lt;P&gt;      v_num type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 1.&lt;/P&gt;&lt;P&gt;itab-num2 = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 1.&lt;/P&gt;&lt;P&gt;itab-num2 = 3.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 2.&lt;/P&gt;&lt;P&gt;itab-num2 = 4.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 4.&lt;/P&gt;&lt;P&gt;itab-num2 = 4.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 3.&lt;/P&gt;&lt;P&gt;itab-num2 = 1.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 3.&lt;/P&gt;&lt;P&gt;itab-num2 = 2.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by num1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt; if v_num &amp;lt;&amp;gt; itab-num1.&lt;/P&gt;&lt;P&gt;  v_num = itab-num1.&lt;/P&gt;&lt;P&gt;  if v_cnt = 1.&lt;/P&gt;&lt;P&gt;   delete itab where num1 = wa-num1.&lt;/P&gt;&lt;P&gt;   clear v_cnt.&lt;/P&gt;&lt;P&gt;   v_cnt = v_cnt + 1.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;   clear v_cnt.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  v_cnt = v_cnt + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; else.&lt;/P&gt;&lt;P&gt;  v_cnt = v_cnt + 1.&lt;/P&gt;&lt;P&gt; endif.&lt;/P&gt;&lt;P&gt; move itab to wa.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;if v_cnt = 1.&lt;/P&gt;&lt;P&gt;  delete itab where num1 = wa-num1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt; write:/5 itab-num1,&lt;/P&gt;&lt;P&gt;        20 itab-num2.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 10:39:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829870#M662256</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T10:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829871#M662257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the following code, it keeps duplicate enteries and deletes single enteries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;  NAME(1),&lt;/P&gt;&lt;P&gt;  TOTAL TYPE I,&lt;/P&gt;&lt;P&gt;END OF ITAB,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2 like table of itab with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: COUNT TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITAB-NAME = 'a'.	ITAB-TOTAL = 480.	APPEND ITAB.&lt;/P&gt;&lt;P&gt;ITAB-NAME = 'a'.	ITAB-TOTAL = 480.	APPEND ITAB.&lt;/P&gt;&lt;P&gt;ITAB-NAME = 'b'.	ITAB-TOTAL = 470.	APPEND ITAB.&lt;/P&gt;&lt;P&gt;ITAB-NAME = 'b'.	ITAB-TOTAL = 470.	APPEND ITAB.&lt;/P&gt;&lt;P&gt;ITAB-NAME = 'c'.	ITAB-TOTAL = 470.	APPEND ITAB.&lt;/P&gt;&lt;P&gt;ITAB-NAME = 'd'.	ITAB-TOTAL = 470.	APPEND ITAB.&lt;/P&gt;&lt;P&gt;ITAB-NAME = 'e'.	ITAB-TOTAL = 460.	APPEND ITAB.&lt;/P&gt;&lt;P&gt;ITAB-NAME = 'e'.	ITAB-TOTAL = 460.	APPEND ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2[] = itab[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;  CLEAR COUNT.&lt;/P&gt;&lt;P&gt;  LOOP AT ITAB2 WHERE NAME = ITAB-NAME AND TOTAL = ITAB-TOTAL.&lt;/P&gt;&lt;P&gt;    COUNT = COUNT + 1.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  IF COUNT EQ 1.&lt;/P&gt;&lt;P&gt;    DELETE ITAB.&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;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;WRITE:/ ITAB-NAME,ITAB-TOTAL.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful, get back in case of query...&lt;/P&gt;&lt;P&gt;Cheers!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 10:45:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829871#M662257</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T10:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829872#M662258</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 tested with example.....plz check this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;        num type i,&lt;/P&gt;&lt;P&gt;        end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : temp like itab-num,&lt;/P&gt;&lt;P&gt;temp2 like itab-num,&lt;/P&gt;&lt;P&gt;tabix type i .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ITAB-NUM = 1.&lt;/P&gt;&lt;P&gt; APPEND ITAB.&lt;/P&gt;&lt;P&gt; ITAB-NUM = 2.&lt;/P&gt;&lt;P&gt; APPEND ITAB.&lt;/P&gt;&lt;P&gt; ITAB-NUM = 3.&lt;/P&gt;&lt;P&gt; APPEND ITAB.&lt;/P&gt;&lt;P&gt; ITAB-NUM = 4.&lt;/P&gt;&lt;P&gt; APPEND ITAB.&lt;/P&gt;&lt;P&gt; ITAB-NUM = 4.&lt;/P&gt;&lt;P&gt; APPEND ITAB.&lt;/P&gt;&lt;P&gt; itab-num = 3.&lt;/P&gt;&lt;P&gt; append itab.&lt;/P&gt;&lt;P&gt; itab-num = 4.&lt;/P&gt;&lt;P&gt; append itab.&lt;/P&gt;&lt;P&gt; itab-num = 2.&lt;/P&gt;&lt;P&gt; append itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; sort itab by num.&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if temp2 ne itab-num.&lt;/P&gt;&lt;P&gt;temp = itab-num.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;tabix = sy-tabix + 1.&lt;/P&gt;&lt;P&gt;read table itab index tabix.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;if temp = itab-num.&lt;/P&gt;&lt;P&gt;temp2 = itab-num.&lt;/P&gt;&lt;P&gt;continue.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;delete itab.&lt;/P&gt;&lt;P&gt;temp2 = ''.&lt;/P&gt;&lt;P&gt;endif.&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;loop at itab.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; itab-num.&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;karthik.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 10:48:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829872#M662258</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T10:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829873#M662259</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;Here is the simple logic for ur problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If itab1 contains ur whole data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt;  wa like line of itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;if wa ne itab1.&lt;/P&gt;&lt;P&gt;  delete itab1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;wa = itab1.&lt;/P&gt;&lt;P&gt;  clear itab1.&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;Rama chary.Pammi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 10:53:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829873#M662259</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T10:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829874#M662260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try out this logic...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : cnt type i value 1.&lt;/P&gt;&lt;P&gt;       cnt1 type i.&lt;/P&gt;&lt;P&gt;data : begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;       num type i,&lt;/P&gt;&lt;P&gt;       end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enter some values into internal table and then.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by num.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table itab.&lt;/P&gt;&lt;P&gt;cnt1 = sy-tfill.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;temp = itab-num.&lt;/P&gt;&lt;P&gt;while ( cnt &amp;lt;= cnt1 ).&lt;/P&gt;&lt;P&gt;read table itab index cnt.&lt;/P&gt;&lt;P&gt;if itab-num ne temp.&lt;/P&gt;&lt;P&gt;delete itab.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;cnt = cnt + 1.&lt;/P&gt;&lt;P&gt;endwhile.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Naveen George&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Naveen George&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 11:10:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829874#M662260</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T11:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829875#M662261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi this program provides the functionality u want.......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;num1 type i,&lt;/P&gt;&lt;P&gt;num2 type i,&lt;/P&gt;&lt;P&gt;end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : begin of itab1 occurs 0,&lt;/P&gt;&lt;P&gt;num1 type i,&lt;/P&gt;&lt;P&gt;cnt type i,&lt;/P&gt;&lt;P&gt;end of itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : v_flag type c.&lt;/P&gt;&lt;P&gt;data : cnt type i.&lt;/P&gt;&lt;P&gt;data : v_tabix like sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 1.&lt;/P&gt;&lt;P&gt;itab-num2 = 2.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 1.&lt;/P&gt;&lt;P&gt;itab-num2 = 2.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 1.&lt;/P&gt;&lt;P&gt;itab-num2 = 2.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 2.&lt;/P&gt;&lt;P&gt;itab-num2 = 5.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 3.&lt;/P&gt;&lt;P&gt;itab-num2 = 5.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 3.&lt;/P&gt;&lt;P&gt;itab-num2 = 7.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab-num1 = 4.&lt;/P&gt;&lt;P&gt;itab-num2 = 6.&lt;/P&gt;&lt;P&gt;append itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by num1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;at new num1.&lt;/P&gt;&lt;P&gt;clear cnt.&lt;/P&gt;&lt;P&gt;cnt = cnt + 1.&lt;/P&gt;&lt;P&gt;v_flag = 'X'.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;if not v_flag = 'X'.&lt;/P&gt;&lt;P&gt;cnt = cnt + 1.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;clear v_flag.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;at end of num1.&lt;/P&gt;&lt;P&gt;itab1-num1 = itab-num1.&lt;/P&gt;&lt;P&gt;itab1-cnt = cnt.&lt;/P&gt;&lt;P&gt;append itab1.&lt;/P&gt;&lt;P&gt;clear : itab1 , cnt.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete itab1[] where cnt ne 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;v_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;read table itab1 with key num1 = itab-num1.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;delete itab index v_tabix.&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;loop at itab.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; itab-num1 , itab-num2.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Reward points if useful.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vasu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Sep 2007 08:48:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829875#M662261</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-21T08:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829876#M662262</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 it_table by the record no.s and take one variable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then loop at it_table into wa.&lt;/P&gt;&lt;P&gt;if sy-tabix = 1.&lt;/P&gt;&lt;P&gt;wa_temp = wa-record1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if  wa_temp &amp;lt;&amp;gt; wa_record.&lt;/P&gt;&lt;P&gt;delete it_table where record = wa_record.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Sep 2007 08:57:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829876#M662262</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-21T08:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829877#M662263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amit,&lt;/P&gt;&lt;P&gt;    This might help u.&lt;/P&gt;&lt;P&gt;Itab1 = itab2.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates itab2.&lt;/P&gt;&lt;P&gt;loop at itab2.&lt;/P&gt;&lt;P&gt;read table itab1 with key = itab2-key.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;n = sy-tabix.&lt;/P&gt;&lt;P&gt;n = n + 1.&lt;/P&gt;&lt;P&gt;read table itab1 index n.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0 and itab1-key = itab2-key.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;delete itab1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Sep 2007 10:19:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829877#M662263</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-21T10:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Delete no duplicate records from internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829878#M662264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks every one!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 May 2009 21:41:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-no-duplicate-records-from-internal-table/m-p/2829878#M662264</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-11T21:41:54Z</dc:date>
    </item>
  </channel>
</rss>

