<?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 internal table data with another internal table without loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-internal-table-data-with-another-internal-table-without-loop/m-p/12274395#M1988166</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;We have data in one internal table IT_TAB1 and it has Entity, source system columns. Another internal table IT_TAB2 having source system column only.&lt;/P&gt;
  &lt;P&gt;How to delete the records in IT_TAB1 where source system not in IT_TAB2 without using LOOP?&lt;/P&gt;
  &lt;P&gt;Is is possible in advanced ABAP with different declarations ?&lt;/P&gt;</description>
    <pubDate>Fri, 04 Dec 2020 18:29:39 GMT</pubDate>
    <dc:creator>former_member710665</dc:creator>
    <dc:date>2020-12-04T18:29:39Z</dc:date>
    <item>
      <title>Delete internal table data with another internal table without loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-internal-table-data-with-another-internal-table-without-loop/m-p/12274395#M1988166</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;We have data in one internal table IT_TAB1 and it has Entity, source system columns. Another internal table IT_TAB2 having source system column only.&lt;/P&gt;
  &lt;P&gt;How to delete the records in IT_TAB1 where source system not in IT_TAB2 without using LOOP?&lt;/P&gt;
  &lt;P&gt;Is is possible in advanced ABAP with different declarations ?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 18:29:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-internal-table-data-with-another-internal-table-without-loop/m-p/12274395#M1988166</guid>
      <dc:creator>former_member710665</dc:creator>
      <dc:date>2020-12-04T18:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: Delete internal table data with another internal table without loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-internal-table-data-with-another-internal-table-without-loop/m-p/12274396#M1988167</link>
      <description>&lt;P&gt;Yes, for instance&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;it_tab1 = FILTER #( it_tab1 IN it_tab2 WHERE tab1_srcsystem = tab2_srcsystem ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;it_tab2 must be sorted or hashed.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 19:16:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-internal-table-data-with-another-internal-table-without-loop/m-p/12274396#M1988167</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-12-04T19:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: Delete internal table data with another internal table without loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-internal-table-data-with-another-internal-table-without-loop/m-p/12274397#M1988168</link>
      <description>&lt;P&gt;If the version if ABAP is one of the modern, you can try use operator FILTER with keyword EXCEPT&lt;/P&gt;&lt;P&gt;It is described in help&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abenconstructor_expr_filter_table.htm" target="test_blank"&gt;https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abenconstructor_expr_filter_table.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Example could be like that (as a result in internal table lt_itab1 will be only lines that are NOT in lt_itab2)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    types: BEGIN OF ts_line1
              , src_sys TYPE sysysid
              , field1 TYPE char10
              , field2 TYPE char10
          , END OF ts_line1
          , tt_line1 TYPE STANDARD TABLE OF ts_line1
            with NON-UNIQUE SORTED KEY PR COMPONENTS src_sys
          .

    types: BEGIN OF ts_line2
              , src_sys TYPE sysysid
          , END OF ts_line2
          , tt_line2 TYPE STANDARD TABLE OF ts_line2
          .

    data lt_itab1 TYPE tt_line1.
    data lt_itab2 TYPE tt_line2.


    lt_itab1 = VALUE #(  ( src_sys = 'ONE' field1 = 'F11' field2 = 'F21' )
                                ( src_sys = 'TWO' field1 = 'F12' field2 = 'F22' )
                                ( src_sys = 'THREE' field1 = 'F13' field2 = 'F23' )
                                ( src_sys = 'FOUR' field1 = 'F14' field2 = 'F24' ) ).


    lt_itab2 = VALUE #( ( src_sys = 'TWO' ) ( src_sys = 'FOUR' ) ).

""" to delete records that are not in lt_itab2
data(lt_itab10) = FILTER #( lt_itab1 USING key pr IN lt_itab2  WHERE src_sys = src_sys ).


""" to save records that are not in lt_itab2
    data(lt_itab11) = FILTER #(
       lt_itab1 USING KEY pr EXCEPT IN lt_itab2
       where src_sys = src_sys
    ).
" lt_itab11  will store ONE / THREE but not TWO and FOUR&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Dec 2020 19:38:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-internal-table-data-with-another-internal-table-without-loop/m-p/12274397#M1988168</guid>
      <dc:creator>OlegBash</dc:creator>
      <dc:date>2020-12-04T19:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Delete internal table data with another internal table without loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-internal-table-data-with-another-internal-table-without-loop/m-p/12274398#M1988169</link>
      <description>&lt;P&gt;Thank you   &lt;SPAN class="mention-scrubbed"&gt;olegbash599&lt;/SPAN&gt; for your detailed explanation. I have tried the  Sandra approach and it works. Can you explain me "withNON-UNIQUESORTEDKEY PR COMPONENTS src_sys" this logic and how it filtered at the end please. Also, help me to understand that how your approch is different from Sandra approach.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 07:00:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-internal-table-data-with-another-internal-table-without-loop/m-p/12274398#M1988169</guid>
      <dc:creator>former_member710665</dc:creator>
      <dc:date>2020-12-07T07:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Delete internal table data with another internal table without loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-internal-table-data-with-another-internal-table-without-loop/m-p/12274399#M1988170</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;praveen_channa&lt;/SPAN&gt; &lt;BR /&gt;The differences of the approaches are:&lt;BR /&gt;1) With keyword EXCEPT the system could filter the lines which is in the second table. So it is comparing not by equality but inequality.&lt;BR /&gt;In your question I do have noticed this phrase  "&lt;STRONG&gt;delete the records&lt;/STRONG&gt; in IT_TAB1 where source system &lt;STRONG&gt;not in&lt;/STRONG&gt; IT_TAB2".&lt;BR /&gt;So Sandra's approach is more applicable in that case.&lt;/P&gt;&lt;P&gt;2) using ley allows you to avoid using sorted type for example. It is what I was intend to show (how we can use standard table with FILTER function).&lt;/P&gt;&lt;P&gt;Thank you for your valuable question&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 14:18:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-internal-table-data-with-another-internal-table-without-loop/m-p/12274399#M1988170</guid>
      <dc:creator>OlegBash</dc:creator>
      <dc:date>2020-12-07T14:18:11Z</dc:date>
    </item>
  </channel>
</rss>

