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

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

Former Member
0 Likes
1,106

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
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
991

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

Read only

Former Member
0 Likes
991

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

Regards,

Ravi

Read only

Former Member
0 Likes
991

Refer this thread for some insight:

Regards,

ravi

Read only

Former Member
0 Likes
991

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

Read only

0 Likes
991

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.

Read only

0 Likes
991

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

Regards,

ravi