<?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: Dinamic delete. is it possible? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dinamic-delete-is-it-possible/m-p/5091374#M1181820</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It is not possible to specify the field dynamically in the delete clause,&lt;/P&gt;&lt;P&gt;but you can achieve this by adding the below code after your case endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT itab INTO wa_tab.
  ASSIGN COMPONENT l_field OF STRUCTURE wa_tab TO &amp;lt;field&amp;gt;.
  CHECK &amp;lt;field&amp;gt; EQ 'X.
  DELETE itab.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Jan 2009 08:41:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-01-29T08:41:03Z</dc:date>
    <item>
      <title>Dinamic delete. is it possible?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dinamic-delete-is-it-possible/m-p/5091370#M1181816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How are you?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible use the command delete itab. with dinamic fields?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For exemple:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;field&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do 3 times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case sy-index.&lt;/P&gt;&lt;P&gt;    when 1.&lt;/P&gt;&lt;P&gt;         l_field = 'MARK1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    when 2.&lt;/P&gt;&lt;P&gt;       l_field = 'MARK2'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    when 3.&lt;/P&gt;&lt;P&gt;       l_field = 'MARK3'.&lt;/P&gt;&lt;P&gt;endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign l_field to &amp;lt;field&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE itab WHERE &amp;lt;field&amp;gt; EQ 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&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;&lt;P&gt;thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bye.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: guilherme  lahr on Jan 28, 2009 12:17 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: guilherme  lahr on Jan 28, 2009 12:20 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2009 23:17:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dinamic-delete-is-it-possible/m-p/5091370#M1181816</guid>
      <dc:creator>guilherme_lahr</dc:creator>
      <dc:date>2009-01-27T23:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Dinamic delete. is it possible?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dinamic-delete-is-it-possible/m-p/5091371#M1181817</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 think DELETE will not allow to specify a component dynamically...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead...you can try this..In one shot you can delete the entries..instead of doing it within loop..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DELETE itab WHERE mark1 EQ 'X' OR
                  mark2 EQ 'X' OR
                  mark3 EQ 'X'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;naren&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Narendran Muthukumaran on Jan 28, 2009 12:37 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2009 23:35:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dinamic-delete-is-it-possible/m-p/5091371#M1181817</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-27T23:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Dinamic delete. is it possible?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dinamic-delete-is-it-possible/m-p/5091372#M1181818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dynamic specifications are not supported in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It says so right on the ABAP help for the DELETE itab statement, which you can access using F1 from the ABAP source editor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not just do the various deletes in your CASE instead of assigning the name of the field to delete with?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CASE sy-index.
    WHEN 1.
      DELETE itab WHERE mark1 EQ 'X'.

    WHEN 2.
      DELETE itab WHERE mark2 EQ 'X'.

    WHEN 3.
      DELETE itab WHERE mark3 EQ 'X'.

  ENDCASE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2009 23:51:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dinamic-delete-is-it-possible/m-p/5091372#M1181818</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-27T23:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Dinamic delete. is it possible?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dinamic-delete-is-it-possible/m-p/5091373#M1181819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; you can't use DELETE WHERE with dynamic tables, but it is still possible to delete records. &lt;/P&gt;&lt;P&gt;Consider a situation where you want to delete all entries in where FIELD1 (one of the fields in the table) is equal to 'X'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA. lp_data TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS:  TYPE ANY,&lt;/P&gt;&lt;P&gt;                TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA lp_data LIKE LINE OF .&lt;/P&gt;&lt;P&gt;ASSIGN lp_data-&amp;gt;* to .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT 'FIELD1' OF STRUCTURE  TO .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT  INTO .&lt;/P&gt;&lt;P&gt;  CHECK  EQ 'X'.&lt;/P&gt;&lt;P&gt;  DELETE TABLE  FROM .&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another possibility is to use, for example, with a table that has key fields kf1 and kf2:&lt;/P&gt;&lt;P&gt;DELETE TABLE WITH TABLE KEY ('KF1') = val1 ('KF2') = val2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With fully specified keys this is very efficient for HASHED tables, somewhat efficient for SORTED tables,&lt;/P&gt;&lt;P&gt; and not very efficient, usually, for STANDARD tables. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As ever, what you actually write depends on precisely what you are trying to achieve.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2009 08:06:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dinamic-delete-is-it-possible/m-p/5091373#M1181819</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-29T08:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dinamic delete. is it possible?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dinamic-delete-is-it-possible/m-p/5091374#M1181820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It is not possible to specify the field dynamically in the delete clause,&lt;/P&gt;&lt;P&gt;but you can achieve this by adding the below code after your case endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT itab INTO wa_tab.
  ASSIGN COMPONENT l_field OF STRUCTURE wa_tab TO &amp;lt;field&amp;gt;.
  CHECK &amp;lt;field&amp;gt; EQ 'X.
  DELETE itab.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2009 08:41:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dinamic-delete-is-it-possible/m-p/5091374#M1181820</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-29T08:41:03Z</dc:date>
    </item>
  </channel>
</rss>

