Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP-Abap to oracle server or ms sql server

former_member212713
Contributor
0 Likes
2,797

Hello;

I'm SAP to connect oracle server. And 3.party application database to prepare query and call procedure.

I'm know use to native sql. But Not connect SAP to oracle server. Please help me.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,182

AFAIK you have to use the ABAP statement EXEC / ENDEXEC to execute an sql statement like 'set connection' ...

8 REPLIES 8
Read only

Former Member
0 Likes
1,183

AFAIK you have to use the ABAP statement EXEC / ENDEXEC to execute an sql statement like 'set connection' ...

Read only

Former Member
0 Likes
1,182

Hi,

Check this sample.

Displaying an Extract from the Table AVERI_CLNT:


DATA: BEGIN OF WA, 
        CLIENT(3), ARG1(3), ARG2(3), 
      END OF WA. 
DATA  F3(3). 
F3 = ' 1 '. 
EXEC SQL. 
  SELECT CLIENT, ARG1 INTO :WA FROM AVERI_CLNT 
         WHERE ARG2 = :F3 
ENDEXEC. 
WRITE: / WA-CLIENT, WA-ARG1.

Regards

Vijay

Read only

former_member212713
Contributor
0 Likes
1,182

I’ve already known the Native SQL; but i don’t know how to connect to the oracle server or requirements for this connection.

Read only

0 Likes
1,182

What kind of requirements do you mean ??

Read only

0 Likes
1,182

hi,

you need to have some dll file , if you need to connect to the external server. check it .

Regards

Vijay

Read only

Former Member
0 Likes
1,182

Hi,

Step 1: Create an entry for the External database in DBCON table using Trxn: DBCA.

Table: DBCON (Description of Database Connections)

Field Name Description Value (For: E.g.:)

CON_NAME Logical name RAJ

DBMS Database system MSS

USER_NAME Database user <username>

PASSWORD Password <pwd>/<pwd>

CON_ENV Database-specific information

connection

MSSQL_SERVER=depotserver MSSQL_DBNAME=HOF_INDORE

DB_RECO Availability type for an open database connect

Step 2: Now you can write code to connect to the external database…

Your Sample code can be something like this……

EXEC SQL.

CONNECT TO 'RAJ' AS 'V'

ENDEXEC.

EXEC SQL.

SET CONNECTION 'V'

ENDEXEC.

*- Get the data from MS-SQL Server

EXEC SQL.

open C1 for

select

loc_id,

loc_name,

loc_state

from ho_loc_mast

ENDEXEC.

Regards,

Raj

Read only

former_member212713
Contributor
0 Likes
1,182

Is it necessary to make a configuration about dll or tnsnames in SAP or in the other database ?

If yes, how must be the configuration like?

Read only

former_member212713
Contributor
0 Likes
1,182

Thanks