<?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: The ABAP/4 Open SQL array insert results in duplicate database records. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/the-abap-4-open-sql-array-insert-results-in-duplicate-database-records/m-p/7167436#M1516741</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;you might check SAP Note [957989|https://service.sap.com/sap/support/notes/957989] "OCWB+CE: Dump SAPSQL_ARRAY_INSERT_DUPREC".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;  Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Sep 2010 10:42:38 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-09-01T10:42:38Z</dc:date>
    <item>
      <title>The ABAP/4 Open SQL array insert results in duplicate database records.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/the-abap-4-open-sql-array-insert-results-in-duplicate-database-records/m-p/7167435#M1516740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SAP Guru's &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can u please help me out  with the solution &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Short text&lt;/P&gt;&lt;P&gt;    The ABAP/4 Open SQL array insert results in duplicate database records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error analysis&lt;/P&gt;&lt;P&gt;    An exception occurred that is explained in detail below.&lt;/P&gt;&lt;P&gt;    The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught&lt;/P&gt;&lt;P&gt;     in&lt;/P&gt;&lt;P&gt;    procedure "HRPY_GROUPING_CHANGE_PAYROLL" "(FUNCTION)", nor was it propagated by&lt;/P&gt;&lt;P&gt;     a RAISING clause.&lt;/P&gt;&lt;P&gt;    Since the caller of the procedure could not have anticipated that the&lt;/P&gt;&lt;P&gt;    exception would occur, the current program is terminated.&lt;/P&gt;&lt;P&gt;    The reason for the exception is:&lt;/P&gt;&lt;P&gt;    If you use an ABAP/4 Open SQL array insert to insert a record in&lt;/P&gt;&lt;P&gt;    the database and that record already exists with the same key,&lt;/P&gt;&lt;P&gt;    this results in a termination.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    (With an ABAP/4 Open SQL single record insert in the same error&lt;/P&gt;&lt;P&gt;    situation, processing does not terminate, but SY-SUBRC is set to 4.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Missing RAISING Clause in Interface&lt;/P&gt;&lt;P&gt;    Program                                 SAPLHRPAY99_RGDIR_WPBP&lt;/P&gt;&lt;P&gt;    Include                                 LHRPAY99_RGDIR_WPBPU07&lt;/P&gt;&lt;P&gt;    Row                                     1&lt;/P&gt;&lt;P&gt;    Module type                             (FUNCTION)&lt;/P&gt;&lt;P&gt;    Module Name                             HRPY_GROUPING_CHANGE_PAYROLL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trigger Location of Exception&lt;/P&gt;&lt;P&gt;    Program                                 SAPLHRPAY99_RGDIR_WPBP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 33 * the solution is:&lt;/P&gt;&lt;P&gt; 34 * for an existing SEQNR delete everything in HRPY_GROUPING and then&lt;/P&gt;&lt;P&gt; 35 * insert the new lines.&lt;/P&gt;&lt;P&gt; 36&lt;/P&gt;&lt;P&gt; 37     LOOP AT grouping where pernr = employeenumber.&lt;/P&gt;&lt;P&gt; 38       read table before_image_rgdir with key seqnr = grouping-seqnr.&lt;/P&gt;&lt;P&gt; 39       IF sy-subrc NE 0. "no entry for this seqnr --&amp;gt; new result&lt;/P&gt;&lt;P&gt; 40         move-corresponding grouping to insert_grouping.&lt;/P&gt;&lt;P&gt; 41         append insert_grouping.&lt;/P&gt;&lt;P&gt; 42       else. "seqnr already exists&lt;/P&gt;&lt;P&gt; 43         if grouping-seqnr ne delete_rgdir-seqnr. "each seqnr only once&lt;/P&gt;&lt;P&gt; 44           delete_rgdir-pernr = employeenumber.&lt;/P&gt;&lt;P&gt; 45           delete_rgdir-seqnr = grouping-seqnr.&lt;/P&gt;&lt;P&gt; 46           append delete_rgdir.&lt;/P&gt;&lt;P&gt; 47         endif.&lt;/P&gt;&lt;P&gt; 48         move-corresponding grouping to insert_grouping.&lt;/P&gt;&lt;P&gt; 49         append insert_grouping.&lt;/P&gt;&lt;P&gt; 50       endif.&lt;/P&gt;&lt;P&gt; 51     ENDLOOP.&lt;/P&gt;&lt;P&gt; 52   ENDIF.&lt;/P&gt;&lt;P&gt; 53&lt;/P&gt;&lt;P&gt; 54 * real delete and insert************************************************&lt;/P&gt;&lt;P&gt; 55   if test = space.&lt;/P&gt;&lt;P&gt; 56&lt;/P&gt;&lt;P&gt; 57     loop at delete_rgdir.&lt;/P&gt;&lt;P&gt; 58       delete from hrpy_grouping where pernr = delete_rgdir-pernr and&lt;/P&gt;&lt;P&gt; 59                                       seqnr = delete_rgdir-seqnr.&lt;/P&gt;&lt;P&gt; 60     endloop.&lt;/P&gt;&lt;P&gt; 61&lt;/P&gt;&lt;P&gt; 62     if not insert_grouping[] is initial.&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;       insert hrpy_grouping from table insert_grouping.&lt;/P&gt;&lt;P&gt; 64     endif.&lt;/P&gt;&lt;P&gt; 65   endif.&lt;/P&gt;&lt;P&gt; 66 ENDFUNCTION.&lt;/P&gt;&lt;P&gt;    Include                                 LHRPAY99_RGDIR_WPBPU07&lt;/P&gt;&lt;P&gt;    Row                                     63&lt;/P&gt;&lt;P&gt;    Module type                             (FUNCTION)&lt;/P&gt;&lt;P&gt;    Module Name                             HRPY_GROUPING_CHANGE_PAYROLL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Sep 2010 10:32:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/the-abap-4-open-sql-array-insert-results-in-duplicate-database-records/m-p/7167435#M1516740</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-01T10:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: The ABAP/4 Open SQL array insert results in duplicate database records.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/the-abap-4-open-sql-array-insert-results-in-duplicate-database-records/m-p/7167436#M1516741</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;you might check SAP Note [957989|https://service.sap.com/sap/support/notes/957989] "OCWB+CE: Dump SAPSQL_ARRAY_INSERT_DUPREC".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;  Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Sep 2010 10:42:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/the-abap-4-open-sql-array-insert-results-in-duplicate-database-records/m-p/7167436#M1516741</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-01T10:42:38Z</dc:date>
    </item>
  </channel>
</rss>

