<?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 Update database table from a work area in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537044#M244985</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 workarea that is like the corresponding database table. There are a lot of fields so I dont want to update each field with an UPDATE but instead I want to do som sort of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE dbase_table &lt;/P&gt;&lt;P&gt;FROM work_area &lt;/P&gt;&lt;P&gt;WHERE dbase_table-primary_key = work_area-primary_key&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could only find a statement called UPDATE dbase_table FROM  work_area but I dont understand how without specifying a WHERE clause it knows which rows to update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Baran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Sep 2006 09:19:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-07T09:19:58Z</dc:date>
    <item>
      <title>Update database table from a work area</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537044#M244985</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 workarea that is like the corresponding database table. There are a lot of fields so I dont want to update each field with an UPDATE but instead I want to do som sort of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE dbase_table &lt;/P&gt;&lt;P&gt;FROM work_area &lt;/P&gt;&lt;P&gt;WHERE dbase_table-primary_key = work_area-primary_key&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could only find a statement called UPDATE dbase_table FROM  work_area but I dont understand how without specifying a WHERE clause it knows which rows to update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Baran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2006 09:19:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537044#M244985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-07T09:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table from a work area</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537045#M244986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u can even use a modify statement to update a table from a work area&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2006 09:21:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537045#M244986</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2006-09-07T09:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table from a work area</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537046#M244987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use the fllowing..&lt;/P&gt;&lt;P&gt;UPDATE dbase_table &lt;/P&gt;&lt;P&gt;FROM work_area &lt;/P&gt;&lt;P&gt;SET dbase_table-primary_key = work_area-primary_key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2006 09:23:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537046#M244987</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2006-09-07T09:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table from a work area</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537047#M244988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;UPDATE  dbtab      FROM wa. or &lt;/P&gt;&lt;P&gt;UPDATE (dbtabname) FROM wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Extras: &lt;/P&gt;&lt;P&gt;1. ... CLIENT SPECIFIED &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. ... CONNECTION con &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Changes one single line in a database table, using a primary key to identify the line and taking the values to be changed from the specified work area, wa. The data is read out of wa from left to right, matching the line structure of the database table dbtab. The structure of wa remains unchanged. This means that wa must be at least as wide (see DATA) as the line structure of dbtab, and have the same alignment. Otherwise, a runtime error occurs. &lt;/P&gt;&lt;P&gt;If either the database table, dbtab, or the work area, wa, contain Strings, wa must be compatible with the line structure of dbtab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;Changing the telephone number of the customer with customer number '12400177' in the current client: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA   wa TYPE scustom. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM scustom INTO wa &lt;/P&gt;&lt;P&gt;  WHERE id = '12400177'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa-telephone = '06201/44889'. &lt;/P&gt;&lt;P&gt;UPDATE scustom FROM wa. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the command has been executed, the system field SY-DBCNT contains the number of updated lines (0 or 1). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Examples &lt;/P&gt;&lt;P&gt;Update discount for the customer with the customer number '00017777' to 3 percent (in the current client): &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: wa TYPE scustom. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM scustom INTO wa &lt;/P&gt;&lt;P&gt;  WHERE id = '00017777'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa-discount = '003'. &lt;/P&gt;&lt;P&gt;UPDATE scustom FROM wa. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Return Code is set as follows: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SY-SUBRC = 0: &lt;/P&gt;&lt;P&gt;The specified line has been updated. &lt;/P&gt;&lt;P&gt;SY-SUBRC = 4: &lt;/P&gt;&lt;P&gt;The system could not update any line in the table, since there is no line with the specified primary key. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&amp;lt; JAcek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2006 09:23:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537047#M244988</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-07T09:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table from a work area</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537048#M244989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;UPDATE  dbtab      FROM wa. will do it for you.&lt;/P&gt;&lt;P&gt;The structure of wa and dbtab must be the same.&lt;/P&gt;&lt;P&gt;it will update the record which matches the key in the work area. No need to specify the where condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or you can also use:&lt;/P&gt;&lt;P&gt;MODIFY  dbtab      FROM wa. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg:&lt;/P&gt;&lt;P&gt;DATA: wa TYPE scustom. &lt;/P&gt;&lt;P&gt;wa-id        = '12400177'. &lt;/P&gt;&lt;P&gt;wa-name      = 'Robinson'. &lt;/P&gt;&lt;P&gt;wa-postcode  = '69542'. &lt;/P&gt;&lt;P&gt;wa-city      = 'Heidelberg'. &lt;/P&gt;&lt;P&gt;wa-custtype  = 'P'. &lt;/P&gt;&lt;P&gt;wa-discount  = '003'. &lt;/P&gt;&lt;P&gt;wa-telephone = '06201/44889'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY scustom FROM wa. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this statement, unlike update, inserts a row, if no match id found for the key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2006 09:25:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537048#M244989</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-07T09:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table from a work area</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537049#M244990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Baran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use this statement.&lt;/P&gt;&lt;P&gt;MODIFY dbtable FROM work_area.&lt;/P&gt;&lt;P&gt;where it will change the non primary keys with the primary key combination.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Anu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2006 09:26:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537049#M244990</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-07T09:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table from a work area</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537050#M244991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi baran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. In such cases,&lt;/P&gt;&lt;P&gt;   we can use MODIFY statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. MODIFY will AUTOMATICALLY &lt;/P&gt;&lt;P&gt;   take care of insert/update&lt;/P&gt;&lt;P&gt;   based upon the primary key field combination,&lt;/P&gt;&lt;P&gt;   found /  not found&lt;/P&gt;&lt;P&gt;   in the database table,&lt;/P&gt;&lt;P&gt;   w.r.t to values in the work area.&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;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2006 09:28:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537050#M244991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-07T09:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table from a work area</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537051#M244992</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;UPDATE VBAK SET ERDAT = SY-DATUM WHERE KUNNR = 'zzzzzzz'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2006 09:33:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537051#M244992</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-07T09:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Update database table from a work area</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537052#M244993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Baran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY statement will be used to update the required fields with out updating entire record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;MODIFY itab FROM wa WHERE primary_key = wa-primary_key TRANSPORTING field1 field2.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The above statement will be used to update the field1, field2 values in ITAB entry WHERE wa-primary_key is same as ITAB primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank YOu.&lt;/P&gt;&lt;P&gt;Shyam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2012 23:02:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-database-table-from-a-work-area/m-p/1537052#M244993</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-06-19T23:02:53Z</dc:date>
    </item>
  </channel>
</rss>

