<?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 is returning SY-SUBRC = 4. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519600#M1749243</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suhas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are trying to insert the record with the same key values, so you are getting sy-subrc value 4 and not able to insert the values into database table. Change the key values and try inserting to database it will insert successfully.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Jul 2013 05:03:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2013-07-08T05:03:44Z</dc:date>
    <item>
      <title>insert is returning SY-SUBRC = 4.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519595#M1749238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI experts,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I've created a Z table for which I'm trying to fill up the entries&amp;nbsp; by using a FM.&lt;BR /&gt;now the problem is that first record is inserted but later on&amp;nbsp; sy-subrc gives value 4 and no data is inserted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;syntax which I tried .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;INSERT &lt;/SPAN&gt;ZNWT_INV_ERRLIS1 &lt;SPAN class="L0S52"&gt;from &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;table &lt;/SPAN&gt;lt_inv_errlist ACCEPTING DUPLICATE KEYS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;insert &lt;/SPAN&gt;ZNWT_INV_ERRLIS1 &lt;SPAN class="L0S52"&gt;into &lt;/SPAN&gt;lwa_INV_ERRLIST values .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need you help &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1581/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Suhas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jul 2013 18:19:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519595#M1749238</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-06T18:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: insert is returning SY-SUBRC = 4.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519596#M1749239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suhas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subrc 4 is returned because you are inserting a record with the same key as the record inserted before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;syntax for db insertion is&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;INSERT &lt;SPAN class="L0S52"&gt;INTO db_tab&lt;/SPAN&gt; VALUES wa&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Jul 2013 08:21:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519596#M1749239</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-07T08:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: insert is returning SY-SUBRC = 4.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519597#M1749240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suhas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what SAP documentation says about your issue -&lt;/P&gt;&lt;P&gt;"&lt;EM&gt;&lt;SPAN style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 14px; background-color: #ffffff;"&gt; If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS. In this case, the lines that would otherwise cause runtime errors are discarded, and SY-SUBRC is set to 4.&lt;/SPAN&gt;"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source- &lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Jul 2013 09:39:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519597#M1749240</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-07T09:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: insert is returning SY-SUBRC = 4.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519598#M1749241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There may be two cases where you the insertion can be failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Case 1:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A record may already exists in the data base with the same key of the record that you are trying to insert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;To know which record insertion is the problem:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;SM13&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Give required inputs and Execute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will see your update error.&lt;/P&gt;&lt;P&gt;Double click on it and there you can see a red colored row.&lt;/P&gt;&lt;P&gt;Select it and Ctrl+Shft.+F6 to see the tables data which resulted in the update termination.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Case 2 :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The record which you are trying to insert may contain inconsistent data as keys.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 04:29:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519598#M1749241</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-08T04:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: insert is returning SY-SUBRC = 4.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519599#M1749242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi suhas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sy-subrc = 4 becoz of the primary key combinations.you cannot insert duplicates entries.&lt;/P&gt;&lt;P&gt;'ACCEPTING DUPLICATE KEYS' is used for avoiding the runtime error only.&lt;/P&gt;&lt;P&gt;using sy-dbcnt you can get the number of records inserted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Priya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 04:51:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519599#M1749242</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-08T04:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: insert is returning SY-SUBRC = 4.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519600#M1749243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suhas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are trying to insert the record with the same key values, so you are getting sy-subrc value 4 and not able to insert the values into database table. Change the key values and try inserting to database it will insert successfully.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 05:03:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519600#M1749243</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-08T05:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: insert is returning SY-SUBRC = 4.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519601#M1749244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the correct syntax to insert data into table is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: Courier New;"&gt;INSERT { {INTO &lt;A _jive_internal="true" href="https://answers.sap.com/thread/sapevent:&amp;amp;quot;ABAPINSERT_TARGET&amp;amp;quot;"&gt;target&lt;/A&gt; VALUES &lt;A _jive_internal="true" href="https://answers.sap.com/thread/sapevent:&amp;amp;quot;ABAPINSERT_SOURCE&amp;amp;quot;"&gt;source&lt;/A&gt; }&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A _jive_internal="true" href="https://answers.sap.com/thread/sapevent:&amp;amp;quot;ABAPINSERT_TARGET&amp;amp;quot;"&gt;target&lt;/A&gt; FROM&amp;nbsp;&amp;nbsp; &lt;A _jive_internal="true" href="https://answers.sap.com/thread/sapevent:&amp;amp;quot;ABAPINSERT_SOURCE&amp;amp;quot;"&gt;source&lt;/A&gt; } }.&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are trying to insert duplicate record with same value of primary key, which is not possible to insert as the database already has the same record. Change the primary key value and then try to insert.&lt;/P&gt;&lt;P&gt;hope it helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 05:28:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519601#M1749244</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-08T05:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: insert is returning SY-SUBRC = 4.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519602#M1749245</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;make sure to have cleared the internal table lt_inv_errlist bewtween to INSERTs with REFRESH (or CLEAR, if it has no header line).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can sort the internal table and remove&amp;nbsp; duplicates with DELETE ADJACENT DUPLICATES to avoid duplicates during one INSERT of several entries. Refer to the key fields of your Z-table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use MODIFY instead of INSERT, if you can't avoid duplicates because of data selection reasons.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Klaus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 05:40:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519602#M1749245</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-08T05:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: insert is returning SY-SUBRC = 4.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519603#M1749246</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;Through my previous post what i wanted to convey is that you cannot in any situation insert duplicate keys in Database table but using the ACCEPTING DUPLICATE KEYS clause you can prevent the short dump decently since processor sets sy-subrc to 4 if such syntax is used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 06:44:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-is-returning-sy-subrc-4/m-p/9519603#M1749246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-07-08T06:44:30Z</dc:date>
    </item>
  </channel>
</rss>

