<?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: ABAP New Syntax - Delete in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185522#M1980249</link>
    <description>&lt;P&gt;There's no "new syntax" (you mean a constructor expression) &lt;STRONG&gt;specific to your exact requirement&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;But of course you can write it with a constructor expression, not sure if it will be readable by majority of developers though), it could be something like this, more or less:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;itab = VALUE #(
  LET c1_values = VALUE #( FOR &amp;lt;line&amp;gt; IN itab WHERE ( c2 = 1 ) ( &amp;lt;line&amp;gt;-c1 ) )
      itab2     = itab
  IN FOR &amp;lt;line&amp;gt; IN itab2
  ( LINES OF COND #( WHEN NOT line_exists( c1_values[ &amp;lt;line&amp;gt;-c1 ] THEN &amp;lt;line&amp;gt; ) ) ) ).&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 21 Jan 2020 09:40:15 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2020-01-21T09:40:15Z</dc:date>
    <item>
      <title>ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185513#M1980240</link>
      <description>&lt;P&gt;Hello experts!&lt;/P&gt;
  &lt;P&gt;Is there any new syntax regarding this example?&lt;/P&gt;
  &lt;P&gt;The following Table is given as an internal table (itab) with the two columns C1/C2:&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;C1 C2&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;X 1&lt;/P&gt;
  &lt;P&gt;X 2 &lt;/P&gt;
  &lt;P&gt;Y 1&lt;/P&gt;
  &lt;P&gt;Y 5&lt;/P&gt;
  &lt;P&gt;Z 5&lt;/P&gt;
  &lt;P&gt;Now I want to delete &lt;STRONG&gt;all &lt;/STRONG&gt;entries where C2 = 1 occurs, with the condition that if one entry of C1 has C2 = 1, that all the same entries of C1 are also deleted.. &lt;/P&gt;
  &lt;P&gt;The result should be as follows:&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;C1 C2&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;Z 5&lt;/P&gt;
  &lt;P&gt;That means:&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;C1 C2&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;X 1 --&amp;gt; C2 = 1!&lt;/P&gt;
  &lt;P&gt;X 2 --&amp;gt; C2 was 1, so that entries gets deleted as well&lt;/P&gt;
  &lt;P&gt;Y 1 --&amp;gt; Same as X 1&lt;/P&gt;
  &lt;P&gt;Y 5 --&amp;gt; Same as X 2&lt;/P&gt;
  &lt;P&gt;Z 5 --&amp;gt; no occurence of C2 = 1 and thats the reason for keeping this record.&lt;/P&gt;
  &lt;P&gt;Is there any new syntax?&lt;/P&gt;
  &lt;P&gt;Also..how to achieve this result?&lt;/P&gt;
  &lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 08:26:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185513#M1980240</guid>
      <dc:creator>former_member647100</dc:creator>
      <dc:date>2020-01-21T08:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185514#M1980241</link>
      <description>&lt;P&gt;If I understood your requirement right...&lt;/P&gt;&lt;P&gt;LOOP AT TABLE itab  INTO wa1.&lt;/P&gt;&lt;P&gt;IF wa1-c2 NE '1'.&lt;/P&gt;&lt;P&gt;REATD TABLE itab INTO wa2 WITH KEY  c1 = wa1-c1 c2 = 1.&lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.  "    This record's C2 NE 1 and C1 value of the row doesn't contain 1 in any other record either.&lt;/P&gt;&lt;P&gt;Move it to a temporary ITAB.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;Now the temporary itab should have the records that you need to keep. Does this make sense?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 08:42:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185514#M1980241</guid>
      <dc:creator>Sathya_Gunasekaran</dc:creator>
      <dc:date>2020-01-21T08:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185515#M1980242</link>
      <description>&lt;P&gt;Sorry, I missed the 'New Syntax' part of your question. As far as I know, No. But our expert friends might have a better idea.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 08:49:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185515#M1980242</guid>
      <dc:creator>Sathya_Gunasekaran</dc:creator>
      <dc:date>2020-01-21T08:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185516#M1980243</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;coding1407&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Which GUI Version are you using?&lt;/P&gt;&lt;P&gt;If you are using 7.5 or above, you can directly write select query in the internal table as mentioned below.&lt;/P&gt;&lt;P&gt;1) Try fetching the values of C1 from the internal table where C2 = 1&lt;/P&gt;&lt;P&gt;2) Now Just delete the entries from internal table where value of C1 is equal to the value fetched from above.&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 08:55:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185516#M1980243</guid>
      <dc:creator>former_member1716</dc:creator>
      <dc:date>2020-01-21T08:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185517#M1980244</link>
      <description>&lt;P&gt;to 2)&lt;/P&gt;&lt;P&gt;How to delete the entries from Itab1?&lt;/P&gt;&lt;P&gt;Delete itab1 where c1 = itab2-c1?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 09:27:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185517#M1980244</guid>
      <dc:creator>former_member647100</dc:creator>
      <dc:date>2020-01-21T09:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185518#M1980245</link>
      <description>&lt;P&gt;GUI version? You mean ABAP version.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 09:28:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185518#M1980245</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-01-21T09:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185519#M1980246</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/users/1091/sandra.rossi.html"&gt;Sandra Rossi&lt;/A&gt;, yes the ABAP version.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 09:33:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185519#M1980246</guid>
      <dc:creator>former_member1716</dc:creator>
      <dc:date>2020-01-21T09:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185520#M1980247</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/users/896303/coding1407.html"&gt;Pascal Ditzel&lt;/A&gt;, &lt;/P&gt;&lt;P&gt;You can do that in two way.&lt;/P&gt;&lt;P&gt;1) Either create a range table out of the C1 Column Values and then use the simple query as below&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DELETE ITAB1 WHERE C1 IN R_RANGE.

2) Else you can simply write another Select query non ITAB1 using for all entries where c1 NE itab2-C1.

Regards!&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 09:37:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185520#M1980247</guid>
      <dc:creator>former_member1716</dc:creator>
      <dc:date>2020-01-21T09:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185521#M1980248</link>
      <description>&lt;P&gt;C1 and C2 fetched from the same table?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 09:39:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185521#M1980248</guid>
      <dc:creator>gayathri_jayajeevan2</dc:creator>
      <dc:date>2020-01-21T09:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185522#M1980249</link>
      <description>&lt;P&gt;There's no "new syntax" (you mean a constructor expression) &lt;STRONG&gt;specific to your exact requirement&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;But of course you can write it with a constructor expression, not sure if it will be readable by majority of developers though), it could be something like this, more or less:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;itab = VALUE #(
  LET c1_values = VALUE #( FOR &amp;lt;line&amp;gt; IN itab WHERE ( c2 = 1 ) ( &amp;lt;line&amp;gt;-c1 ) )
      itab2     = itab
  IN FOR &amp;lt;line&amp;gt; IN itab2
  ( LINES OF COND #( WHEN NOT line_exists( c1_values[ &amp;lt;line&amp;gt;-c1 ] THEN &amp;lt;line&amp;gt; ) ) ) ).&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 09:40:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185522#M1980249</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-01-21T09:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185523#M1980250</link>
      <description>&lt;P&gt;I am thinking a bit loud here. This is not New syntax though.&lt;/P&gt;&lt;P&gt;SELECT c1, c2&lt;/P&gt;&lt;P&gt;FROM db&lt;/P&gt;&lt;P&gt;WHERE c2 NE 1&lt;/P&gt;&lt;P&gt;AND c1 NOT IN ( SELECT  c1 from db where c2 NE 1 )&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 09:42:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185523#M1980250</guid>
      <dc:creator>Sathya_Gunasekaran</dc:creator>
      <dc:date>2020-01-21T09:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185524#M1980251</link>
      <description>&lt;P&gt;Select query on itab1 using for all entries itab two will not work, as FOR ALL ENTRIES and @itab cannot be used together.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 09:47:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185524#M1980251</guid>
      <dc:creator>former_member647100</dc:creator>
      <dc:date>2020-01-21T09:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185525#M1980252</link>
      <description>&lt;SPAN class="mention-scrubbed"&gt;coding1407&lt;/SPAN&gt; You have a syntax error, well, but you don't provide the code. I said "something like this, more or less", because my code doesn't compile, you didn't provide some code to reproduce. c1_values doesn't exist either. I think you can find what the syntax error is. I prefer to avoid spoon feeding and let people search a little bit...</description>
      <pubDate>Tue, 21 Jan 2020 13:00:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185525#M1980252</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-01-21T13:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185526#M1980253</link>
      <description>&lt;P&gt;Spoon feeding. Tested.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF ty_line,
  c1 type c length 1,
  c2 type i,
  END OF ty_line,
  ty_itab type STANDARD TABLE OF ty_line WITH EMPTY KEY,
  ty_c1_values type SORTED TABLE OF ty_line-c1 WITH NON-UNIQUE KEY table_line.
data(itab) = value TY_itab( ( c1 = 'X' c2 = 1 ) ( c1 = 'X' c2 = 2 )
  ( c1 = 'Y' c2 = 1 ) ( c1 = 'Y' c2 = 5 ) ( c1 = 'Z' c2 = 5 ) ).
itab = VALUE #(
  LET c1_values = VALUE ty_c1_values( FOR &amp;lt;line&amp;gt; IN itab WHERE ( c2 = 1 ) ( &amp;lt;line&amp;gt;-c1 ) )
      itab2     = itab
  IN FOR &amp;lt;line&amp;gt; IN itab2
  ( LINES OF COND #( WHEN NOT line_exists( c1_values[ table_line = &amp;lt;line&amp;gt;-c1 ] ) THEN value #( ( &amp;lt;line&amp;gt; ) ) ) ) ).
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 13:07:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185526#M1980253</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-01-21T13:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP New Syntax - Delete</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185527#M1980254</link>
      <description>&lt;P&gt;If "LOOP AT GROUP BY" is considered as new syntax then there is this other variant : &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*I reused declaration lines of  Sandra Rossi answer
TYPES: BEGIN OF ty_line,
         c1 TYPE c LENGTH 1,
         c2 TYPE i,
       END OF ty_line,
       ty_itab      TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
DATA(itab) = VALUE ty_itab( ( c1 = 'X' c2 = 1 )
                            ( c1 = 'X' c2 = 2 )
                            ( c1 = 'Y' c2 = 1 )
                            ( c1 = 'Y' c2 = 5 )
                            ( c1 = 'Z' c2 = 5 ) ).


LOOP AT itab INTO DATA(wa) WHERE c2 = 1 GROUP BY ( c1 = wa-c1 )
  WITHOUT MEMBERS REFERENCE INTO DATA(gr) .
  DELETE itab WHERE c1 = gr-&amp;gt;*. "DELETE inside a LOOP
ENDLOOP.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;There is also this one (use of range) : &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*I reused declaration lines of  Sandra Rossi answer
TYPES: BEGIN OF ty_line,
         c1 TYPE c LENGTH 1,
         c2 TYPE i,
       END OF ty_line,
       ty_itab      TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
DATA(itab) = VALUE ty_itab( ( c1 = 'X' c2 = 1 )
                            ( c1 = 'X' c2 = 2 )
                            ( c1 = 'Y' c2 = 1 )
                            ( c1 = 'Y' c2 = 5 )
                            ( c1 = 'Z' c2 = 5 ) ).

DATA lr TYPE RANGE OF ty_line-c1.
LOOP AT itab INTO DATA(wa) WHERE c2 = 1 GROUP BY ( c1 = wa-c1 )
  WITHOUT MEMBERS REFERENCE INTO DATA(gr) .
  APPEND VALUE #( sign = 'I' option = 'EQ' low = gr-&amp;gt;* ) TO lr.
ENDLOOP.

IF lr IS NOT INITIAL.
  DELETE itab WHERE c1 IN lr. "DELETE outside LOOP
ENDIF.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 21:48:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-new-syntax-delete/m-p/12185527#M1980254</guid>
      <dc:creator>chaouki_akir</dc:creator>
      <dc:date>2020-01-21T21:48:08Z</dc:date>
    </item>
  </channel>
</rss>

