cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing SAP Tables from a Java application

Former Member
0 Kudos

Hi,

I know, the forum is called "Web Application Server" but because it's Java question I hope to get answers here.

I have a small stand-alone Java application that needs to access (read-only) all records from a SAP table. Is there a possibility to do this without writing a BAPI before?

thanks a lot

Paul

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Paul,

You can use JCo to call the standard remote-enabled function RFC_READ_TABLE. There is one annoyance involved with this function, though: each row of data returned is packed into a single string, so you must either specify a delimiter and use e.g. String.split(...) to parse out the column values or use the returned metadata to extract each value based on position and length attributes of the column.

Another option (although this is usually not allowed in a productive environment) is to establish a direct JDBC connection to the database, thus bypassing the ABAP application layer entirely.

Regards,

Thorsten

achim_hauck2
Active Contributor
0 Kudos

...and unfortunately, the RFC_READ_TABLE RFC isn't "officially" supported / allowed for productive use, but on the other hand, i know many installations, that use it...

kr, achim

Answers (2)

Answers (2)

Former Member
0 Kudos

I checked the productive system and it doesnt contain this BAPI. So I need to write one my own?

achim_hauck2
Active Contributor
0 Kudos

Hi Paul,

the RFC_READ_TABLE is no BAPI, it's a RFC. You should see it in SE37. which SAP system do you have?

rewarding points is easy like that: if you've marked your question as question at first post, you'll see on the left side some stars, to value an answer (helpfull, very helpfull & solved problem).

kr, achim

Former Member
0 Kudos

Mhm, ok. within the productive system I have no rights to access se37. Is it possible to access this RFC anyway (with JCo)? The system is "R/3 Release 4.6C".

I thought I marked it as a question but since there are no such stars - maybe I didn't. There is only the option to mark it as "Solved it on my own".

Paul

achim_hauck2
Active Contributor
0 Kudos

but you'll have access to a development system with SE37 authorizations, don't you? this would be very useful for a developer

of course you cann access the RFC, but you don't know how to fill the import parameters since you can't look at the RFC in SE37. You have to give it for example the tablename of the accessing table in import parameter "QUERY_TABLE".

kr, achim

if you edit your initial post (click on the pencil), you can mark your post as "Question".

Former Member
0 Kudos

yes, on the development system I can access se37 and therefore know how to fill in the required values. I will try the connection with JCo now. The examples are quite good.

thanks again and yes it's a "question" now

Paul

0 Kudos

You will need a service user in the productive system with the correct authorizations for calling this RFC.

- Thorsten

Former Member
0 Kudos

hm, okay.. both sounds a bit strange. But I will check out whether the general get table data BAPI is accessible within the produktive system. The dev system got it.

Thanks,

Paul

P.S. I read about giving "reward points"? Where is it?