<?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: Access data from external database in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-data-from-external-database/m-p/7219475#M1523652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As mentioned by Michael, for these types of requirement you've to create a Database connection for the external DB. (Tcode DBCO).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once the connection params are maintained you can use the ADBC(ABAP DataBase Connectivity) classes to access the data. Check the demo program ADBC_DEMO.&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>Tue, 31 Aug 2010 09:55:32 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2010-08-31T09:55:32Z</dc:date>
    <item>
      <title>Access data from external database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-data-from-external-database/m-p/7219472#M1523649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I have to access data from an external oracle database from SAP system running DB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I found few threads &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; [Access external Oracle database with ABAP|&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="33542"&gt;&lt;/A&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This uses native SQL to open connection, and don't want to use this option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another one describes about Remove views&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[API to connect to external database|&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="9687"&gt;&lt;/A&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but could not find more information in SCN searching with "Remote views".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i implement this "Remote views" ? Any tips welcome&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Aug 2010 07:59:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/access-data-from-external-database/m-p/7219472#M1523649</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-31T07:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Access data from external database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-data-from-external-database/m-p/7219473#M1523650</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;there is a trick you can use, but you need a DBlink to the external database. This is the same as it is described if you want to use the Native SQL.&lt;/P&gt;&lt;P&gt;The trick is that you define the tables with the same name and structure as the remote tables in se11. Of course you need to use the customer namespace. Then you can also define views in se11. after activation you drop the tables on SAP database level.&lt;/P&gt;&lt;P&gt;In ABAP program you switch the DB connection to the DBLink if you want to access the remote tables. Then you can access them with with Open SQL. Switch back to standard database connection before processing SAP internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solution has disadvantages. When activating a table in SE11 the table will also be created in SAP database also in case you transport it to another sytem. This means after changing the structre in se11 and activation the table will be created by SAP again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Aug 2010 08:59:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/access-data-from-external-database/m-p/7219473#M1523650</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-31T08:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Access data from external database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-data-from-external-database/m-p/7219474#M1523651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just found a sample I made years ago. The right object is to create a synonym.&lt;/P&gt;&lt;P&gt;The coding create and tests such a link. The link must be defined on database level as described in the OSS for the native SQL solution.&lt;/P&gt;&lt;P&gt;REPORT zsmbtest_dbsyn LINE-SIZE 80.&lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To Do's:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;             1. Create table with the name of the synonym in SE11 and activate&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;             2. Call Function module DB_DROP_TABLE in SE37 with TABNAME =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                created table&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;             3. Create synonym with this program&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                After this you cant activate the table anymore but you can&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                access with open Open SQL&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_syn  TYPE dbcon_name DEFAULT 'ZALTRES_FPDEV',&lt;/P&gt;&lt;P&gt;            p_conn TYPE dbcon_name DEFAULT 'I2ADW_FPDEV',&lt;/P&gt;&lt;P&gt;            p_switch AS CHECKBOX DEFAULT 'X',&lt;/P&gt;&lt;P&gt;            p_test RADIOBUTTON GROUP mode,&lt;/P&gt;&lt;P&gt;            p_drop RADIOBUTTON GROUP mode,&lt;/P&gt;&lt;P&gt;            p_create RADIOBUTTON GROUP mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF p_test IS INITIAL.&lt;/P&gt;&lt;P&gt;  PERFORM create_syn USING  p_create&lt;/P&gt;&lt;P&gt;                            p_syn&lt;/P&gt;&lt;P&gt;                           'alt_res@i2adw_fpdev'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;  PERFORM test_syn USING p_syn&lt;/P&gt;&lt;P&gt;                         p_conn&lt;/P&gt;&lt;P&gt;                         p_switch.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  create_syn&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; --&amp;gt;  p1        text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; &amp;lt;--  p2        text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;FORM create_syn USING value(pmode)&lt;/P&gt;&lt;P&gt;                      value(psyn)&lt;/P&gt;&lt;P&gt;                      value(plink).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: len TYPE i,&lt;/P&gt;&lt;P&gt;        sql_code TYPE i,&lt;/P&gt;&lt;P&gt;        sql_msg TYPE c,&lt;/P&gt;&lt;P&gt;        dummy(254).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF pmode = 'X'.   "Create&lt;/P&gt;&lt;P&gt;    CONCATENATE 'CREATE SYNONYM' psyn 'FOR' plink&lt;/P&gt;&lt;P&gt;                 INTO dummy SEPARATED BY space.&lt;/P&gt;&lt;P&gt;  ELSE.             "Drop&lt;/P&gt;&lt;P&gt;    CONCATENATE 'DROP SYNONYM' psyn&lt;/P&gt;&lt;P&gt;              INTO dummy SEPARATED BY space.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  COMPUTE len = strlen( dummy ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'DB_EXECUTE_SQL'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            stmt                   = dummy&lt;/P&gt;&lt;P&gt;            stmt_ln                = len&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;            sql_code               = sql_code&lt;/P&gt;&lt;P&gt;            sql_msg                = sql_msg&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            sql_error              = 1&lt;/P&gt;&lt;P&gt;            not_found_or_duplicate = 2&lt;/P&gt;&lt;P&gt;            internal_error         = 3&lt;/P&gt;&lt;P&gt;            OTHERS                 = 4.&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 1.&lt;/P&gt;&lt;P&gt;    WRITE: / 'SQL DB-Error :', sql_code, sql_msg.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    WRITE: / 'SQL DB-Return :', sy-subrc.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " create_syn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  test_syn&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt;P_PSYN  text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;FORM test_syn USING    p_psyn&lt;/P&gt;&lt;P&gt;                       p_pconn&lt;/P&gt;&lt;P&gt;                       p_pswitch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: wa_alt_res  TYPE zpp_alt_res_i2t,&lt;/P&gt;&lt;P&gt;        ta_alt_res  TYPE STANDARD TABLE OF zpp_alt_res_i2t,&lt;/P&gt;&lt;P&gt;        wa_dbfields TYPE dbfield,&lt;/P&gt;&lt;P&gt;        ta_dbfields TYPE STANDARD TABLE OF dbfield.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: l_dbcnt TYPE sy-dbcnt,&lt;/P&gt;&lt;P&gt;        l_subrc TYPE sy-subrc,&lt;/P&gt;&lt;P&gt;        wa_syn(1000) TYPE c,&lt;/P&gt;&lt;P&gt;        sql_code TYPE i,&lt;/P&gt;&lt;P&gt;        dummy(254).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  EXEC SQL.&lt;/P&gt;&lt;P&gt;    SELECT COUNT(*) FROM all_synonyms&lt;/P&gt;&lt;P&gt;                    INTO :l_dbcnt&lt;/P&gt;&lt;P&gt;  ENDEXEC.&lt;/P&gt;&lt;P&gt;  WRITE: / 'Einträge in Tabelle all_synonyms der SAP DB   :',&lt;/P&gt;&lt;P&gt;            l_dbcnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF p_pswitch = 'X'.&lt;/P&gt;&lt;P&gt;    EXEC SQL.&lt;/P&gt;&lt;P&gt;      connect to :p_pconn&lt;/P&gt;&lt;P&gt;    ENDEXEC.&lt;/P&gt;&lt;P&gt;    CHECK sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    EXEC SQL.&lt;/P&gt;&lt;P&gt;      SELECT COUNT(*) FROM all_synonyms&lt;/P&gt;&lt;P&gt;                      INTO :l_dbcnt&lt;/P&gt;&lt;P&gt;    ENDEXEC.&lt;/P&gt;&lt;P&gt;    WRITE: / 'Einträge in Tabelle all_synonyms der Remote DB:',&lt;/P&gt;&lt;P&gt;              l_dbcnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'DB_GET_TABLE_FIELDS'&lt;/P&gt;&lt;P&gt;         EXPORTING&lt;/P&gt;&lt;P&gt;              tabname  = 'ALT_RES'&lt;/P&gt;&lt;P&gt;         IMPORTING&lt;/P&gt;&lt;P&gt;              subrc    = l_subrc&lt;/P&gt;&lt;P&gt;         TABLES&lt;/P&gt;&lt;P&gt;              dbfields = ta_dbfields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF NOT ta_dbfields[] IS INITIAL.&lt;/P&gt;&lt;P&gt;      ULINE.&lt;/P&gt;&lt;P&gt;      WRITE: / 'Struktur der Remote-Tabelle ALT_RES'.&lt;/P&gt;&lt;P&gt;      ULINE.&lt;/P&gt;&lt;P&gt;      LOOP AT ta_dbfields INTO wa_dbfields.&lt;/P&gt;&lt;P&gt;        WRITE : / wa_dbfields-name, wa_dbfields-type,&lt;/P&gt;&lt;P&gt;                  wa_dbfields-length, wa_dbfields-decimals.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;P&gt;      ULINE.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT * FROM (p_psyn) INTO TABLE ta_alt_res.&lt;/P&gt;&lt;P&gt;  WRITE: / 'Einträge in Remote DB mit Synonym', p_psyn, ':', sy-dbcnt.&lt;/P&gt;&lt;P&gt;  IF NOT ta_alt_res[] IS INITIAL.&lt;/P&gt;&lt;P&gt;    ULINE.&lt;/P&gt;&lt;P&gt;    LOOP AT ta_alt_res INTO wa_alt_res.&lt;/P&gt;&lt;P&gt;      WRITE: / wa_alt_res-werks, wa_alt_res-arbpl_nom,&lt;/P&gt;&lt;P&gt;               wa_alt_res-arbpl_alt, wa_alt_res-thckn_min_in,&lt;/P&gt;&lt;P&gt;               wa_alt_res-width_min_in.&lt;/P&gt;&lt;P&gt;      IF sy-tabix &amp;gt; 50.&lt;/P&gt;&lt;P&gt;        EXIT.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;    ULINE.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  COMMIT WORK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF p_pswitch = 'X'.&lt;/P&gt;&lt;P&gt;    EXEC SQL.&lt;/P&gt;&lt;P&gt;      disconnect :p_pconn&lt;/P&gt;&lt;P&gt;    ENDEXEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " test_syn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Aug 2010 09:43:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/access-data-from-external-database/m-p/7219474#M1523651</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-31T09:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Access data from external database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-data-from-external-database/m-p/7219475#M1523652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As mentioned by Michael, for these types of requirement you've to create a Database connection for the external DB. (Tcode DBCO).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once the connection params are maintained you can use the ADBC(ABAP DataBase Connectivity) classes to access the data. Check the demo program ADBC_DEMO.&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>Tue, 31 Aug 2010 09:55:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/access-data-from-external-database/m-p/7219475#M1523652</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2010-08-31T09:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Access data from external database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-data-from-external-database/m-p/7219476#M1523653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suhas / Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; We have decided to go for flat file as there are lot of calculations involved to arrive at the result and a select from SAP would not be good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Information provided was very helpful...Thanks guys.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Sep 2010 05:13:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/access-data-from-external-database/m-p/7219476#M1523653</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-02T05:13:59Z</dc:date>
    </item>
  </channel>
</rss>

