Skip to Content
0
Former Member
Jun 04, 2008 at 10:41 AM

filter fields using RFC_read_table to avoid data_buffer_exceeded exception

48 Views

Hi,

how do i filter the fields returned using function RFC_read_table to avoid the exception data_buffer_exceeded

i'm trying to read data from the but000 table.

this is my code:

otherwise pasted below: [http://pastebin.com/f458665a9|http://pastebin.com/f458665a9]

import com.sap.mw.jco.*;

public class JcoTest {

private static JCO.Client theConnection;

private static IRepository theRepository;

//JCO.Table fieldData = null;

public static void main(String[] args) {

createConnection();

retrieveRepository();

try {

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

JCO.ParameterList listParams = function.getImportParameterList();

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

//listParams.setValue("|","DELIMITER");

theConnection.execute(function);

//fieldData = function.getTableParameterList().getTable("FIELDS");

//

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();

}

}

private static void createConnection() {

try {

theConnection = JCO.createClient("000", "DDIC", "minisap", "en", "sincgo", "00");

theConnection.connect();

}

catch (Exception ex) {

System.out.println("Failed to connect to SAP system");

}

}

private static void retrieveRepository() {

try {

theRepository = new JCO.Repository("saprep", theConnection);

}

catch (Exception ex)

{

System.out.println("failed to retrieve repository");

}

}

public static JCO.Function getFunction(String name) {

try {

return theRepository.getFunctionTemplate(name.toUpperCase()).getFunction();

}

catch (Exception ex) {

ex.printStackTrace();

}

return null;

}

}

thanks .