cancel
Showing results for 
Search instead for 
Did you mean: 

filter fields using RFC_read_table to avoid data_buffer_exceeded exception

Former Member
0 Kudos

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;

}

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Shilpi,

to avoid the exception data_buffer_exceeded you can :

1. Use the import parameter ROWCOUNT to reduce the number of row to read.

2. Use the table OPTIONS to reduce the result. Add a row in this table for a condition for example :

UNAME EQ 'HELLO'

3. Use the table FIELDS to give the fields returned that you need.

add a row and give the FIELDNAME, OFFSET AND LENGTH.

Then execute the query.

I hope it will help you.

Best regards,

Mathieu

PS : reward points if helpful.