<?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 Error .....SAPSQL_ARRAY_INSERT_DUPREC in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-sapsql-array-insert-duprec/m-p/6937735#M1486802</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In our developement system,I am facing an error &lt;STRONG&gt;SAPSQL_ARRAY_INSERT_DUPREC&lt;/STRONG&gt; in one of the Z program , which when ran in backgrond in goes to dump (job gets canceled) &amp;amp; the dump states the above error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my program I am just uploading the data to a custom table, the dump points towards the INSERT statement in the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Later, assuming that there might be duplicate entries getting populated, I used  &lt;STRONG&gt;DELETE ADJACENT DUPLICATES FROM it_toolkit COMPARING ALL FIELDS&lt;/STRONG&gt; statement to avoid duplicate entries &amp;amp; then used &lt;STRONG&gt;INSERT&lt;/STRONG&gt; statement as below. It worked. But later again after two days the same error occured.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The surprising thing is that, the job gets canelled but at the same time custom table gets updated also. The code as follows :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF p_sys_id = c_ck04 OR
   p_sys_id = c_ck02.

  IF c_cntl_complt = c_2 AND ztsifcntl-btchstatus = c_a.

    SORT it_toolkit BY sl_no.

    DELETE ADJACENT DUPLICATES
    FROM it_toolkit
    COMPARING ALL FIELDS.

    INSERT zmm_toolkit FROM TABLE it_toolkit.

    COMMIT WORK.

  ENDIF.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anybody shed light on this ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Abhii&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Abhii on May 3, 2010 12:06 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 May 2010 10:05:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-05-03T10:05:35Z</dc:date>
    <item>
      <title>Error .....SAPSQL_ARRAY_INSERT_DUPREC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-sapsql-array-insert-duprec/m-p/6937735#M1486802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In our developement system,I am facing an error &lt;STRONG&gt;SAPSQL_ARRAY_INSERT_DUPREC&lt;/STRONG&gt; in one of the Z program , which when ran in backgrond in goes to dump (job gets canceled) &amp;amp; the dump states the above error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my program I am just uploading the data to a custom table, the dump points towards the INSERT statement in the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Later, assuming that there might be duplicate entries getting populated, I used  &lt;STRONG&gt;DELETE ADJACENT DUPLICATES FROM it_toolkit COMPARING ALL FIELDS&lt;/STRONG&gt; statement to avoid duplicate entries &amp;amp; then used &lt;STRONG&gt;INSERT&lt;/STRONG&gt; statement as below. It worked. But later again after two days the same error occured.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The surprising thing is that, the job gets canelled but at the same time custom table gets updated also. The code as follows :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF p_sys_id = c_ck04 OR
   p_sys_id = c_ck02.

  IF c_cntl_complt = c_2 AND ztsifcntl-btchstatus = c_a.

    SORT it_toolkit BY sl_no.

    DELETE ADJACENT DUPLICATES
    FROM it_toolkit
    COMPARING ALL FIELDS.

    INSERT zmm_toolkit FROM TABLE it_toolkit.

    COMMIT WORK.

  ENDIF.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anybody shed light on this ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Abhii&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Abhii on May 3, 2010 12:06 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 May 2010 10:05:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-sapsql-array-insert-duprec/m-p/6937735#M1486802</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-03T10:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: Error .....SAPSQL_ARRAY_INSERT_DUPREC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-sapsql-array-insert-duprec/m-p/6937736#M1486803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Problem is related to the insertion of duplicate records.  Use MODIFY statement instead of INSERT statement in your code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;INSERT zmm_toolkit FROM TABLE it_toolkit.  "Change to MODIFY&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 May 2010 10:11:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-sapsql-array-insert-duprec/m-p/6937736#M1486803</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-03T10:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error .....SAPSQL_ARRAY_INSERT_DUPREC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-sapsql-array-insert-duprec/m-p/6937737#M1486804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort it_toolkit by the key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; DELETE ADJACENT DUPLICATES&lt;/P&gt;&lt;P&gt;    FROM it_toolkit&lt;/P&gt;&lt;P&gt;    COMPARING ALL FIELDS. "Instead of all fields specify the key fields of the table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;modify zmm_toolkit FROM TABLE it_toolkit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Keshav.T on May 3, 2010 3:42 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 May 2010 10:12:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-sapsql-array-insert-duprec/m-p/6937737#M1486804</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-05-03T10:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Error .....SAPSQL_ARRAY_INSERT_DUPREC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-sapsql-array-insert-duprec/m-p/6937738#M1486805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abhii,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the primary keys of The Ztable once.SORT as per these keys.&lt;/P&gt;&lt;P&gt;In the SORT statement you have sorted only by sl_no.&lt;/P&gt;&lt;P&gt;Not sure whether this field is the only primary key or not.Please check once.&lt;/P&gt;&lt;P&gt; While using DELETE ADJACENT DUPLICATES use primary key fields for deletion(Not all fields.)&lt;/P&gt;&lt;P&gt;I feel its better to use MODIFY statement which updates the table if the record doesnot exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lakshman.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 May 2010 10:12:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-sapsql-array-insert-duprec/m-p/6937738#M1486805</guid>
      <dc:creator>former_member209217</dc:creator>
      <dc:date>2010-05-03T10:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Error .....SAPSQL_ARRAY_INSERT_DUPREC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-sapsql-array-insert-duprec/m-p/6937739#M1486806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your internal table may be contains a set of primary key values , which are already present in the table. Now, in database there can't be two rows with same primary key values. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Delete adjacent duplicates will not help as it will only delete duplicate entries from your internal table. But it won't check whether any internal table entry is already there in database with same primary key values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can check the table, whether any entries exist with the same value of primary keys before the insert, otherwise you can use MODIFY/UPDATE statements.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 May 2010 10:13:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-sapsql-array-insert-duprec/m-p/6937739#M1486806</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-03T10:13:02Z</dc:date>
    </item>
  </channel>
</rss>

