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

Connecting and Updating External Database from SAP

Former Member
0 Likes
775

How can i connect SAP Database to External database?

How can i update external databas from SAP withouting using BI/BW, Workflow or Net Weaver?

If anyone know please let me inform.

Thanks in Advance.

Jahnavee Trivedi

1 ACCEPTED SOLUTION
Read only

manuel_bassani
Contributor
0 Likes
599

Hi,

run transaction DBCO ( manages DB connections ).

Fill fields:

- connection name

- connection type (see match code)

- DB user / password

- Connection string

You should contact the DB administrator to have those informations.

Now in your ABAP code, you can connect to the DB using instruction

EXEC SQL.
  CONNECT TO <connection name>
ENDEXEC.

Open a cursor for your select statement

EXEC SQL. 
  OPEN cursor1 FOR SELECT  ....
ENDEXEC.

Get data using the cursor (and fill ABAP variables)

DATA:
  var1 TYPE ....
  var2 TYPE ...
 EXEC SQL. 
    FETCH NEXT cursor1 INTO :var1, :var2
  ENDEXEC.

Press F1 on EXEC statement to get more detailed informations from ABAP online help

Please remember to reward points for useful answers.

Best regards,

Manuel

3 REPLIES 3
Read only

mvoros
Active Contributor
0 Likes
599

Hi,

instead of using OpenSQL you can use Native SQL. Just look for Native SQL in SAP documentation.

[url]http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/content.htm[url]

Cheers

Read only

GrahamRobbo
SAP Mentor
SAP Mentor
0 Likes
599

Hi Jahn,

if the external database is one that is supported by SAP you can use a technique called DB Multiconnect.

Search the SAP documentation and notes for this term and you will find how to do it.

Cheers

Graham Robbo

Read only

manuel_bassani
Contributor
0 Likes
600

Hi,

run transaction DBCO ( manages DB connections ).

Fill fields:

- connection name

- connection type (see match code)

- DB user / password

- Connection string

You should contact the DB administrator to have those informations.

Now in your ABAP code, you can connect to the DB using instruction

EXEC SQL.
  CONNECT TO <connection name>
ENDEXEC.

Open a cursor for your select statement

EXEC SQL. 
  OPEN cursor1 FOR SELECT  ....
ENDEXEC.

Get data using the cursor (and fill ABAP variables)

DATA:
  var1 TYPE ....
  var2 TYPE ...
 EXEC SQL. 
    FETCH NEXT cursor1 INTO :var1, :var2
  ENDEXEC.

Press F1 on EXEC statement to get more detailed informations from ABAP online help

Please remember to reward points for useful answers.

Best regards,

Manuel