<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096222#M436460</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;First fetch the data from Ztable into Internal Table for that plant.&lt;/P&gt;&lt;P&gt;sort itab.&lt;/P&gt;&lt;P&gt;Delete the records from that Itab where plant is 1000.&lt;/P&gt;&lt;P&gt;delete Itab where werks = '1000'&lt;/P&gt;&lt;P&gt;deletes all the plant records,&lt;/P&gt;&lt;P&gt;Now modify the Ztable with this ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Apr 2007 06:36:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-19T06:36:45Z</dc:date>
    <item>
      <title>DELETE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096220#M436458</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 delete all records from a custom table based on one of the KEY field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 4 key fields in the table and one among them is PLANT(WERKS).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using the statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; DELETE FROM zxxx WHERE werks = '1000'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here only the first satisfying condition record is deleted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to delete all records where werks = '1000'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls help me with the DELETE syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 06:34:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096220#M436458</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T06:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096221#M436459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi prabha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. We can do like this also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Data : ztab like ztab occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   select * from ztab&lt;/P&gt;&lt;P&gt;   into table ztab&lt;/P&gt;&lt;P&gt;  where werks = '1000'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Loop at ztab.&lt;/P&gt;&lt;P&gt;  DELETE ZTAB FROM ZTAB.&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;&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>Thu, 19 Apr 2007 06:36:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096221#M436459</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T06:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096222#M436460</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;First fetch the data from Ztable into Internal Table for that plant.&lt;/P&gt;&lt;P&gt;sort itab.&lt;/P&gt;&lt;P&gt;Delete the records from that Itab where plant is 1000.&lt;/P&gt;&lt;P&gt;delete Itab where werks = '1000'&lt;/P&gt;&lt;P&gt;deletes all the plant records,&lt;/P&gt;&lt;P&gt;Now modify the Ztable with this ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 06:36:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096222#M436460</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T06:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096223#M436461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this way.&lt;/P&gt;&lt;P&gt;select * from zxxx into table itab where plant = '1000'.&lt;/P&gt;&lt;P&gt;delete zxxx from table itab.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 06:37:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096223#M436461</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T06:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096224#M436462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this from help..&lt;/P&gt;&lt;P&gt;DELETE { {FROM target [WHERE sql_cond]} &lt;/P&gt;&lt;P&gt;| {target FROM source} }. &lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;The statement DELETE deletes one or more rows from the database table specified in target. The rows that are to be deleted are specified either in a WHERE condition sql_cond or with data objects in source. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System Fields &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement DELETE sets the values of the system fields sy-subrc and sy-dbcnt. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sy-subrc Meaning &lt;/P&gt;&lt;P&gt;0 A least one row was deleted. &lt;/P&gt;&lt;P&gt;4 At least one row could not be deleted, since it was not found in the database table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement MODIFY sets sy-dbcnt to the number of deleted rows. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE dbtab - cond &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax &lt;/P&gt;&lt;P&gt;... WHERE sql_cond. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;The WHERE addition uses a logical expression sql_cond to specify which rows in the database table are deleted. The same applies to the logical expression sql_cond as for the WHERE condition of the SELECT statement. If there is no row in the database that satisfies the WHERE condition, no row is deleted and sy-subrc is set to 4. If no WHERE condition is specified, all rows are deleted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note &lt;/P&gt;&lt;P&gt;As of Release 6.10, specifying the WHERE condition is optional. Prior to Release 6.10, you had to specify the WHERE condition in this variant of the DELETE statement and you could not use dynamic logical expressions. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the following example, all an airline's flights for today in which no seats are occupied are deleted from the database table SFLIGHT (see also, example to dtab-source). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS p_carrid TYPE sflight-carrid. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE FROM sflight &lt;/P&gt;&lt;P&gt;WHERE carrid = p_carrid AND &lt;/P&gt;&lt;P&gt;fldate = sy-datum AND &lt;/P&gt;&lt;P&gt;seatsocc = 0. &lt;/P&gt;&lt;P&gt;Syntax &lt;/P&gt;&lt;P&gt;... FROM wa|{TABLE itab}. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatives: &lt;/P&gt;&lt;P&gt;1. ... FROM wa &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. ... FROM TABLE itab &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;After FROM, you can specifiy a data object wa that is not table-type or an internal table itab. The content of the data objects determines the row(s) to be deleted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternative 1 &lt;/P&gt;&lt;P&gt;... FROM wa &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;Effect &lt;/P&gt;&lt;P&gt;If you specify a work area wa that is not table-type, a row is searched for in the database table whose primary key content is the same as that of the corresponding initial part of the work area. The content of the work area is not converted and is interpreted according to the structure of the database table or view. This row is deleted. The work area must meet the prerequisites for use in Open SQL statements. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is no row in the database with the same content as the primary key, no row is deleted and sy-subrc is set to 4. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes &lt;/P&gt;&lt;P&gt;The work area wa should be declared wit reference to the database table or view in the ABAP Dictionary using the length of the primary key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the database table of view are specified statically, you do not have to specify the work area with FROM wa outside of classes if a table work area dbtab is declared for the relevant database table or view using the TABLES statement. The system then implicitly adds the FROM dbtab addition to the DELETE statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternative 2 &lt;/P&gt;&lt;P&gt;... FROM TABLE itab &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;Effect &lt;/P&gt;&lt;P&gt;If an internal table itab is specified, the system processed all rows of the internal table according to the rules for the work area wa. The row type of the internal table must meet the prerequisites for use in Open SQLstatements. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If, for a row of the internal table, there is no row in the database with the same content as the primary key, the corresponding row is ignored and sy-subrc is set to 4. If the internal table is empty, sy-subrc is set to 0. The system field sy-dbcnt is always set to the number of rows actually deleted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the following example, all today's flights of an airline in which no seats are occupied are deleted from the database table SFLIGHT. The client field must be in the row structure of the internal table sflight_key_tab. Otherwise it does not cover the primary key of the database table and incorrect key values will be accepted as a result. This example has the same function as that for dtab-cond, but it requires two database accesses. The deleted rows are recorded in the internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS p_carrid TYPE sflight-carrid. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF sflight_key, &lt;/P&gt;&lt;P&gt;mandt TYPE sflight-mandt, &lt;/P&gt;&lt;P&gt;carrid TYPE sflight-carrid, &lt;/P&gt;&lt;P&gt;connid TYPE sflight-connid, &lt;/P&gt;&lt;P&gt;fldate TYPE sflight-fldate, &lt;/P&gt;&lt;P&gt;END OF sflight_key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA sflight_key_tab TYPE TABLE OF sflight_key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT carrid connid fldate &lt;/P&gt;&lt;P&gt;FROM sflight &lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE sflight_key_tab &lt;/P&gt;&lt;P&gt;WHERE carrid = p_carrid AND &lt;/P&gt;&lt;P&gt;fldate = sy-datum AND &lt;/P&gt;&lt;P&gt;seatsocc = 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE sflight FROM TABLE sflight_key_tab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do reward if it helps,&lt;/P&gt;&lt;P&gt;Kishi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 06:37:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096224#M436462</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T06:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096225#M436463</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;tables:&amp;lt;db table&amp;gt;.&lt;/P&gt;&lt;P&gt;select * from &amp;lt;db table&amp;gt; into wa where bukrs = '1000'..&lt;/P&gt;&lt;P&gt;delete &amp;lt;db table&amp;gt; from wa.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 06:37:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096225#M436463</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T06:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096226#M436464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prabha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         Use the DELETE statement within LOOP and ENDLOOP commands.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward me if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Viji..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 06:38:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096226#M436464</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T06:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096227#M436465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE FROM &amp;lt;b&amp;gt;TABLE&amp;lt;/b&amp;gt; zxxx WHERE werks = '1000'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 06:40:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096227#M436465</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T06:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: DELETE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096228#M436466</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;DELETE zxxx WHERE werks = '1000'.&lt;/P&gt;&lt;P&gt;&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; Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 06:42:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete/m-p/2096228#M436466</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T06:42:29Z</dc:date>
    </item>
  </channel>
</rss>

