<?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: Update database table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556179#M1268124</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what you can do is when you Read the data from the database table. catch the table index (sy-tabix) to some variable and then use that index to update the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* your select
lv_tabix = sy-tabix.
update zsd_table from wa_ztable index lv_tabix.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lalit Mohan Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 May 2009 16:27:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-06T16:27:02Z</dc:date>
    <item>
      <title>Update database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556177#M1268122</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 have a table with 10 fields. 8 of them are key fields. In program when I am trying to update the table it fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: wa_ztable type zsd_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      update zsd_table from wa_ztable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the issue is I am not setting all the 8 fields each time. some of the 8 key fields will be blank some time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What exactly is the issue with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 15:55:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556177#M1268122</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T15:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556178#M1268123</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;&lt;/P&gt;&lt;P&gt;While updating the database key fields should not be blank. you must pass the key fields.&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;S&amp;gt;Chaitanya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 16:21:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556178#M1268123</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T16:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556179#M1268124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what you can do is when you Read the data from the database table. catch the table index (sy-tabix) to some variable and then use that index to update the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* your select
lv_tabix = sy-tabix.
update zsd_table from wa_ztable index lv_tabix.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lalit Mohan Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 16:27:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556179#M1268124</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T16:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556180#M1268125</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; Updating multiple entries&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Examle updating the field zchecked to 'X'&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
UPDATE zcostcheck set zchecked = 'X'      
  WHERE zcostcheck-zaar     = zaar and      
                 zcostcheck-zmaaned  = zmaaned and  
                 zcostcheck-zbukrs   = zbukrs and   
                 zcostcheck-zsaknr   = zsaknr2 and  
                 zcostcheck-zgsber   = zgsber.    
if sy-subrc  = 0.
   commit work.
else.
  roll back.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or try to use modify statement..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read records from the database table where name is space, into an internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;select * from personal into table itab&lt;/P&gt;&lt;P&gt;     where name = space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Update name in the internal table to Unknown&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;loop at itab. &lt;/P&gt;&lt;P&gt;  itab-name = 'Unknown'  &lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Modify records in the database table. Only records with the same key values as then&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;internal table is modified&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;MODIFY personel from table itab.&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;prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 16:37:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556180#M1268125</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T16:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556181#M1268126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gopi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can not change the contents of the key fields. If some of them were blank when inserted, they should remain blank. Only non-key field values can be changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe this is not a restriction placed by the underlying database system, but by ABAP Open SQL engine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had a similar requirement in one of my programs. The way I implemented it is to delete the existing record and insert the new record. You have to make sure that there will &lt;STRONG&gt;not&lt;/STRONG&gt; be any referential integrity issues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2009 19:54:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556181#M1268126</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T19:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556182#M1268127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hi ,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; I have a table with 10 fields. 8 of them are key fields. In program when I am trying to update the table it fails.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; data: wa_ztable type zsd_table.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt;       update zsd_table from wa_ztable.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; the issue is I am not setting all the 8 fields each time. some of the 8 key fields will be blank some time. &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; What exactly is the issue with this.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Thanks,&lt;/P&gt;&lt;P&gt;&amp;gt; Gopi&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You already know the issue, you have to set all the key fields, i.e if you want to change only one line in the db , otherwise use a where clause if it has to update multiple records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[See here|http://help.sap.com/erp2005_ehp_04/helpdata/EN/43/41341147041806e10000000a1553f6/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>Wed, 06 May 2009 20:17:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table/m-p/5556182#M1268127</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-06T20:17:51Z</dc:date>
    </item>
  </channel>
</rss>

