<?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: DELETE with SELECT-OPTIONS in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175244#M124176</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Helder,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Just say,&lt;/P&gt;&lt;P&gt;   SELECT-OPTIONS s_matnr FOR mara-matnr.&lt;/P&gt;&lt;P&gt;   REFRESH s_matnr.&lt;/P&gt;&lt;P&gt;   CLEAR s_matnr.&lt;/P&gt;&lt;P&gt; Remember even if it is a select option, it is a internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jan 2006 14:39:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-01-10T14:39:35Z</dc:date>
    <item>
      <title>DELETE with SELECT-OPTIONS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175238#M124170</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 want to know if we can use a SELECT-OPTION in a query to delete a TABLE ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
SELECT-OPTIONS:
    so_tname FOR DD02L-TABNAME.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know in a select I can do something like that :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT TABNAME
  FROM DD02L
  INTO TABLE INT_TAB
  WHERE TABNAME IN so_tname 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can we use something similar in a DELETE query ? Because for the moment i'm only able to do that with a parameter on 1 table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DELETE
  FROM (p_tab) 
  WHERE ....
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2006 13:52:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175238#M124170</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-10T13:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE with SELECT-OPTIONS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175239#M124171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi helder,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Yes ofcourse.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete from dbtab&lt;/P&gt;&lt;P&gt;where fieldname in seloption.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt; VERY IMPORTANT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. MAKE SURE THERE IS SOME VALUE&lt;/P&gt;&lt;P&gt;  IN SELECT-OPTION&lt;/P&gt;&lt;P&gt;  IF IT IS BLANK,&lt;/P&gt;&lt;P&gt;  ALL RECORDS IN THE TABLE WILL BE DELETED !!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Amit Mittal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2006 13:53:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175239#M124171</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-10T13:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE with SELECT-OPTIONS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175240#M124172</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;Yes you can:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE FROM &amp;lt;TABLE&amp;gt; WHERE &amp;lt;COND IN SELEC-OPTION&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2006 13:53:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175240#M124172</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-10T13:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE with SELECT-OPTIONS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175241#M124173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In fact what i need is to clear all the records in the table of the select-options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i have : ztest1, ztest2, ztest3 in the select options, i want to clear these 3 tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2006 14:02:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175241#M124173</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-10T14:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE with SELECT-OPTIONS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175242#M124174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. i tried at my end. &lt;/P&gt;&lt;P&gt;   it works pefectly fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.  sample code (just copy paste)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  zam_temp07                               .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : tname LIKE dd02l-tabname.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS : tn FOR tname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT tn.&lt;/P&gt;&lt;P&gt;  DELETE FROM (tn-low).&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2006 14:06:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175242#M124174</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-10T14:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE with SELECT-OPTIONS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175243#M124175</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;If you want to delete all hits in your table you can use DELETE FROM without where conditions, it works from rel. 4.7, I don't remember for other release.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: SO_TAB FOR DD02L-TABNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA TAB_TABLE LIKE STANDARD TABLE OF DD02L WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Make sure to delete only records of existing tables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;SELECT * FROM DD02L INTO TABLE TAB_TABLE&lt;/P&gt;&lt;P&gt;WHERE TABNAME IN SO_TAB&lt;/P&gt;&lt;P&gt;  AND AS4LOCAL = 'A'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT TAB_TABLE.&lt;/P&gt;&lt;P&gt;DELETA FROM (TAB_TABLE-TAB_NAME).&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Remember this code is very dangerous, because you could delete the data of whichever SAP table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: max bianchi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2006 14:24:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175243#M124175</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-10T14:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE with SELECT-OPTIONS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175244#M124176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Helder,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Just say,&lt;/P&gt;&lt;P&gt;   SELECT-OPTIONS s_matnr FOR mara-matnr.&lt;/P&gt;&lt;P&gt;   REFRESH s_matnr.&lt;/P&gt;&lt;P&gt;   CLEAR s_matnr.&lt;/P&gt;&lt;P&gt; Remember even if it is a select option, it is a internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Srikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2006 14:39:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-with-select-options/m-p/1175244#M124176</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-10T14:39:35Z</dc:date>
    </item>
  </channel>
</rss>

