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: 

JAVA code for fetching a single row from a table in SAP

Former Member
0 Kudos

Hi All

Can anybody please tell me how to implement the "Select Single" query in JAVA while accessing SAP

Our requirement is to fetch the Sales Document number(VBELN) by passing the Purchase Order Number(BSTKD) from any of the tables containing these two fields like VBKD.

Thanks in Advance

Sree Ramya

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You would need to create an RFC enabled function module on the ABAP side, and put your select in this function module. Then call this function module from your java app using jCo. You can not select data directly from the ABAP database.

Regards,

Rich Heilman

Former Member
0 Kudos

You can call the RFC_READ_TABLE which can read any table on the SAP side.

Regards,

Ravi

former_member181962
Active Contributor
0 Kudos

Refer this thread for some insight:

Regards,

ravi

former_member188685
Active Contributor
0 Kudos

hi,

you need to use Java Connector, using RFC

<b>RFC_READ_TABLE</b> , to fetch the data from the tables from java applications.

Regards

vijay

0 Kudos

Hi Vijay/Rich/Ravi

I am already using this FM RFC_READ_TABLE. In this FM, we have a parameter called <b>DATA</b> in <b>TABLES</b> list. The length of the record of this table DATA is 512 charaters, whereas the length of the record of the table <b>VBKD</b>(the table which i am trying to fetch) is 586 characters. As a result of which, an exception is being thrown stating that "The record does not fit into the table <b>DATA</b>".

Plz clarify this.

Thanks,

Sree Ramya.

0 Kudos

You can as well specify the names of the fiels that you need. in the FIELDS table of the rfc.

Regards,

ravi