Skip to Content

Connecting to External Database from SAP

Scenario

In today’s business scenario, at the time of SAP implementation, it is required that we need to fetch data from the customer’s existing third party application.  For example the customer is having some websites where the enquiries are being stored. Or The company employees who are on tour log their requests for leave in the portal.  In such case we may have to provide an interface between their existing application to the upcoming SAP system.  It is possible that the system is using a differetn database altogather.  So in that situation how a connectivity is established between the SAP database and External Application database.

  1. First step is to provide the network / firewall / security related settings between these two servers. That is from the SAP ystem the designated database servers are accessible.
  2. In SAP system – configure the connection detail. Execute T-Code  DBCO
  3. Enter appropriate details as follows:
    • In the box, DB Connection, give any name of the connection. – the name in our SAP programs to connect to the oracle system.
    • In DBMS, choose the option ORA for oracle system.
    • In the user name box, give the name of the oracle system user. You will notice two boxes for DB password – one is the password box and the other one is the confirm password box. Give the password in both the boxes.
    • In Conn. Info box, give the name of the Oracle server – you may ask your database Administrator to get the name of the server
    • Check the check box Permanent to make the connection permanent and
    • Finally the connection limit as 5.
  4. Go to SE38 – to write a test program

   REPORT  ZSAP2ORACLE.
  data: l_record(20).

          * opening the connection to database
  EXEC SQL.
     CONNECT TO ‘MYCONNECTION’
  ENDEXEC.*executing the select command
  EXEC SQL.
     SELECT ars_no into :l_record FROM arsdata
  ENDEXEC.*closing the connection
  EXEC SQL.
     DISCONNECT :’MYCONNECTION’
  ENDEXEC.
  WRITE: / l_record.

This should work and you should be able to fetch data from the external database.

7 Comments
You must be Logged on to comment or reply to a post.
  • hi ,

    We have a requirement to connect to different database(SAP+non SAP system) through procedure code from SAP HANA .Has anyone tried something similar to it.Please share the feasibility if any one has worked on similar type of requirement.

     

    Regards,

    Deepa

      • i can’t try, because there is someone said to me :

        ” I’d like to confirm the followings:

        1. For the DB connection, the license is SAP Data Service license
        2. For the person who run the T.Code SE38, this person should have the SAP Developer license

        SAP Data Service license for connection between database SAP and non-SAP database.

        I just have SAP Developer license

         

        Thanks

        • No .. Data Services license is not required.

          NB: I am not Venkat ;-), I repeat his answer because I think it still applies to your second identical question.

          NB: why don’t you just try?

      • Hi Venkat

         

        Do have official document from SAP to support your statement ?

         

        I have new question hopely you can give me answer…..If i use this feature for read data from external database and then the data process in sap using BAPI to create document transfer in sap-ecc. is it ok ?

         

        Best Regard,

        WawanS

  • How connet to different SQL DB in each time you need to run program to get data, also if that applicable to connect to same pc that run sap Gui, if this pc have ms sql?