<?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: Inserting duplicates into table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405889#M1736372</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Egemen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this.&lt;/P&gt;&lt;P&gt;Modify ztevdc&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt; from table iteven.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;commit work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;Hope it helps you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;Thanks &amp;amp; Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;Vignesh Yeram&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Mar 2013 16:15:45 GMT</pubDate>
    <dc:creator>vigneshyeram</dc:creator>
    <dc:date>2013-03-27T16:15:45Z</dc:date>
    <item>
      <title>Inserting duplicates into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405888#M1736371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to ABAP and need help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below line of code inserts data from internal table ITEVEN into data dictionary table ZTEVDC.&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;INSERT ZTEVDC FROM TABLE ITEVEN.&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;However, sometimes there can be data in ITEVEN, that already exist in ZTEVDC with same primary key.&lt;/P&gt;&lt;P&gt;I want the code to save records from ITEVEN into ZTEVDC, however, if record already exist in ZTEVDC(With primary key PDSNR) then it should modify the existing record and not create a duplicate(Which crashes the program). If record does not exist in ZTEVDC, then a new record will be created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently the system crashes if a record with same primary key(PDSNR) already exist in ZTEVDC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Turan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 10:31:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405888#M1736371</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-03-27T10:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting duplicates into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405889#M1736372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Egemen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this.&lt;/P&gt;&lt;P&gt;Modify ztevdc&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt; from table iteven.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;commit work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;Hope it helps you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;Thanks &amp;amp; Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;Vignesh Yeram&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 16:15:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405889#M1736372</guid>
      <dc:creator>vigneshyeram</dc:creator>
      <dc:date>2013-03-27T16:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting duplicates into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405890#M1736373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Egemen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use MODIFY statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your information.&lt;/P&gt;&lt;P&gt;Modify statement inserts a new records if there is no record exist with the same key combination fields and updates the table if record already exists in database table.&lt;/P&gt;&lt;P&gt;While INSERT statement only inserts a new record and gives short dump in case of duplicate entry.&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 Kumar Singh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 16:42:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405890#M1736373</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-03-27T16:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting duplicates into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405891#M1736374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;in this case you can use MODIFY statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial monospaced for SAP; color: #0000ff;"&gt;* Updates database table Ztable with the contents of wa_itab&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;MODIFY Ztable FROM wa_itab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;other example&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial monospaced for SAP; color: #0000ff;"&gt;* Updates database table Ztable with the contents of it_itab&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;MODIFY Ztable FROM TABLE it_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ivan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 16:51:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405891#M1736374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-03-27T16:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting duplicates into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405892#M1736375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Egemen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like stated above the modify statement will work. I just want to also point out if you do want to use insert but avoid duplicate entries, this will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;insert ztevdc from table iteven accepting duplicate keys.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "your error message&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will prevent the run-time error occurring and set sy-subrc to 4 while disregarding the data you tried to insert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Justin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 20:13:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405892#M1736375</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-03-27T20:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting duplicates into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405893#M1736376</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;Instead of INSERT statement, use MODIFY statement which is the best option to proceed with in your scenario.&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, 28 Mar 2013 06:18:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405893#M1736376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-03-28T06:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting duplicates into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405894#M1736377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Modify statement is the solution for your question...................&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2013 07:33:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405894#M1736377</guid>
      <dc:creator>uppu_narayan</dc:creator>
      <dc:date>2013-03-28T07:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting duplicates into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405895#M1736378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2013 10:08:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405895#M1736378</guid>
      <dc:creator>jyotirmaya_mallick</dc:creator>
      <dc:date>2013-03-28T10:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting duplicates into table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405896#M1736379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Egemen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case use MODIFY instead of INSERT.&lt;/P&gt;&lt;P&gt;basic difference between INSERT, UPDATE &amp;amp; MODIFY --&lt;/P&gt;&lt;P&gt;INSERT: when new record has to inserted into table.&lt;/P&gt;&lt;P&gt;UPDATE: When record in present in table &amp;amp; need to be change.&lt;/P&gt;&lt;P&gt;MODIFY: this combination of both Insert &amp;amp; Update, means if record is not present it will add the record into table otherwise it will update the existing record without inserting again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more information check these link.&lt;/P&gt;&lt;P&gt;&lt;A href="https://scn.sap.com/message/3412075"&gt;Link1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sapabaptutorial.blogspot.in/2009/11/difference-between-insert-update-and.html"&gt;Link2 &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jyoti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2013 15:31:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-duplicates-into-table/m-p/9405896#M1736379</guid>
      <dc:creator>jyotirmaya_mallick</dc:creator>
      <dc:date>2013-03-28T15:31:39Z</dc:date>
    </item>
  </channel>
</rss>

