cancel
Showing results for 
Search instead for 
Did you mean: 

Help on accessing tables in Java available in SAP system

former_member55105
Participant
0 Kudos

Hi All

A day before I had posted a question regarding the accessing of tables available in SAP R/3 system in my Java code.

I got the following code as reply. This code is working fine.

But in the below example, the QUERY_TABLE IS BSAUTHORS.

In my case, the QUERY_TABLE is VBKD(Sales Document Table).

When I replace the table name with VBKD in place of BSAUTHORS, I am getting the following error:

-


ERROR BEGIN----


com.sap.mw.jco.JCO$AbapException: (126) DATA_BUFFER_EXCEEDED: Selected fields do not fit into structure DATA

at com.sap.mw.jco.JCO$Function.getException(JCO.java:17978)

at com.sap.mw.jco.JCO$Client.execute(JCO.java:3143)

at com.insync.JCO.UpdateSalesOrder.main(UpdateSalesOrder.java:34)

-


ERROR END----


Can anyone please give me a solution for this?

Thanks in Advace,

Vijay.

**********************Code**********************

import com.sap.mw.jco.*;

public class JcoTest {

private static JCO.Client theConnection;

private static IRepository theRepository;

public static void main(String[] args) {

createConnection();

retrieveRepository();

try {

JCO.Function function = getFunction("RFC_READ_TABLE");

JCO.ParameterList listParams = function.getImportParameterList();

listParams.setValue("BSAUTHORS", "QUERY_TABLE");

//listParams.setValue("VBKD", "QUERY_TABLE"); // ERROR

theConnection.execute(function);

JCO.Table tableList = function.getTableParameterList().getTable("DATA");

if (tableList.getNumRows() > 0) {

do {

for (JCO.FieldIterator fI = tableList.fields();

fI.hasMoreElements();)

{

JCO.Field tabField = fI.nextField();

System.out.println(tabField.getName()

+ ":t" +

tabField.getString());

}

System.out.println("n");

}

while (tableList.nextRow() == true);

}

}

catch (Exception ex) {

ex.printStackTrace();

}

}

Accepted Solutions (0)

Answers (1)

Answers (1)

gregorw
Active Contributor
0 Kudos

Hello,

VBKD is rearly a large table. I suggest to limit the number by filling the FIELDS Table. Also there can be many entries in VBKD and so you should limit the lines by a Where statement in OPTIONS.

I think a better way are the BAPIs:

- BAPI_SALESORDER_GETLIST

- BAPISDORDER_GETDETAILEDLIST

to get the details of an Salesorder.

Regards

Gregor