<?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: DB insert after DB delete in a single program on the same table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-insert-after-db-delete-in-a-single-program-on-the-same-table/m-p/1960864#M395025</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;        The solution will be like First LOCK ALL THE RECORDS you want to delete, then do a DATABASE COMMIT, then LOCK ALL THE RECORDS again (You can lock records that does not exist) then INSERT THE RECORDS and do a DATABASE COMMIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case delete is happening since there is an implicit database commit when ever a program ends.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Feb 2007 05:29:45 GMT</pubDate>
    <dc:creator>seshatalpasai_madala</dc:creator>
    <dc:date>2007-02-23T05:29:45Z</dc:date>
    <item>
      <title>DB insert after DB delete in a single program on the same table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-insert-after-db-delete-in-a-single-program-on-the-same-table/m-p/1960863#M395024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A program is first deleting some records from a databse table ( assume Table1)&lt;/P&gt;&lt;P&gt;and it is trying to insert the same records back to the table Table1 with the same&lt;/P&gt;&lt;P&gt;primary keys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This program is defective. It does not check against the table&lt;/P&gt;&lt;P&gt;Table1 to verify that the commit work is completed after the delete,&lt;/P&gt;&lt;P&gt;As a result sometimes when the database performance is slow or the&lt;/P&gt;&lt;P&gt;record is locked by some other user,  is it is trying to insert records&lt;/P&gt;&lt;P&gt;into the table with the same primary keys even before the delete work&lt;/P&gt;&lt;P&gt;is committed to the database. The program is unable to insert records&lt;/P&gt;&lt;P&gt;into the table with the same primary keys and hence terminating it and&lt;/P&gt;&lt;P&gt;creating the Short Dump Message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The delete is committed to the database even after the program is&lt;/P&gt;&lt;P&gt;terminated with a Short Dump Message. This results in the old records&lt;/P&gt;&lt;P&gt;being deleted  without the new updated records being inserted into the&lt;/P&gt;&lt;P&gt;table Table1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest a solution this problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 05:15:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-insert-after-db-delete-in-a-single-program-on-the-same-table/m-p/1960863#M395024</guid>
      <dc:creator>raja_ksravankumarreddy</dc:creator>
      <dc:date>2007-02-23T05:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: DB insert after DB delete in a single program on the same table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-insert-after-db-delete-in-a-single-program-on-the-same-table/m-p/1960864#M395025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;        The solution will be like First LOCK ALL THE RECORDS you want to delete, then do a DATABASE COMMIT, then LOCK ALL THE RECORDS again (You can lock records that does not exist) then INSERT THE RECORDS and do a DATABASE COMMIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case delete is happening since there is an implicit database commit when ever a program ends.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 05:29:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-insert-after-db-delete-in-a-single-program-on-the-same-table/m-p/1960864#M395025</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-02-23T05:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: DB insert after DB delete in a single program on the same table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-insert-after-db-delete-in-a-single-program-on-the-same-table/m-p/1960865#M395026</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 need to create a ENQUEUE Function module for this one, nad before doing the Deletion Lock the table/entries using the above function module and do the deletion and insert the records then write the fucntion moduel DEQUEUE to release the lock&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;secondly, before inserting the records, why don't you check whehter the record is already there in the table with the same primary keu, if the record is existed with the same primay key then do not insert that record.&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>Fri, 23 Feb 2007 05:35:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-insert-after-db-delete-in-a-single-program-on-the-same-table/m-p/1960865#M395026</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T05:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: DB insert after DB delete in a single program on the same table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-insert-after-db-delete-in-a-single-program-on-the-same-table/m-p/1960866#M395027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of using COMMIT WORK after your delete, use; COMMIT WORK AND WAIT. This will allow the commit to complete before the next process starts (your insert).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MattG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 11:25:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-insert-after-db-delete-in-a-single-program-on-the-same-table/m-p/1960866#M395027</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T11:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: DB insert after DB delete in a single program on the same table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/db-insert-after-db-delete-in-a-single-program-on-the-same-table/m-p/1960867#M395028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't do the commit after the delete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Feb 2007 14:14:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/db-insert-after-db-delete-in-a-single-program-on-the-same-table/m-p/1960867#M395028</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-23T14:14:12Z</dc:date>
    </item>
  </channel>
</rss>

