<?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 a table in a single shot using a single read statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12372005#M1993697</link>
    <description>&lt;SPAN class="mention-scrubbed"&gt;vinodhict123&lt;/SPAN&gt; SELECT ... ENDSELECT is called a SELECT &lt;STRONG&gt;loop&lt;/STRONG&gt;. It means it loops at all packages. Please read the official ABAP documentation.But two &lt;STRONG&gt;important&lt;/STRONG&gt; remarks:&lt;UL&gt;&lt;LI&gt;IF sy-subrc = 0 right after SELECT of a SELECT is completely wrong, just remove this useless IF, and move it after ENDSELECT so that to WRITE depending on at least one iteration (sy-subrc = 0) or none at all (sy-subrc &amp;lt;&amp;gt; 0).&lt;/LI&gt;&lt;LI&gt;Did you test what happens if you have a second "package"? (more than 1 iteration) Doesn't it short dump? (because of COMMIT WORK, see my previous comment that you have ignored)&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Thu, 11 Mar 2021 08:20:54 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2021-03-11T08:20:54Z</dc:date>
    <item>
      <title>Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371985#M1993677</link>
      <description>&lt;P&gt;I am using two table zle_ca_id_tmp and likp.My requirement is create a program and below logic&lt;/P&gt;
  &lt;P&gt;If ZLE_CA_ID_TMP.VBELN is not in LIKP.VBELN then delete the row the zle_ca_id_tmp in a single shot.&lt;/P&gt;
  &lt;P&gt;This should be done in a single read statement in my requirement.&lt;/P&gt;
  &lt;P&gt;I am using the below code and facing a issue in select and delete statement.Kindly please help in modifying with the correct query.&lt;/P&gt;
  &lt;P&gt;Situation&lt;/P&gt;
  &lt;P&gt;table zle_ca_id_tmp has 12,500,000 rows and table likp has 700,000 rows&lt;/P&gt;
  &lt;P&gt;we have two tables zle_ca_id_tmp and likp so do one read using both tables.&lt;/P&gt;
  &lt;P&gt;Create a new program with the below&lt;/P&gt;
  &lt;P&gt;If ZLE_CA_ID_TMP.VBELN is not in LIKP.VBELN&lt;/P&gt;
  &lt;P&gt;Then delete the row from table ZLE_CA_ID_TMP&lt;/P&gt;
  &lt;P&gt;Either if the outbound delivery no longer exists in LIKP then delete it from table ZLE_CA_ID_TMP Or if the outbound delivery exists in LIKP then leave it alone in the table ZLE_CA_ID_TMP&lt;/P&gt;
  &lt;P&gt;This should clear about 12 million rows.&lt;/P&gt;
  &lt;P&gt;LIKP contains lots of deliveries which are not present on table ZLE_CA_ID_TMP&lt;/P&gt;
  &lt;UL&gt; 
   &lt;LI&gt;as LIKP contains Inbound and outbound delivereis&lt;/LI&gt; 
   &lt;LI&gt;as ZLE_CA_ID_TMP contains outbound deliveries for customer orders&lt;/LI&gt; 
  &lt;/UL&gt;
  &lt;P&gt;Therefore&lt;/P&gt;
  &lt;UL&gt; 
   &lt;LI&gt;Need to select ZLE_CA_ID_TMP.VBELN&lt;/LI&gt; 
   &lt;LI&gt;Where ZLE_CA_ID_TMP.VBELN does not exist in LIKP.VBELN&lt;/LI&gt; 
  &lt;/UL&gt;
  &lt;P&gt;My code:&lt;/P&gt;
  &lt;P&gt;SELECT a~vbeln INTO TABLE li_zle_ca_id FROM zle_ca_id_temp AS a WHERE NOT EXISTS ( SELECT b~vbeln FROM likp AS b WHERE b~vbeln = a~vbeln ) .&lt;/P&gt;
  &lt;P&gt; IF sy-subrc = 0. &lt;/P&gt;
  &lt;P&gt; DELETE zle_ca_id_temp FROM TABLE li_zle_ca_id. &lt;/P&gt;
  &lt;P&gt; COMMIT WORK.&lt;/P&gt;
  &lt;P&gt;Can you please help in modifying the query for my requirement.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 07:13:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371985#M1993677</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-02-28T07:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371986#M1993678</link>
      <description>Welcome and thanks for visiting SAP Community to get answers to your questions. Check out our tutorial to get started in SAP Community: &lt;A href="https://developers.sap.com/tutorials/community-start.html" target="test_blank"&gt;https://developers.sap.com/tutorials/community-start.html&lt;/A&gt;&lt;BR /&gt;By adding a picture to your profile you encourage readers to respond to your question: &lt;A href="https://www.youtube.com/watch?v=46bt1juWUUM" target="test_blank"&gt;https://www.youtube.com/watch?v=46bt1juWUUM&lt;/A&gt;</description>
      <pubDate>Sun, 28 Feb 2021 07:13:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371986#M1993678</guid>
      <dc:creator>moshenaveh</dc:creator>
      <dc:date>2021-02-28T07:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371987#M1993679</link>
      <description>&lt;P&gt;What is your "issue in select and delete statement"? Is it the result of SELECT which doesn't select the lines you want or is it DELETE which doesn't delete?&lt;/P&gt;&lt;P&gt;Please use the debugger and tell us.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 08:10:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371987#M1993679</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-02-28T08:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371988#M1993680</link>
      <description>&lt;P&gt;We would really need more information about what really is the problem here to help the best. But you can start with removing the b~ in &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WHERE NOT EXISTS (Select b~vbeln from LIKP&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; You never define the b, so that can't possibly work.&lt;/P&gt;&lt;P&gt;Next tip, if you're having problem with the DELETE is to make sure that the row type of li_zle_ca_id is matching the entire table key of your table. &lt;A href="https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenopen_sql_wa.htm" target="_blank"&gt;ABAP Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 18:26:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371988#M1993680</guid>
      <dc:creator>joltdx</dc:creator>
      <dc:date>2021-02-28T18:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371989#M1993681</link>
      <description>&lt;P&gt;Hello Sandra,&lt;/P&gt;&lt;P&gt;I am having issue in select and delete. It is not fetching the value and also sy-subrc gets failed for the condition.The requirement is using a single select and delete statement for the table zle_ca_id_tmp.vbeln is not in LIKP.vbeln then it should delete the records from zle_ca_id_tmp.Can you please help in modifying the query of select and delete.Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 08:52:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371989#M1993681</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-03-01T08:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371990#M1993682</link>
      <description>&lt;P&gt;I will suppose you get in trouble due to high number of records to delete and triggered some dump?&lt;/P&gt;&lt;P&gt;Could you switch to a logic such as :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA subrc TYPE sy-subrc.
WHILE subrc = 0.
  DELETE FROM zle_ca_id_tmp
    WHERE NOT EXISTS ( SELECT vbeln FROM likp WHERE vbeln EQ zle_ca_id_tmp~vbeln )
    UP TO 100000 ROWS.
  subrc = sy-subrc.
  CALL FUNCTION 'DB_COMMIT'.
ENDWHILE.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Mar 2021 09:15:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371990#M1993682</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2021-03-01T09:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371991#M1993683</link>
      <description>&lt;P&gt;Hi Raymond,&lt;/P&gt;&lt;P&gt;My functional team has asked to change the below.Can you please in this regards.&lt;/P&gt;&lt;P&gt;Select needs to be changed&lt;/P&gt;&lt;P&gt;LIKP contains lots of deliveries which are not present on table ZLE_CA_ID_TMP&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;as LIKP contains Inbound and outbound delivereis&lt;/LI&gt;&lt;LI&gt;as ZLE_CA_ID_TMP contains outbound deliveries for customer orders&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Therefore&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;Need to select ZLE_CA_ID_TMP.VBELN&lt;/LI&gt;&lt;LI&gt;Where ZLE_CA_ID_TMP.VBELN does not exist in LIKP.VBELN&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 01 Mar 2021 13:22:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371991#M1993683</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-03-01T13:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371992#M1993684</link>
      <description>&lt;SPAN class="mention-scrubbed"&gt;vinodhict123&lt;/SPAN&gt; Could you clarify why Raymond answer does not answer your question?</description>
      <pubDate>Mon, 01 Mar 2021 17:22:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371992#M1993684</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-03-01T17:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371993#M1993685</link>
      <description>&lt;P&gt;Hi Sandra, The code given by him is working but my functional has asked to do with below select statement first and then delete. &lt;/P&gt;&lt;P&gt;Select needs to be changed&lt;/P&gt;&lt;P&gt;LIKP contains lots of deliveries which are not present on table ZLE_CA_ID_TMP&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;as LIKP contains Inbound and outbound delivereis&lt;/LI&gt;&lt;LI&gt;as ZLE_CA_ID_TMP contains outbound deliveries for customer orders&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Therefore&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;Need to select ZLE_CA_ID_TMP.VBELN&lt;/LI&gt;&lt;LI&gt;Where ZLE_CA_ID_TMP.VBELN does not exist in LIKP.VBELN&lt;/LI&gt;&lt;LI&gt;Can you please help in this regards. &lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 02 Mar 2021 08:12:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371993#M1993685</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-03-02T08:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371994#M1993686</link>
      <description>&lt;P&gt;IN this case, just convert the DELETE statement in a SELECT statement into an internal table, and use a DELETE statement using the intyernal table. &lt;/P&gt;&lt;P&gt;You can load the data by batch and destroy it as in my example or switch to a cursor technique (OPEN CURSOR) and batch read (FETCH) this is basic Abap&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 08:37:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371994#M1993686</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2021-03-02T08:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371995#M1993687</link>
      <description>&lt;P&gt;Ask an abapper tp convert theDELETE statement of my sample into a SELECT INTO TABLE and then add a DELETE using this internaml table.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 08:54:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371995#M1993687</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2021-03-03T08:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371996#M1993688</link>
      <description>&lt;P&gt;Hello Raymond,&lt;/P&gt;&lt;P&gt;I am using the below code but it is not working .Can you please in this regards.&lt;/P&gt;&lt;P&gt;WHILE subrc = 0. &lt;/P&gt;&lt;P&gt;SELECT vbeln FROM zle_ca_id_tmp INTO TABLE li_zle_ca_id
    WHERE NOT EXISTS ( SELECT vbeln FROM likp WHERE vbeln EQ zle_ca_id_tmp~vbeln ). &lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.
DELETE zle_ca_id_tmp FROM TABLE li_zle_ca_id.&lt;/P&gt;&lt;P&gt;
subrc = sy-subrc. &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'DB_COMMIT'.
ENDIF.
ENDWHILE. &lt;/P&gt;&lt;P&gt;WRITE: 'The records are deleted from table ZLE_CA_ID'.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 09:04:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371996#M1993688</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-03-03T09:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371997#M1993689</link>
      <description>&lt;P&gt;Replace &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT vbeln FROM zle_ca_id_tmp&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;with &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM zle_ca_id_tmp&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and use the whole database table for the internal table structure definition&lt;/P&gt;&lt;P&gt;move also&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;subrc = sy-subrc.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;out of the if/endif block&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 09:36:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371997#M1993689</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2021-03-03T09:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371998#M1993690</link>
      <description>&lt;P&gt;Hello Raymond,&lt;/P&gt;&lt;P&gt;I have tried the code but it is not working for me. Can you please help in modifying the query for this requirement.&lt;/P&gt;&lt;P&gt;Thanks in advance! &lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 09:56:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371998#M1993690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-03-03T09:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371999#M1993691</link>
      <description>&lt;P&gt;Hello Raymond,&lt;/P&gt;&lt;P&gt;The code worked but my functional has asked me to do this in smaller chunks so commit after each 1000 rows. Can you please help in providing the code for this requirement. Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 13:07:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12371999#M1993691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-03-04T13:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12372000#M1993692</link>
      <description>&lt;A href="https://answers.sap.com/users/1186108/vinodhict123.html"&gt;VIJAY v&lt;/A&gt; SELECT ... FROM z... UP TO 1000 ROWS ...Please search a little bit the Web:&lt;PRE&gt;&lt;CODE&gt;select maximum rows site:sap.com&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;(and the official ABAP documentation "UP TO" appears in 4th position for me)&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 14:33:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12372000#M1993692</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-03-04T14:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12372001#M1993693</link>
      <description>&lt;P&gt;Hello Raymond/Sandra,&lt;/P&gt;&lt;P&gt;I have used the below query.Can you please confirm for the same.&lt;/P&gt;&lt;P&gt;SELECT * FROM zle_ca_id
    INTO TABLE li_zle_ca_id PACKAGE SIZE 1000
    WHERE NOT EXISTS
       ( SELECT vbeln FROM likp
           WHERE vbeln EQ zle_ca_id~vbeln ). &lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt; DELETE zle_ca_id FROM TABLE li_zle_ca_id.&lt;/P&gt;&lt;P&gt;COMMIT WORK.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 06:59:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12372001#M1993693</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-03-05T06:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12372002#M1993694</link>
      <description>&lt;A href="https://answers.sap.com/users/1186108/vinodhict123.html"&gt;VIJAY v&lt;/A&gt; if you use PACKAGE SIZE, there must not be a IF sy-subrc = 0 and there must be a ENDSELECT. But if you want to use COMMIT WORK inside the "SELECT loop", SELECT ... ENDSELECT would short dump, instead you must use OPEN CURSOR WITH HOLD (important is WITH HOLD to retain the cursor after COMMIT WORK). (moreover please use CODE button as I do and as Raymond does)&lt;PRE&gt;&lt;CODE&gt;DATA mycursor TYPE cursor.
OPEN CURSOR WITH HOLD mycursor FOR
    SELECT * FROM zle_ca_id PACKAGE SIZE 1000 WHERE NOT EXISTS ( SELECT vbeln FROM likp WHERE vbeln EQ zle_ca_id~vbeln ).
DO.
  FETCH NEXT mycursor INTO TABLE li_zle_ca_id.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    EXIT.
  ENDIF.
  DELETE zle_ca_id FROM TABLE li_zle_ca_id.
  COMMIT WORK.
ENDDO.
CLOSE CURSOR mycursor.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Mar 2021 09:55:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12372002#M1993694</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-03-08T09:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12372003#M1993695</link>
      <description>&lt;P&gt;Thanks for your support &lt;SPAN class="mention-scrubbed"&gt;sandra.rossi&lt;/SPAN&gt; /  &lt;SPAN class="mention-scrubbed"&gt;raymond.giuseppi&lt;/SPAN&gt; .I have modified the query, tested and it is working well.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 09:19:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12372003#M1993695</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-03-10T09:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a table in a single shot using a single read statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12372004#M1993696</link>
      <description>&lt;P&gt;Hello  &lt;SPAN class="mention-scrubbed"&gt;raymond.giuseppi&lt;/SPAN&gt; /  &lt;SPAN class="mention-scrubbed"&gt;sandra.rossi&lt;/SPAN&gt; , I have one question for this issue.If I use the below code in my development,&lt;/P&gt;&lt;P&gt;SELECT * FROM zle_ca_id
      INTO TABLE li_zle_ca_id PACKAGE SIZE 1000
      WHERE NOT EXISTS
         ( SELECT vbeln FROM likp
             WHERE vbeln EQ zle_ca_id~vbeln ). &lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0. &lt;/P&gt;&lt;P&gt;DELETE zle_ca_id FROM TABLE li_zle_ca_id. &lt;/P&gt;&lt;P&gt; COMMIT WORK. &lt;/P&gt;&lt;P&gt;WRITE: 'The records are deleted from table ZLE_CA_ID'.&lt;/P&gt;&lt;P&gt;
ELSE. &lt;/P&gt;&lt;P&gt;WRITE: 'No records are deleted from table ZLE_CA_ID'. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;What will happen say there are 1500 records as the above query will take 1000 records first since we are using the package size 1000 and will it take remaining 500 records next?&lt;/P&gt;&lt;P&gt;Can you please suggest any improvement in the above code to be done.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Mar 2021 05:39:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-a-table-in-a-single-shot-using-a-single-read-statement/m-p/12372004#M1993696</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-03-11T05:39:22Z</dc:date>
    </item>
  </channel>
</rss>

