<?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: Overwrite database record - Table has only 1 field and record in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902921#M1144929</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it necessary to lock the table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Dec 2008 00:16:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-12-16T00:16:59Z</dc:date>
    <item>
      <title>Overwrite database record - Table has only 1 field and record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902916#M1144924</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;How do you overwrite a record in a database table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The database table that we have only has one field and this field is used to count the print number of a specific label. This table will only have 1 record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The field is also used as part of an id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So during each program run, I will select the current number in the field, add to it in my program, then will need to overwrite the current value in the database table with the new value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest if something different should be done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2008 22:57:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902916#M1144924</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-15T22:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite database record - Table has only 1 field and record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902917#M1144925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can Insert a new record with new ID into the table .&lt;/P&gt;&lt;P&gt;Then you can go ahead and delete the record with old ID .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will have to use these two steps as you would not be able to modify the key fields&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2008 23:19:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902917#M1144925</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-15T23:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite database record - Table has only 1 field and record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902918#M1144926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Since the table only has one field, this would be the primary key of the table. And you cannot overwrite data in the primary key. Hence you will have to delete the existing record first and then add a new record with the incremented value.&lt;/P&gt;&lt;P&gt;Make sure you lock the table before doing these operations and then unlock it once done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2008 23:29:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902918#M1144926</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-15T23:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite database record - Table has only 1 field and record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902919#M1144927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do you lock/unlock from a program?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2008 23:50:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902919#M1144927</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-15T23:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite database record - Table has only 1 field and record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902920#M1144928</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 will have to create a lock object for your database table. This creates 2 function modules starting with ENQUEUE_(name of the lock object) to lock a database table/record and DEQUEUE_(name of the lock object) to unlock the database table/record.&lt;/P&gt;&lt;P&gt;Refer to the documentation on lock objects [here|http://help.sap.com/saphelp_nw04/helpdata/en/a2/3547360f2ea61fe10000009b38f839/frameset.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Dec 2008 00:10:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902920#M1144928</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-16T00:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite database record - Table has only 1 field and record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902921#M1144929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it necessary to lock the table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Dec 2008 00:16:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902921#M1144929</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-16T00:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite database record - Table has only 1 field and record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902922#M1144930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, If you want that the data should not be overwritten by other program ,or imagine if same program runs twice and both update the data at the sametime, you will have inconsistent data. So to avoid that , it is a good practice to lock the table before updates and unlock it after updates.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Dec 2008 00:24:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902922#M1144930</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-16T00:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite database record - Table has only 1 field and record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902923#M1144931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You. I'll add a lock object then.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pretty much every label will delete the record from the table using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    DELETE FROM &amp;lt;DB TABLE&amp;gt; CLIENT SPECIFIED WHERE MANDT = SY-MANDT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    UPDATE &amp;lt;DB TABLE&amp;gt; FROM &amp;lt;HEADER&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Dec 2008 00:27:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902923#M1144931</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-16T00:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite database record - Table has only 1 field and record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902924#M1144932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will need to do a delete and then insert instead of delete and update. Update wont work in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
"Lock DB table
DELETE FROM &amp;lt;DB TABLE&amp;gt; CLIENT SPECIFIED WHERE MANDT = SY-MANDT.

INSERT &amp;lt;DB TABLE&amp;gt; FROM &amp;lt;HEADER&amp;gt;.
"Unlock DB table.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Dec 2008 00:34:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/overwrite-database-record-table-has-only-1-field-and-record/m-p/4902924#M1144932</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-16T00:34:33Z</dc:date>
    </item>
  </channel>
</rss>

