<?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: INSERT or MoDIFY statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885788#M933545</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You cann't insert two records with all the key fields same values. atleast one key field value should be different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 May 2008 11:22:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-29T11:22:21Z</dc:date>
    <item>
      <title>INSERT or MoDIFY statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885787#M933544</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 to insert a data for my ztable,for 1st time it is updating the data,but for the second time (since all the key fields are same as 1st record),it is going to modify the data in my table.(since i have used modify statement),But i want both the records.&lt;/P&gt;&lt;P&gt;any idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 11:18:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885787#M933544</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-29T11:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT or MoDIFY statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885788#M933545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You cann't insert two records with all the key fields same values. atleast one key field value should be different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 11:22:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885788#M933545</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-29T11:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT or MoDIFY statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885789#M933546</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;insert     =&amp;gt; New record is set&lt;/P&gt;&lt;P&gt;update   =&amp;gt; Exits record is changed&lt;/P&gt;&lt;P&gt;modify   =&amp;gt; If record exitst, it´s updated. If not, new one is created&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;New records are allowed, if you don``t set key-fields or the key-fields are not the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Nicole&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Nicole Lorenz on May 29, 2008 7:23 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 11:23:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885789#M933546</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-29T11:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT or MoDIFY statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885790#M933547</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; For the next time also you need to use INSERT statement, but you have to add extension INSERT &amp;lt;dbtable&amp;gt; FROM wa ACCEPTING DUPLICATE KEYS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Bujji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 11:23:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885790#M933547</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-29T11:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT or MoDIFY statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885791#M933548</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;  If you want to insert the record to Z table, use the INSERT command. Anyway it is not possible to insert second entry with same key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MODIFY statement will insert the record in table if it is not existing in table. If the record exists in table then it will modify the existing record in table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 11:26:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885791#M933548</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-29T11:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT or MoDIFY statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885792#M933549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priya,&lt;/P&gt;&lt;P&gt;U can't insert 2 records with same primary key. But i have small clue for u.&lt;/P&gt;&lt;P&gt;Add one more primary key field to ur Ztable i. e counter. First get the record from Ztable with all primary keys u r trying to insert(For second or subsequent time) Then Get the counter value for that row. Now add 1 to counter and INSERT that record. &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;u can do this if ur table is not there in production already(New&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;one)&lt;/STRONG&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 11:28:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885792#M933549</guid>
      <dc:creator>vinod_vemuru2</dc:creator>
      <dc:date>2008-05-29T11:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: INSERT or MoDIFY statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885793#M933550</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;MODIFY - Will update the table, if the data already exists, if NOT inserts new rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE - Will update the table, errors out if the data is not found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case of MODIFY the sy-subrc is always 0 so you would't know whether the data is actually updated or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT - Inserting Data in Database Tables&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;Update Modify Insert stmts we use when we want to do some change / Insertion&lt;/P&gt;&lt;P&gt;(1) to database table from internal table or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(2) from work area to internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;( AA ) Update&lt;/P&gt;&lt;P&gt;If the intended record in the internal table is found in databse table means it will just update that record.&lt;/P&gt;&lt;P&gt;syntax to update database table from itab:::::&lt;/P&gt;&lt;P&gt;UPDATE dbtab FROM TABLE itab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changes to lines made with the UPDATE command only becomefinal after a database commit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without using internal table we can update database table directly as shown below:::::::::::::::::::::&lt;/P&gt;&lt;P&gt;TABLES SFLIGHT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE SFLIGHT SET SEATSOCC = SEATSOCC + 3&lt;/P&gt;&lt;P&gt;WHERE CARRID = 'LH' AND&lt;/P&gt;&lt;P&gt;CONNID = '0400' AND&lt;/P&gt;&lt;P&gt;FLDATE = '19950228'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;( BB ) Modify is used to insert new record if the record doesnt exist in datbase table.system check this on primary key basis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the intended record in the internal table is found in databse table means it will just update that record.So here its equal to UPDATE stmt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For changes to database table we use syntax as below ::::&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY DatabaseTable FROM TABLE itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For changes to Internal table we use syntax as below ::::&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY itab FROM wa INDEX idx.&lt;/P&gt;&lt;P&gt;&lt;A href="http://TRANSPORTING" target="test_blank"&gt;http://TRANSPORTING&lt;/A&gt; f1 ... fn WHERE cond.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;( CC ) Insert stmt is used to insert New records into databse table from internal table or to internal table from work area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By default, data is only inserted in the current client. However, ifyou use the CLIENT SPECIFIED addition, you can switch off theautomatic client handling.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You cannot insert a table line if the table alreadycontains a record with the same primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax::::::::::&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT INTO dbtab CLIENT SPECIFIED VALUES wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT (dbtabname) CLIENT SPECIFIED FROM TABLE itab.&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;Adding customer "Robinson" to client 002:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES SCUSTOM.&lt;/P&gt;&lt;P&gt;SCUSTOM-MANDT = '002'.&lt;/P&gt;&lt;P&gt;SCUSTOM-ID = '12400177'.&lt;/P&gt;&lt;P&gt;SCUSTOM-NAME = 'Robinson'.&lt;/P&gt;&lt;P&gt;SCUSTOM-POSTCODE = '69542'.&lt;/P&gt;&lt;P&gt;SCUSTOM-CITY = 'Heidelberg'.&lt;/P&gt;&lt;P&gt;SCUSTOM-CUSTTYPE = 'P'.&lt;/P&gt;&lt;P&gt;SCUSTOM-DISCOUNT = '003'.&lt;/P&gt;&lt;P&gt;SCUSTOM-TELEPHONE = '01234/56789'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT INTO SCUSTOM CLIENT SPECIFIED VALUES SCUSTOM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="4609771"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="4675463"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/message/4622903#4622903 &lt;B&gt;[original link is broken]&lt;/B&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;Vipul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2008 12:22:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-or-modify-statement/m-p/3885793#M933550</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-30T12:22:27Z</dc:date>
    </item>
  </channel>
</rss>

