<?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 Delete DB table rows do not exist in ITAB in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-db-table-rows-do-not-exist-in-itab/m-p/12526185#M2005081</link>
    <description>&lt;P&gt;I have a ztable with 3 rows, &lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2041507-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;I fill an ITAB with this 3 rows .&lt;/P&gt;
  &lt;P&gt;Then the user deletes the row with material 202 from the ITAB.&lt;/P&gt;
  &lt;P&gt;So now the ITAB has the following records:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2041510-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;How can I update the DB ZTABLE in order to have the same records as the ITAB.&lt;/P&gt;
  &lt;P&gt;1 way is to delete the records from ZTABLE and then MODIFY it from the ITAB.&lt;/P&gt;
  &lt;P&gt;So my question is, how to DELETE the extra row from ZTABLE in order to have the same number of rows with ITAB?&lt;/P&gt;
  &lt;P&gt;Thanks&lt;/P&gt;
  &lt;P&gt;Elias&lt;/P&gt;</description>
    <pubDate>Tue, 19 Apr 2022 10:20:26 GMT</pubDate>
    <dc:creator>ekekakos</dc:creator>
    <dc:date>2022-04-19T10:20:26Z</dc:date>
    <item>
      <title>Delete DB table rows do not exist in ITAB</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-db-table-rows-do-not-exist-in-itab/m-p/12526185#M2005081</link>
      <description>&lt;P&gt;I have a ztable with 3 rows, &lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2041507-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;I fill an ITAB with this 3 rows .&lt;/P&gt;
  &lt;P&gt;Then the user deletes the row with material 202 from the ITAB.&lt;/P&gt;
  &lt;P&gt;So now the ITAB has the following records:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2041510-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;How can I update the DB ZTABLE in order to have the same records as the ITAB.&lt;/P&gt;
  &lt;P&gt;1 way is to delete the records from ZTABLE and then MODIFY it from the ITAB.&lt;/P&gt;
  &lt;P&gt;So my question is, how to DELETE the extra row from ZTABLE in order to have the same number of rows with ITAB?&lt;/P&gt;
  &lt;P&gt;Thanks&lt;/P&gt;
  &lt;P&gt;Elias&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 10:20:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-db-table-rows-do-not-exist-in-itab/m-p/12526185#M2005081</guid>
      <dc:creator>ekekakos</dc:creator>
      <dc:date>2022-04-19T10:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Delete DB table rows do not exist in ITAB</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-db-table-rows-do-not-exist-in-itab/m-p/12526186#M2005082</link>
      <description>&lt;P&gt;Could you please, post your code,  using the beautoful button [CODE].&lt;/P&gt;&lt;P&gt;Or just check the transaction ABAPDOCU, enter the keywork DELETE &lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 12:14:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-db-table-rows-do-not-exist-in-itab/m-p/12526186#M2005082</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2022-04-19T12:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Delete DB table rows do not exist in ITAB</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-db-table-rows-do-not-exist-in-itab/m-p/12526187#M2005083</link>
      <description>&lt;OL&gt;&lt;LI&gt;Lock the table (to avoid concurrent update by other user)&lt;/LI&gt;&lt;LI&gt;Read the database table into internal table&lt;/LI&gt;&lt;LI&gt;Logic to change the lines of the internal table&lt;/LI&gt;&lt;LI&gt;Compare database table versus internal table&lt;/LI&gt;&lt;LI&gt;Update database according to deletions, insertions, modifications&lt;/LI&gt;&lt;LI&gt;Unlock the table&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Alternatively, the step 4 can be avoided if the logic records the type of operation for each changed line (i.e. delete, insert, modification)&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 13:12:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-db-table-rows-do-not-exist-in-itab/m-p/12526187#M2005083</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-04-19T13:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Delete DB table rows do not exist in ITAB</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-db-table-rows-do-not-exist-in-itab/m-p/12526188#M2005084</link>
      <description>&lt;P&gt;Thanks Sandra. My problem is in step No 5. The Insertion &amp;amp; Modification are covered by the command MODIFY. But how to tell the SAP: DELETE the lines from DB ZTABLE that do not exist in ITAB or KEEP only the lines that exist in ITAB?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 13:24:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-db-table-rows-do-not-exist-in-itab/m-p/12526188#M2005084</guid>
      <dc:creator>ekekakos</dc:creator>
      <dc:date>2022-04-19T13:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Delete DB table rows do not exist in ITAB</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/delete-db-table-rows-do-not-exist-in-itab/m-p/12526189#M2005085</link>
      <description>&lt;P&gt;Hi Elias,&lt;/P&gt;&lt;P&gt;I think you can do this:&lt;/P&gt;&lt;P&gt;Create 2 internal tables, one of them with all selected records, the other one with those records that were deleted by the user.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: ti_selected TYPE STANDARD TABLE OF tp_table,
      ti_deleted  TYPE STANDARD TABLE OF tp_table.

SELECT field1, field2,....
INTO @ti_selected
FROM dbtable.

*When the user deletes a row, move it to TI_DELETED, then delete it from TI_SELECTED.
APPEND es_selected TO ti_deleted.
DELETE ti_selected WHERE .... .

*At the end of the process, delete the data base table with the records in TI_DELETED.
DELETE dbtable FROM TABLE @ti_deleted.

*Modify the records with TI_SELECTED
MODIFY dbtable FROM TABLE @ti_selected.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Apr 2022 16:27:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/delete-db-table-rows-do-not-exist-in-itab/m-p/12526189#M2005085</guid>
      <dc:creator>lemoreno</dc:creator>
      <dc:date>2022-04-19T16:27:12Z</dc:date>
    </item>
  </channel>
</rss>

