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

How to get DATA from MYSQL database

Former Member
0 Likes
2,430

I need to get all data from MYSQL database in to SAP Database tables.

My structure of both MYSQL and SAP tables are littlebit different..

Can I write BDC batch input directly from MYSQL tabls or I need to convert MYSQL tables in CSV format of EXCEL, or tab saperated sequencial file??

Please guide me..

Thanks

Chetan Shah

4 REPLIES 4
Read only

Former Member
0 Likes
1,136

Hi chetan,

1. There are two ways !

a) using DBCON (secondary database connection)

b) write z program for uploading data

thru text files.

2. It dependsupon your requirement

regards,

amit m.

Read only

Former Member
0 Likes
1,136

U can do it many ways. But the first and foremost is the structure of MYSQL which you should have and you should the tcode to load them into std SAP tables. If the data is going to be loaded into Z tables then u can write your own program to uploade it. Other option little complicated is by use of IDocs if you know one which satisfies your requirement.

Hope this helps.

Read only

Former Member
1,136

Hi,

Try this steps...

Creating a DBCON Entry

The database multi-connect information is stored in the SAP table DBCON. You can create a DBCON entry as follows:

...

1. In the screen Maintain and set monitor multi-connect data, from the menu choose Goto ® Maintain DBCON.

2. Choose New DBCON entry.

The dialog box New DBCON entry appears.

3. Make entries in the following fields:

1. ï‚¡ Connection name:

Enter any name. This is the name by which your remote database connection is identified.

2. ï‚¡ Database system: MSS

This field must display MSS.

3. ï‚¡ DB server (instance):

Enter the name of the target SQL Server that you want to administer from your local SAP system.

4. ï‚¡ Database login:

SQL Server login with System Administrator privileges, that is this login should be member of the sysadmin fixed server role on the target SQL Server. If such a login does not exist, you have to create it on the target SQL Server. The SAP multi-connect mechanism allows both integrated security logins and the use of SQL Server authentication. For security reasons, we highly recommend to use integrated security (Windows authentication). If you use Windows security, leave this field empty.

5. ï‚¡ Password / Re-enter password :

If you have decided to use integrated security, leave these fields empty. Otherwise enter the password of the SQL Server login.

6. ï‚¡ Database name:

Enter the name of the target database.

7. ï‚¡ Database user:

For remote database monitoring, leave this field empty. This will ensure that the database connection has dbo privilege.

8. ï‚¡ Object source schema:

This database schema contains all SAP database monitor objects, for example, stored procedures, user defined functions and tables. They implement the low-level database monitor functions.

Make one of the following entries:

1. ï‚§ If the target server is an SAP ABAP application of the same release than the source application server, and the SAP database objects (tables, views, stored procedure etc.) do not belong to the schema dbo, enter the of the target SAP system.

2. ï‚§ If the target server is an SAP ABAP application of the same release than the source application server, and the SAP database objects (tables, views, stored procedure etc) belong to the schema dbo, leave this field empty.

3. ï‚§ In all other cases, enter any name for the schema. For more information on how to create the schema in the target database and to fill it with the necessary monitoring objects, see Creating an Object Source Schema and the SAP TSQL Objects.

9. ï‚¡ Keep connection open:

Leave this field empty.

10. ï‚¡ Other parameters:

Leave this field empty.

4. Choose SAVE.

To Know databse connection name check DBCON table name

Native SQL command

EXEC SQL.

set connection 'Connection_string'

ENDEXEC.

IF sy-subrc 0.

EXEC SQL.

connect to 'Connection_string'

ENDEXEC.

ENDIF.

EXEC SQL.

SELECT CUST_CODE FROM CUSTOMER_MAP@IMPSCONN

INTO :ZIMPSCTCODE

WHERE SAP_CODE = :IT_IMPS_CUST-CUST_CODE

ENDEXEC.

Salil .......

Read only

0 Likes
1,136

Hi, is it possible to "select sum(field) from table " command in sap abap? because I ran into an statement error : https://answers.sap.com/questions/13411257/select-sum-statement-from-abap-to-mysql.html