<?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 DELETE syntax in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619780#M601520</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two internal tables.&lt;/P&gt;&lt;P&gt;The first internal table contains sales doc and invoice no.&lt;/P&gt;&lt;P&gt;the second internal table contains invoice no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do we have a delete statement that will delete the entries in first table where the invoice number is not present in second internal table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Jul 2007 07:41:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-31T07:41:28Z</dc:date>
    <item>
      <title>DELETE syntax</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619780#M601520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two internal tables.&lt;/P&gt;&lt;P&gt;The first internal table contains sales doc and invoice no.&lt;/P&gt;&lt;P&gt;the second internal table contains invoice no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do we have a delete statement that will delete the entries in first table where the invoice number is not present in second internal table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 07:41:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619780#M601520</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T07:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE syntax</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619781#M601521</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;/P&gt;&lt;P&gt;Loop at first internal table. Inside loop .. endloop read second table with invoice number of current loop pass. If read statement fails delete the record from first table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EX:-&lt;/P&gt;&lt;P&gt;Loop at itab1.&lt;/P&gt;&lt;P&gt;read table itab2 with key invoice nO = itab1-invoice no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;delete itab1.&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;Sankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 07:44:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619781#M601521</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T07:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE syntax</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619782#M601522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Code like this.&lt;/P&gt;&lt;P&gt;The first internal table(itab1) contains sales doc and invoice no.&lt;/P&gt;&lt;P&gt;the second internal table(itab2) contains invoice no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab1.&lt;/P&gt;&lt;P&gt;read table itab2 with key invoice = itab1-invoice.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;delete itab1.&lt;/P&gt;&lt;P&gt;endif.&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, 31 Jul 2007 07:45:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619782#M601522</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T07:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE syntax</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619783#M601523</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;chk this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;Logic&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab1&lt;/P&gt;&lt;P&gt;itab2&lt;/P&gt;&lt;P&gt;itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.&lt;/P&gt;&lt;P&gt;loop at itab2 into wa2.&lt;/P&gt;&lt;P&gt;read table itab1 with key itab2-key.&lt;/P&gt;&lt;P&gt;if sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;append wa2 to itab3.&lt;/P&gt;&lt;P&gt;clear wa2.&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;3.&lt;/P&gt;&lt;P&gt;Delete itab1 from itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Reshma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 07:45:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619783#M601523</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T07:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE syntax</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619784#M601524</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;/P&gt;&lt;P&gt;LOOP AT itab1.&lt;/P&gt;&lt;P&gt;READ TABLE  itab2 WITH KEY invoice_no = itab1-invoice_no TRANSPORTING NO FIELDS.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;DELETE itab1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 07:47:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619784#M601524</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-07-31T07:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE syntax</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619785#M601525</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;DELETE ADJACENT DUPLICATES FROM itab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT ESLL~PACKNO ESLL~SUB_PACKNO ESLL~SRVPOS ESLL~KTEXT1
          FROM ESLL        
  INTO CORRESPONDING FIELDS OF TABLE ITAB6
         WHERE ESLL~PACKNO = ITAB1-PACKNO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete  adjacent  duplicates  from itab1 comparing EBELN .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Extras: &lt;/P&gt;&lt;P&gt;1. ... COMPARING f1 f2 ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. ... COMPARING ALL FIELDS &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt;Effect&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;Deletes adjacent duplicate entries from the internal table itab. If there are n duplicate entries in succession, the first entry is retained, and the following n-1 entries are deleted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Two lines are regarded as duplicates if their keys are identical. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;The Return Code is set as follows:&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SY-SUBRC = 0: &lt;/P&gt;&lt;P&gt;At least one duplicate was found, and at least one entry was deleted. &lt;/P&gt;&lt;P&gt;SY-SUBRC = 4: &lt;/P&gt;&lt;P&gt;No duplicates found, no entries deleted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 1 &lt;/P&gt;&lt;P&gt;... COMPARING f1 f2 ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Two lines of the internal table itab are regarded as duplicates if they have identical contents in the fields f1, f2, ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 2 &lt;/P&gt;&lt;P&gt;... COMPARING ALL FIELDS &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Two lines of the internal table are regarded as duplicates if all of their field contents are identical. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Notes&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;The DELETE ADJACENT DUPLICATES statement works particularly well if you have sorted the internal table itab according to the fields that you want to compare when looking for duplicates. In this case, deleting adjacent duplicates is the same as deleting all duplicates. The direction of the sort is irrelevant. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do not know a comparison expression until runtime, you can specify it dynamically as the contents of the field name in the expression COMPARING ... (name) .... If name is empty at runtime, the comparison expression is ignored. If name contains an invalid component name, a runtime error occurs. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can further restrict comparison expressions - both static and dynamic - by specifying offset and length. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&lt;/P&gt;&lt;P&gt;Note &lt;/P&gt;&lt;P&gt;Performance:&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you delete a line of an internal table, index maintenance costs are incurred. These depend on the index of the table. The runtime is independent of the width of the table line. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Deleting a line from the middle of an internal table with 200 entries usually requires around 10 msn (standardized microseconds). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you delete a set of entries using "DELETE itab FROM idx1 TO idx2." or "DELETE itab WHERE ...", index maintenance costs are only incurred once. This means that it is considerably more efficient than deleting entries in a LOOP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to delete adjacent duplicate entries from an internal table, use the variant " DELETE ADJACENT DUPLICATES FROM itab." instead of a LOOP construction. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all helpfull answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2007 07:48:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-syntax/m-p/2619785#M601525</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-31T07:48:37Z</dc:date>
    </item>
  </channel>
</rss>

