Search code examples
javaabapconnectorjco

JCo RFC_READ_TABLE Data Buffer Exceeded


i'm trying to get data from Table VBRK via Function RFC_READ_TABLE but always getting a Data Buffer Exceeded Exception.

final JCoConnection managedConnection2 = sapCoreJCoManagedConnectionFactory.getManagedConnection("JCoStateless",
        getClass().getName(), rfcDestination);

final JCoFunction function2 = managedConnection2.getFunction("RFC_READ_TABLE");

final JCoParameterList importParameterList2 = function2.getImportParameterList();

importParameterList2.setValue("QUERY_TABLE", "VBRK");
final JCoParameterList tableParameterList2 = function2.getTableParameterList();

final JCoTable optionsTable = tableParameterList2.getTable("OPTIONS");
String selectionFilter = "VBELN EQ '" + "0123456789" + "'";
optionsTable.appendRow();
optionsTable.setValue("TEXT", selectionFilter);

//execute function RFC_READ_TABLE
managedConnection2.execute(function2);

Can anybody point out my mistake?


Solution

  • You are getting this error because selected field do not fit into structure DATA i.e TAB512. Further, Function Module RFC_READ_TABLE also limits if read exceeds 512 bytes per row of data.

    You have applied OPTIONS to SELECT records but you did not limit SELECTED fields using FIELDS. If you will limit SELECTED fields then you will not face error Data Buffer Exceeded. It is also recommend to limit no of records using ROWCOUNT.