<?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 Exception in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514222#M1067477</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;&lt;/P&gt;&lt;P&gt;use the following to set the message to the user:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRY.&lt;/P&gt;&lt;P&gt;insert ztable from table itab.&lt;/P&gt;&lt;P&gt;CATCH CX_SY_OPEN_SQL_DB.&lt;/P&gt;&lt;P&gt; message "Duplicate Insert due to same key" display like 'E'.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;ENDTRY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shruthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Sep 2008 04:58:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-23T04:58:08Z</dc:date>
    <item>
      <title>Insert Exception</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514217#M1067472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I m using Insert stmt to insert the records to ztable from itab.&lt;/P&gt;&lt;P&gt;insert ztable from table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I m getting 'CX_SY_OPEN_SQL_DB' exception bcoz the record with the same key exists in the table. pls let me know how to catch this exception and how to set the message to the user &lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 20:36:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514217#M1067472</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T20:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Exception</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514218#M1067473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmmm... You should get a return code of 4, not a dump if you try to insert a record with a duplicate key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any event, use MODIFY instead of INSERT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 20:43:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514218#M1067473</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T20:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Exception</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514219#M1067474</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 can read the table using a Select * using the table key before insterting the record so that if there is a record existing in the table then the sy-subrc will return as 0, then you can catch the exception or insert the record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another way is to use MODIFY instead of INSERT statement, this statement inserts the record if there is not record with that key or modifies the records if exists.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Trikanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 20:58:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514219#M1067474</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T20:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Exception</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514220#M1067475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it's something else. Can you post your code and dump analysis?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Sep 2008 21:03:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514220#M1067475</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-22T21:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Exception</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514221#M1067476</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;The exception 'CX_SY_OPEN_SQL_DB'  also occurs if your database table is empty. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the TRY..CATCH block to handle the exception (to avoid a dump). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;e.g.:&lt;/STRONG&gt; to handle a run-time error if the dbtab is empty..&lt;/P&gt;&lt;P&gt;TRY.&lt;/P&gt;&lt;P&gt;   select * from ztable.&lt;/P&gt;&lt;P&gt;CATCH CX_SY_OPEN_SQL_DB.&lt;/P&gt;&lt;P&gt;ENDTRY.&lt;/P&gt;&lt;P&gt;   insert ztable from table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the dump occurs even if the dbtab has data in it, then you should check to see if your itab contains rows with identical primary keys.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Purnima.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2008 04:52:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514221#M1067476</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-23T04:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Exception</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514222#M1067477</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;&lt;/P&gt;&lt;P&gt;use the following to set the message to the user:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRY.&lt;/P&gt;&lt;P&gt;insert ztable from table itab.&lt;/P&gt;&lt;P&gt;CATCH CX_SY_OPEN_SQL_DB.&lt;/P&gt;&lt;P&gt; message "Duplicate Insert due to same key" display like 'E'.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;ENDTRY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shruthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2008 04:58:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-exception/m-p/4514222#M1067477</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-23T04:58:08Z</dc:date>
    </item>
  </channel>
</rss>

