2008 Jun 04 11:38 AM
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 .
2008 Jun 04 4:45 PM
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.
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 .
2008 Jun 04 4:45 PM
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.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |