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

read MS-ACCESS database in batch job

danny_roussel4
Participant
0 Likes
873

Hi,

I have an abap that is reading an MS-ACCESS database.

When I execute it +online,+ it works just fine.

However when I want to run it as step in a batch job, I receive upon

CALL METHOD OF REC 'Open'

EXPORTING #1 = SQL

#2 = CON

#3 = '1'.

no error, but the field CON-HANDLE contains "1-" and no data can be read.

Has anyone any idea how to solve this please?

Thanks!

Danny

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
713

In background, direct OLE can't work (because it can work only when the ABAP is called from SAPGUI).

This solution might work (assuming the MS-access computer is always switched on of course) : Your ABAP must call a program by RFC on the MS-Access computer. This program, you must create it with RFC SDK in any language (C, java, etc.) The RFC server program has to be installed too. It will read MS-Access database.

There are 2 ways:

1) If you don't want to recode everything, and keep your OLE ABAP code, the program should "call back" your OLE ABAP code on the the SAP system by RFC again (enable dialog mode so that OLE can be used). You just have to create an RFC enabled function module which executes the whole OLE.

2) Or migrate your OLE ABAP code to the new program on the MS-access computer (you have to re-code everything, but maybe it's best)

Hi,

I have an abap that is reading an MS-ACCESS database.

When I execute it +online,+ it works just fine.

However when I want to run it as step in a batch job, I receive upon

CALL METHOD OF REC 'Open'

EXPORTING #1 = SQL

#2 = CON

#3 = '1'.

no error, but the field CON-HANDLE contains "1-" and no data can be read.

Has anyone any idea how to solve this please?

Thanks!

Danny

4 REPLIES 4
Read only

Former Member
0 Likes
713

Hi,

Batch job is executed in the application server. Make sure your application server has ms-access installed and it has acces to the odbc datasource or to the network directory where the mdb file is located.

-Simo

Read only

Sandra_Rossi
Active Contributor
0 Likes
714

In background, direct OLE can't work (because it can work only when the ABAP is called from SAPGUI).

This solution might work (assuming the MS-access computer is always switched on of course) : Your ABAP must call a program by RFC on the MS-Access computer. This program, you must create it with RFC SDK in any language (C, java, etc.) The RFC server program has to be installed too. It will read MS-Access database.

There are 2 ways:

1) If you don't want to recode everything, and keep your OLE ABAP code, the program should "call back" your OLE ABAP code on the the SAP system by RFC again (enable dialog mode so that OLE can be used). You just have to create an RFC enabled function module which executes the whole OLE.

2) Or migrate your OLE ABAP code to the new program on the MS-access computer (you have to re-code everything, but maybe it's best)

Read only

0 Likes
713

Thank you all for your suggestions!

However it seems strange to me that MS-ACCESS can not be accessed from the server, I keep on searching...

Read only

0 Likes
713

It can if it is windows, but mostly it is some kind of unix. Maybe there are odbc driver files available for unix, ask your basic guys for that.