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

connectivity between SAP and SQL Server

Former Member
0 Likes
383

Hi all,

how to take the SAP data which is in Oracle database on AIX Operating system to SQL Server database which resides in Windows for a portal?

Can anyone help on this?

Regards,

Sathya

2 REPLIES 2
Read only

Former Member
0 Likes
338

HEllo,


Hi

Please see the following:

1. Create an entry in Trxn DBCA for SQL Server in SAP, you are creating a database connection for the SQL server in SAP.

2. You use this connection, and write Native SQL stmnts...between EXECSQL...ENDEXEC to fetch the data..and then normal ABAP statements to put that data into your ztable.

TABLE DBCON Entry can be like this...depends on your External database..

CON_NAME Raj Logical name for connection
DBMS MSS Microsoft SQL Server
USER_NAME <User name> For SQL Server
PASSWORD <password> " "
CON_ENV MSSQL_SERVER=<server> MSSQL_DBNAME=<database name>
DB_RECO Availability type for an open database connect 



FUNCTION z_houston_connect.

*"----------------------------------------------------------------------

*"*"Local interface:

*"----------------------------------------------------------------------

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

l.loc_id,

l.loc_name,

a.acc_id,

a.acc_name,

d.person

from ho_loc_mast as l

inner join snd_acc_mast as a on l.loc_id = a.loc_id

inner join snd_acc_addr as d on a.loc_id = d.loc_id and

a.acc_id = d.acc_id

where l.loc_id = '001'

ENDEXEC.

DO.

EXEC SQL.

FETCH NEXT C1 into :wa-c_locid, :wa-c_locname, :wa-c_acc_id, :wa-c_acc_name, :wa-c_person

ENDEXEC.

IF sy-subrc = 0.

PERFORM loop_output.

ELSE.

EXIT.

ENDIF.

ENDDO.

EXEC SQL.

CLOSE C1

ENDEXEC.

ENDFUNCTION. 

Regards,
Vasanth

Read only

Former Member
0 Likes
338

Hi!

You have many choices in this task:

- read the SAP tables directly like an SQL server (requires some basis settings to enable it)

- make a function module (for example Z_TABLE_READ), which provides all the neccessary data, and you can call this function module from outside, through SAP's activex components.

We used both ways, and is working. Of course I was made only the function modules, so the other settings are unknown by me.

Regards

Tamá