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

filter fields using RFC_read_table to avoid data_buffer_exceeded exception

Former Member
0 Likes
774

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 .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
560

Hi,

instead of using the unsuported FM RFC_READ_TABLE you could use the BAPI's for the business partners, e.g. BAPI_BUPA_SEARCH to get a list of business partners, you will need to fill at least one search criterium though. Then with the different GET BAPI's you can get the data you need.

I have played with RFC_READ_TABLE a long time ago and I can remember that it was quite tricky (if not impossible) to get the selection to work properly. In the end we build our own tailored RFC's.

Good luck,

Gert.

1 REPLY 1
Read only

Former Member
0 Likes
561

Hi,

instead of using the unsuported FM RFC_READ_TABLE you could use the BAPI's for the business partners, e.g. BAPI_BUPA_SEARCH to get a list of business partners, you will need to fill at least one search criterium though. Then with the different GET BAPI's you can get the data you need.

I have played with RFC_READ_TABLE a long time ago and I can remember that it was quite tricky (if not impossible) to get the selection to work properly. In the end we build our own tailored RFC's.

Good luck,

Gert.