Skip to Content
avatar image
Former Member

Get data from external database

Hi,

I need to get some data from an external database (sql server).

--> I must make some request from my abap program to the sql server

Is there some RFC or ADO equivalent in sap ?

Any idea ? : )

Thx,

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 16, 2008 at 10:18 AM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 16, 2008 at 10:36 AM

    I heard about table DBCON which could be usqed with an EXCED SQL statement.

    ->Someone know how to configure DBCON to connect to an external database (mss) ?

    It would be the better solution for my program but I ve never seen any sample use it :/

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 16, 2008 at 01:41 PM

    Thx for replies,

    I have data in an MicrosoftSqlServer and I must import them into my SAP system.

    I would like to get the data with native SQL like this way :

    tables: dbcon.
    
     
    data: FLAG_CONNECTED(1),
          v_conn like dbcon-CON_NAME.
     
    *v_conn = 'MAR62'.
    
    select single con_name from dbcon into v_conn where DBMS = 'MSS'.
    
     
    EXEC SQL.
     
            set connection :v_conn
    ENDEXEC.
    

    -> I have made an entry in DBCON and i ve try to add it in DBACOCKPIT but I get an error :

    function unit: DB6_DIAG_GET_SYSTEM_BASICS

    method : SYNCHRONIZE_SYSTEM_DATA

    REASON : ADBC ERROR

    What is the excact way to run my sample ?

    thx for replies : )

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 09:00 AM

    Hi,

    Follow these notes 323151 and 178949. And search in SAP Market place there are many notes to help you.

    Rhea.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 10:27 AM

    Hi,

    Try This

    EXEC SQL.

    CONNECT TO 'FP_CONNECT'

    ENDEXEC.

    IF sy-subrc NE 0.

    WRITE / 'CONNECTION FAILED' COLOR COL_NEGATIVE.

    ENDIF.

    EXEC SQL PERFORMING READ_DATA.

    SELECT *

    FROM TABLE

    INTO STRUCTURE.

    ENDEXEC

    FORM READ_DATA.

    WRITE : / STRUCTURE.

    ENDFORM

    Hope this will read data from External Data base table or view.

    Thanks,

    Kishore

    Add comment
    10|10000 characters needed characters exceeded