<?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>Question Re: ABAP Native SQL not working in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaa-p/13703408#M4829549</link>
    <description>Weird.</description>
    <pubDate>Thu, 16 May 2024 10:18:42 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2024-05-16T10:18:42Z</dc:date>
    <item>
      <title>ABAP Native SQL not working</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaq-p/13702371</link>
      <description>&lt;P&gt;I have a requirement to update an external database via ODBC and found that I can native SQL for this.&lt;BR /&gt;&lt;BR /&gt;I also found that I can try out native sql without connection to an external database. If I just use "EXEC SQL" without making a connection, the commands will run on the default connection - that is the SAP database.&lt;/P&gt;&lt;P&gt;Finally I found simple tutorial examples, but I can make none of the examples work.&lt;/P&gt;&lt;P&gt;If I for example run this below code I&amp;nbsp; get this error:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TMNielsen_0-1715779302948.png" style="width: 468px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/111026i845835B39EDB8CCE/image-dimensions/468x172?v=v2" width="468" height="172" role="button" title="TMNielsen_0-1715779302948.png" alt="TMNielsen_0-1715779302948.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;DATA: BEGIN OF wa,
        matnr TYPE matnr,
      END OF wa.

DATA: exc_ref    TYPE REF TO cx_sy_native_sql_error,
      error_text TYPE string.

PARAMETERS: p_matnr TYPE matnr.

TRY.
    EXEC SQL.
      open dbcur for
      select matnr
        from mara
       where mandt = :sy-mandt
         and matnr = :p_matnr
    ENDEXEC.

    DO.
      exec sql.
      FETCH NEXT dbcur into wa-matnr
      ENDEXEC.
      IF sy-subrc NE 0.
        EXIT.
      ELSE.
        WRITE: / wa-matnr.

      ENDIF.
    ENDDO.

  CATCH cx_sy_native_sql_error INTO exc_ref.
    error_text = exc_ref-&amp;gt;get_text( ).
    MESSAGE error_text TYPE 'I'.
ENDTRY.&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 May 2024 13:24:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaq-p/13702371</guid>
      <dc:creator>TMNielsen</dc:creator>
      <dc:date>2024-05-15T13:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Native SQL not working</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaa-p/13702491#M4829474</link>
      <description>&lt;P&gt;So I found solution my self. If I write everything between EXEC SQL. and ENDSQL. in capital letters, then it works.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;TRY.
    EXEC SQL PERFORMING LOOP_OUTPUT.
      SELECT MATNR
      INTO :WA-MATNR
      FROM MARA
      WHERE MATNR = :P_MATNR
    ENDEXEC.
  CATCH cx_sy_native_sql_error INTO exc_ref.
    error_text = exc_ref-&amp;gt;get_text( ).
    MESSAGE error_text TYPE 'I'.
ENDTRY.&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 May 2024 14:48:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaa-p/13702491#M4829474</guid>
      <dc:creator>TMNielsen</dc:creator>
      <dc:date>2024-05-15T14:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Native SQL not working</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaa-p/13702498#M4829475</link>
      <description>What software are you using? SAP ERP? SAP CRM? SAP SRM? ABAP trial?</description>
      <pubDate>Wed, 15 May 2024 14:52:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaa-p/13702498#M4829475</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2024-05-15T14:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Native SQL not working</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaa-p/13703203#M4829520</link>
      <description>&lt;P&gt;Hi Sandre&lt;BR /&gt;&lt;BR /&gt;I'm using SAP ERP - SAP_BASIS 7.50.&lt;BR /&gt;&lt;BR /&gt;I did make the test samples works by writing all the native SQL in capital letters.&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 07:47:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaa-p/13703203#M4829520</guid>
      <dc:creator>TMNielsen</dc:creator>
      <dc:date>2024-05-16T07:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Native SQL not working</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaa-p/13703408#M4829549</link>
      <description>Weird.</description>
      <pubDate>Thu, 16 May 2024 10:18:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaa-p/13703408#M4829549</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2024-05-16T10:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Native SQL not working</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaa-p/13703410#M4829550</link>
      <description>&lt;P&gt;Except the missing colon in the "fetch" line, your program works for me.&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;      FETCH NEXT dbcur into :wa-matnr&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 May 2024 10:20:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-native-sql-not-working/qaa-p/13703410#M4829550</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2024-05-16T10:20:00Z</dc:date>
    </item>
  </channel>
</rss>

