Application Development 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: 

How to import database from other system to ABAP dictionary

Former Member
0 Kudos

Hi everyone,

I have a database in SQL Server. Now I want import all the tables and their data to MAXDB and DDIC of miniSAP. Is there anyone know how to do that? Thanks in advance.

Best regards,

8 REPLIES 8

Former Member
0 Kudos

Hi ,

What is MINI SAP ? n DDIC and MAXDB ???

to get data from SQL server , you have to use OPEN SQL and not NATIVE SQL

Do you want to get data from SQL to a specific database in SAP ?

Is this your requirement ?

0 Kudos

Hi,

Thanks for your reply. MiniSap is NetWeaver but Trial version. MaxDB is a DBMS, like SQL Server. I had SQL Server with databases and data. NetWeaver is installed with MaxDB. In fact, I want to use these databases but I don't know how to connect NetWeaver with SQL Server. So I want to import all my database from SQL Server to MaxDB. This is the first step.

The second step is to use Open SQL, we have to define these tables in ABAP Dictionary.

My question is how to do these tasks.

Best regards

0 Kudos

Hi ,

You will have to explicitly create database in SAP which has strucuture same to that of SQL.

then you need to establish a connectiion btwrn ur SAP and SQL (done by tcode DBCO which you will be able to see in DBCON table - done by basis )

Then , do the foll.

1. first establish connection to SQL server by

  • Check the connection

EXEC SQL.

SET CONNECTION :gc_con_name " dbcon-con_name is name of connectioon

ENDEXEC.

IF sy-subrc <> 0.

  • Establish connection, if not yet open

EXEC SQL.

CONNECT TO :gc_con_name

ENDEXEC.

IF sy-subrc <> 0.

MESSAGE 'Error connecting IPMS database' TYPE 'E'.

ENDIF.

ENDIF

EXEC SQL.

OPEN C1 FOR

SELECT NAME1 , NAME2, NAME3 " fields name same in both the DB

FROM databasename.table name

ENDEXEC.

  • Fecth data

DO.

EXEC SQL.

FETCH NEXT C1 INTO :wa-name1,

:wa-name2,

:wa-name3

ENDEXEC.

IF sy-subrc = 0.

APPEND wa TO itab.

ELSE.

EXIT.

ENDIF.

ENDDO.

  • Close connection

EXEC SQL.

CLOSE C1

ENDEXEC.

ENDLOOP.

  • Reset to "default connection"

EXEC SQL.

SET CONNECTION DEFAULT

ENDEXEC.

see if this can help you out

Thanks

Supriya

0 Kudos

Thanks for your help.

In theory I think that it works. I already created a connection to my database. But I don't know why in my program, I can't set the connection. Do you know any tool in SAP which permets to test the connection without coding?

Regards.

0 Kudos

Hi ,

I had used the same code whcih i Gave you and its working fine for me.

Make sure you have made the connection properly . Did you get a value in table DBCO for the connection made.

Thanks

0 Kudos

Sorry.I know my problem. I installed my SQL Server in other server. That's why I can't connect to it. I think that your code is good. But I don't know how to add IP address and SQL instance to connection. There's no such field in dbco. Do you know how to configure these?

Regards.

0 Kudos

Hi ,

You dont need to know IP address ans other details ; Just tell your BASIS consultant that you need a connection say from your dev server to the SQL server. This can be achieved via a tcode DBCO and you will be able to see the details in DBCON table .

Thanks

Former Member
0 Kudos

Hi,

to fetch data from SQL to SAP use DB Connect through t.code dbco.

regards,

Archana