<?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: How to avoid Delete after select error in Code Inspector in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261881#M1987131</link>
    <description>&lt;P&gt;Don't you think this would be better:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  IF lt_inact_data[] IS NOT INITIAL.
    SELECT * FROM zpaheadcount INTO TABLE @DATA(lt_hcount)
      FOR ALL ENTRIES IN @lt_inact_data
      WHERE kostl = @lt_inact_data-cc(4).
    IF sy-subrc = 0.
      SORT lt_hcount BY kostl.
      DELETE ADJACENT DUPLICATES FROM lt_hcount COMPARING kostl.
    ENDIF.
  ENDIF.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Aug 2020 18:44:57 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2020-08-12T18:44:57Z</dc:date>
    <item>
      <title>How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261876#M1987126</link>
      <description>&lt;P&gt;I have written below logic, its showing as error in SCI as "DELETE statement for result of SELECT statement found" , &lt;/P&gt;
  &lt;P&gt;how can I fix this ?&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  IF lt_inact_data[] IS NOT INITIAL.
    SELECT * FROM zpaheadcount INTO TABLE @DATA(lt_hcount)
    FOR ALL ENTRIES IN @lt_inact_data
    WHERE kostl = @lt_inact_data-cc(4).
  ENDIF.

  SORT lt_hcount BY kostl.

  DELETE ADJACENT DUPLICATES FROM lt_hcount COMPARING kostl.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;What should be written to avoid this Code insepector error? I mean how can I replicated delete under &lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 13:18:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261876#M1987126</guid>
      <dc:creator>svasi_08</dc:creator>
      <dc:date>2020-08-12T13:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261877#M1987127</link>
      <description>&lt;P&gt;When I see your code, I wonder what lt_hcount contains if lt_inact_data is initial. I guess Code Inspector has the same interrogation...&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 13:35:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261877#M1987127</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-08-12T13:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261878#M1987128</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;With the code pushdown, you should probably force the Sort/delete on the database.&lt;BR /&gt;So select distinct and order by in the SQL rather than ABAP.&lt;BR /&gt;&lt;BR /&gt;And if your code needs to stay like this, use a pragma dedicated to hiding this error (usually the ATC error description mentions which pragma hides the error).&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Michal &lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 14:02:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261878#M1987128</guid>
      <dc:creator>Szczerbowski</dc:creator>
      <dc:date>2020-08-12T14:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261879#M1987129</link>
      <description>&lt;P&gt;Hi Sandra, &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"When I see your code, I wonder what lt_hcount contains if lt_inact_data is initial. I guess Code Inspector has the same interrogation..." &lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Dont think thats the issue. Good point any way I have moved code inside the if else condition, but still error exists. &lt;/P&gt;&lt;P&gt;Hi Michal&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Hi,
With the code pushdown, you should probably force the Sort/delete on the database.
So select distinct and order by in the SQL rather than ABAP.

And if your code needs to stay like this, use a pragma dedicated to hiding this error (usually the ATC error description mentions which pragma hides the error).
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am not sure how to get only specific data based on the order when I am using distinct and order by, any code help is highly appreiacted. &lt;/P&gt;&lt;P&gt;and there is no Pragma for this to hide, thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 15:31:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261879#M1987129</guid>
      <dc:creator>svasi_08</dc:creator>
      <dc:date>2020-08-12T15:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261880#M1987130</link>
      <description>&lt;P&gt;Lifting for answers&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 18:11:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261880#M1987130</guid>
      <dc:creator>svasi_08</dc:creator>
      <dc:date>2020-08-12T18:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261881#M1987131</link>
      <description>&lt;P&gt;Don't you think this would be better:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  IF lt_inact_data[] IS NOT INITIAL.
    SELECT * FROM zpaheadcount INTO TABLE @DATA(lt_hcount)
      FOR ALL ENTRIES IN @lt_inact_data
      WHERE kostl = @lt_inact_data-cc(4).
    IF sy-subrc = 0.
      SORT lt_hcount BY kostl.
      DELETE ADJACENT DUPLICATES FROM lt_hcount COMPARING kostl.
    ENDIF.
  ENDIF.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Aug 2020 18:44:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261881#M1987131</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-08-12T18:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261882#M1987132</link>
      <description>&lt;P&gt;Hi Sandra, &lt;/P&gt;&lt;P&gt;Looks better the code but not helping to erase the code inspector error. &lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 19:29:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261882#M1987132</guid>
      <dc:creator>svasi_08</dc:creator>
      <dc:date>2020-08-12T19:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261883#M1987133</link>
      <description>&lt;P&gt;Looking for some answers, thank you. &lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 20:13:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261883#M1987133</guid>
      <dc:creator>svasi_08</dc:creator>
      <dc:date>2020-08-12T20:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261884#M1987134</link>
      <description>&lt;P&gt;it would be helpful to have the exact structure of this db table.&lt;/P&gt;&lt;P&gt;maybe you could play with subquery &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT *  
       FROM zpaheadcount
       WHERE [the_key] EQ ( SELECT [the_key] 
                                    FROM zpaheadcount
                                    FOR ALL ENTRIES IN ...
                                    WHERE kostl = ....  )
      ORDER BY kostl
      INTO TABLE @data(something_with_real_name).
                                    
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Aug 2020 05:36:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261884#M1987134</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2020-08-13T05:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261885#M1987135</link>
      <description>&lt;P&gt;select distinct?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 06:16:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261885#M1987135</guid>
      <dc:creator>TheGokke</dc:creator>
      <dc:date>2020-08-13T06:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261886#M1987136</link>
      <description>&lt;P&gt;FOR ALL ENTRIES already forces a SELECT DISTINCT.&lt;/P&gt;&lt;BR /&gt;Kind regards,&lt;BR /&gt;Mateusz</description>
      <pubDate>Thu, 13 Aug 2020 06:45:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261886#M1987136</guid>
      <dc:creator>MateuszAdamus</dc:creator>
      <dc:date>2020-08-13T06:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261887#M1987137</link>
      <description>&lt;P&gt;FOR ALL ENTRIES forces distinct based on the fields list, as there is a SELECT * there is no distinct&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 06:56:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261887#M1987137</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2020-08-13T06:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid Delete after select error in Code Inspector</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261888#M1987138</link>
      <description>&lt;P&gt;Well, as other people indicated, FOR ALL already implies distinct, so...&lt;BR /&gt;&lt;BR /&gt;Do you really need all them columns, or just a specific one and cost center for key?&lt;BR /&gt;Why do you have duplicates in that table for CC, and why don't you care which line you get?&lt;BR /&gt;&lt;BR /&gt;Then maybe group by would help, but then you need to change that for all into ranges IN maybe?&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Michał&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 09:43:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-delete-after-select-error-in-code-inspector/m-p/12261888#M1987138</guid>
      <dc:creator>Szczerbowski</dc:creator>
      <dc:date>2020-08-13T09:43:56Z</dc:date>
    </item>
  </channel>
</rss>

