<?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: Calling Stored Proc. Explicitly(using EXECUTE stmt) v/s Using ADBC classes in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-stored-proc-explicitly-using-execute-stmt-v-s-using-adbc-classes/m-p/6293044#M1390071</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have no clue, but if you don't get an answer here, you could try again in forums "ABAP performance" or "SAP on &amp;lt;insert your DB here&amp;gt;", there might be better experts in this matter.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Oct 2009 15:46:45 GMT</pubDate>
    <dc:creator>ThomasZloch</dc:creator>
    <dc:date>2009-10-26T15:46:45Z</dc:date>
    <item>
      <title>Calling Stored Proc. Explicitly(using EXECUTE stmt) v/s Using ADBC classes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-stored-proc-explicitly-using-execute-stmt-v-s-using-adbc-classes/m-p/6293043#M1390070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear SAP DB Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have encountered a strange problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i call a Stored Procedure using Native SQL i am able to fetch records from the SP (even if the SP has a problem):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TRY.
*   execute SP_IMDL_PERSONINFO
    DATA L_TYPE  LIKE ACCTTY .
    L_TYPE = 'USR'.
    EXEC SQL.
      OPEN C FOR
      execute SP_EXECUTE @ACCTTY = :l_type
    ENDEXEC.

    DO.
      EXEC SQL.
        FETCH NEXT C INTO :lstruc-acct,
        :lstruc-acctsta
      ENDEXEC.
      IF SY-SUBRC &amp;lt;&amp;gt; 0.
        EXIT.
      ENDIF.
      APPEND LSTRUC TO LTAB. 
    ENDDO.

    EXEC SQL.
      CLOSE C
    ENDEXEC.

    DATA L_LINES TYPE I.
    DESCRIBE TABLE LTAB LINES L_LINES.
    WRITE: L_LINES.

ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if i use SP, i am getting an EXCEPTION:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA L_PROC_NAME TYPE CHAR120.

  L_PROC_NAME = 'SP_EXECUTE'.

  DATA: L_TYPE    LIKE LSTRUC-ACCTTY,
        L_ACCT    LIKE LSTRUC-ACCT,
        L_ACCTSTA LIKE LSTRUC-ACCTSTA.

* create a statement object
  L_STMT_REF = P_CON_REF-&amp;gt;CREATE_STATEMENT( ).

* bind input variables
  L_TYPE = 'USR'.
  GET REFERENCE OF L_TYPE INTO L_DREF.
  L_STMT_REF-&amp;gt;SET_PARAM( L_DREF ).

* bind output variables
  GET REFERENCE OF L_ACCT INTO L_DREF.
  L_STMT_REF-&amp;gt;SET_PARAM( DATA_REF = L_DREF
  INOUT    = CL_SQL_STATEMENT=&amp;gt;C_PARAM_OUT ).

  GET REFERENCE OF L_ACCTSTA INTO L_DREF.
  L_STMT_REF-&amp;gt;SET_PARAM( DATA_REF = L_DREF
  INOUT    = CL_SQL_STATEMENT=&amp;gt;C_PARAM_OUT ).


* set the input values and execute the Stored Procedure
  PERFORM TRACE_2 USING 'EXECUTE_PROCEDURE' L_STMT L_COL1 L_COL2.

  L_STMT_REF-&amp;gt;EXECUTE_PROCEDURE( L_PROC_NAME ).

* set output table
  GET REFERENCE OF L_ITAB INTO L_DREF.
  L_RES_REF-&amp;gt;SET_PARAM_TABLE( L_DREF ).

* get the complete result set
  L_ROW_CNT = L_RES_REF-&amp;gt;NEXT_PACKAGE( ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;SQL error occured:      8.114
Error converting data type nvarchar to numeric.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used the program ADBC_DEMO as reference for using the ADBC classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is: Even though the Stored Proc. has an error, the Native SQL does not throw an exception whereas ADBC does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can be the reason?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Oct 2009 15:06:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-stored-proc-explicitly-using-execute-stmt-v-s-using-adbc-classes/m-p/6293043#M1390070</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2009-10-26T15:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Stored Proc. Explicitly(using EXECUTE stmt) v/s Using ADBC classes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-stored-proc-explicitly-using-execute-stmt-v-s-using-adbc-classes/m-p/6293044#M1390071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have no clue, but if you don't get an answer here, you could try again in forums "ABAP performance" or "SAP on &amp;lt;insert your DB here&amp;gt;", there might be better experts in this matter.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Oct 2009 15:46:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-stored-proc-explicitly-using-execute-stmt-v-s-using-adbc-classes/m-p/6293044#M1390071</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2009-10-26T15:46:45Z</dc:date>
    </item>
  </channel>
</rss>

