<?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 ABAP/4 Open SQL array insert results in duplicate databaserecordsfor pk13 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-4-open-sql-array-insert-results-in-duplicate-databaserecordsfor-pk13/m-p/8373673#M1642175</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts, when I am working with pk13n tranaction iam getting an error message stating that update was terminated by user. when i am checking with st22 it gives the following message. please give the solution , iam sending the code as well.&lt;/P&gt;&lt;P&gt;&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 "SAVE_DATA" "(FORM)", nor was it propagated by 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.) please find the below code please give the solution for this error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 1 *eject&lt;/P&gt;&lt;P&gt; 2 *----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt; 3 *   Verbuchen der Daten                                           *&lt;/P&gt;&lt;P&gt; 4 *----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt; 5 FORM SAVE_DATA.&lt;/P&gt;&lt;P&gt; 6&lt;/P&gt;&lt;P&gt; 7   DATA: lf_menge LIKE ekpo-menge VALUE 0,                   "717464&lt;/P&gt;&lt;P&gt; 8         lf_netwr LIKE ekpo-netwr VALUE 0.&lt;/P&gt;&lt;P&gt; 9&lt;/P&gt;&lt;P&gt;10 * Einteilungen löschen --&amp;gt; Array Delete aus Tabelle DEKET&lt;/P&gt;&lt;P&gt;11   DESCRIBE TABLE DEKET LINES SY-TFILL.&lt;/P&gt;&lt;P&gt;12   IF SY-TFILL GT 0.&lt;/P&gt;&lt;P&gt;13     DELETE EKET FROM TABLE DEKET.&lt;/P&gt;&lt;P&gt;14     IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;15       MESSAGE A865.&lt;/P&gt;&lt;P&gt;16     ENDIF.&lt;/P&gt;&lt;P&gt;17     EKET_DELETE = EKET_DELETE + SY-DBCNT.&lt;/P&gt;&lt;P&gt;18     REFRESH: DEKET.&lt;/P&gt;&lt;P&gt;19     CLEAR  : DEKET.&lt;/P&gt;&lt;P&gt;20   ENDIF.&lt;/P&gt;&lt;P&gt;21&lt;/P&gt;&lt;P&gt;22 * Einteilungen hinzufügen --&amp;gt; Array Insert aus Tabelle IEKET&lt;/P&gt;&lt;P&gt;23   DESCRIBE TABLE IEKET LINES SY-TFILL.&lt;/P&gt;&lt;P&gt;24   IF SY-TFILL GT 0.&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;     INSERT EKET FROM TABLE IEKET.&lt;/P&gt;&lt;P&gt;26     IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;27       MESSAGE A864.&lt;/P&gt;&lt;P&gt;28     ENDIF.&lt;/P&gt;&lt;P&gt;29     EKET_INSERT = EKET_INSERT + SY-DBCNT.&lt;/P&gt;&lt;P&gt;30     REFRESH: IEKET.&lt;/P&gt;&lt;P&gt;31     CLEAR  : IEKET.&lt;/P&gt;&lt;P&gt;32   ENDIF.&lt;/P&gt;&lt;P&gt;33&lt;/P&gt;&lt;P&gt;34 * Check whether the qty in EKPO-MENGE is correct: note 717464&lt;/P&gt;&lt;P&gt;35   SELECT SUM( menge ) FROM eket INTO lf_menge&lt;/P&gt;&lt;P&gt;36                       WHERE ebeln = ekpo-ebeln&lt;/P&gt;&lt;P&gt;37                       AND   ebelp = ekpo-ebelp.&lt;/P&gt;&lt;P&gt;38   IF sy-subrc = 0 AND ekpo-menge &amp;lt;&amp;gt; lf_menge.&lt;/P&gt;&lt;P&gt;39     IF ekpo-ktmng &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;40       refe1 = ekpo-zwert * lf_menge / ekpo-ktmng.&lt;/P&gt;&lt;P&gt;41     ELSE.&lt;/P&gt;&lt;P&gt;42       refe1 = ekpo-zwert * lf_menge / 1000.&lt;/P&gt;&lt;P&gt;43     ENDIF.&lt;/P&gt;&lt;P&gt;44     IF refe1 &amp;gt; maxwert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Nov 2011 12:20:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-11-04T12:20:32Z</dc:date>
    <item>
      <title>ABAP/4 Open SQL array insert results in duplicate databaserecordsfor pk13</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-4-open-sql-array-insert-results-in-duplicate-databaserecordsfor-pk13/m-p/8373673#M1642175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts, when I am working with pk13n tranaction iam getting an error message stating that update was terminated by user. when i am checking with st22 it gives the following message. please give the solution , iam sending the code as well.&lt;/P&gt;&lt;P&gt;&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 "SAVE_DATA" "(FORM)", nor was it propagated by 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.) please find the below code please give the solution for this error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 1 *eject&lt;/P&gt;&lt;P&gt; 2 *----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt; 3 *   Verbuchen der Daten                                           *&lt;/P&gt;&lt;P&gt; 4 *----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt; 5 FORM SAVE_DATA.&lt;/P&gt;&lt;P&gt; 6&lt;/P&gt;&lt;P&gt; 7   DATA: lf_menge LIKE ekpo-menge VALUE 0,                   "717464&lt;/P&gt;&lt;P&gt; 8         lf_netwr LIKE ekpo-netwr VALUE 0.&lt;/P&gt;&lt;P&gt; 9&lt;/P&gt;&lt;P&gt;10 * Einteilungen löschen --&amp;gt; Array Delete aus Tabelle DEKET&lt;/P&gt;&lt;P&gt;11   DESCRIBE TABLE DEKET LINES SY-TFILL.&lt;/P&gt;&lt;P&gt;12   IF SY-TFILL GT 0.&lt;/P&gt;&lt;P&gt;13     DELETE EKET FROM TABLE DEKET.&lt;/P&gt;&lt;P&gt;14     IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;15       MESSAGE A865.&lt;/P&gt;&lt;P&gt;16     ENDIF.&lt;/P&gt;&lt;P&gt;17     EKET_DELETE = EKET_DELETE + SY-DBCNT.&lt;/P&gt;&lt;P&gt;18     REFRESH: DEKET.&lt;/P&gt;&lt;P&gt;19     CLEAR  : DEKET.&lt;/P&gt;&lt;P&gt;20   ENDIF.&lt;/P&gt;&lt;P&gt;21&lt;/P&gt;&lt;P&gt;22 * Einteilungen hinzufügen --&amp;gt; Array Insert aus Tabelle IEKET&lt;/P&gt;&lt;P&gt;23   DESCRIBE TABLE IEKET LINES SY-TFILL.&lt;/P&gt;&lt;P&gt;24   IF SY-TFILL GT 0.&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;     INSERT EKET FROM TABLE IEKET.&lt;/P&gt;&lt;P&gt;26     IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;27       MESSAGE A864.&lt;/P&gt;&lt;P&gt;28     ENDIF.&lt;/P&gt;&lt;P&gt;29     EKET_INSERT = EKET_INSERT + SY-DBCNT.&lt;/P&gt;&lt;P&gt;30     REFRESH: IEKET.&lt;/P&gt;&lt;P&gt;31     CLEAR  : IEKET.&lt;/P&gt;&lt;P&gt;32   ENDIF.&lt;/P&gt;&lt;P&gt;33&lt;/P&gt;&lt;P&gt;34 * Check whether the qty in EKPO-MENGE is correct: note 717464&lt;/P&gt;&lt;P&gt;35   SELECT SUM( menge ) FROM eket INTO lf_menge&lt;/P&gt;&lt;P&gt;36                       WHERE ebeln = ekpo-ebeln&lt;/P&gt;&lt;P&gt;37                       AND   ebelp = ekpo-ebelp.&lt;/P&gt;&lt;P&gt;38   IF sy-subrc = 0 AND ekpo-menge &amp;lt;&amp;gt; lf_menge.&lt;/P&gt;&lt;P&gt;39     IF ekpo-ktmng &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;40       refe1 = ekpo-zwert * lf_menge / ekpo-ktmng.&lt;/P&gt;&lt;P&gt;41     ELSE.&lt;/P&gt;&lt;P&gt;42       refe1 = ekpo-zwert * lf_menge / 1000.&lt;/P&gt;&lt;P&gt;43     ENDIF.&lt;/P&gt;&lt;P&gt;44     IF refe1 &amp;gt; maxwert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2011 12:20:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-4-open-sql-array-insert-results-in-duplicate-databaserecordsfor-pk13/m-p/8373673#M1642175</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-04T12:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP/4 Open SQL array insert results in duplicate databaserecordsfor pk13</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-4-open-sql-array-insert-results-in-duplicate-databaserecordsfor-pk13/m-p/8373674#M1642176</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;Well I don't know why you have duplicates, this is a functionnal issue. But you get the dump due the the message number 864 that triggers the abend... Changing the message type to 'E', 'S' or 'I' will prevent the dump but I guess this message has a good reason to be &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2011 15:29:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-4-open-sql-array-insert-results-in-duplicate-databaserecordsfor-pk13/m-p/8373674#M1642176</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-04T15:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP/4 Open SQL array insert results in duplicate databaserecordsfor pk13</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-4-open-sql-array-insert-results-in-duplicate-databaserecordsfor-pk13/m-p/8373675#M1642177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a standard transaction that should basically work. Did you do some additional developments on this? User exit, BAdI, modification?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2011 16:42:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-4-open-sql-array-insert-results-in-duplicate-databaserecordsfor-pk13/m-p/8373675#M1642177</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2011-11-04T16:42:32Z</dc:date>
    </item>
  </channel>
</rss>

