Hi all,
while executing below code I got this error;
ERROR;
com.sap.mw.jco.JCO$Exception: (127) JCO_ERROR_FIELD_NOT_FOUND: Field EBELN not a member of RFC_DB_FLD
at com.sap.mw.jco.JCO$MetaData.indexOf(Unknown Source)
at com.sap.mw.jco.JCO$MetaData.getDescription(Unknown Source)
at Test6.<init>(Test6.java:33)
at Test6.main(Test6.java:62)
Exception in thread "main"
FOLLOWING CODE;
import java.util.ArrayList;
import com.sap.mw.jco.*;
import com.sap.mw.jco.JCO.Field;
import com.sap.mw.jco.JCO.Record;
public class Test6 {
JCO.Client mConnection;
JCO.Repository mRepository;
IFunctionTemplate ftemplate;
public Test6() {
try {
mConnection =JCO.createClient("800","sapuser","sapuser","en","10.113.10.201","00");
mConnection.connect();
System.out.println("connection attribute:"+ mConnection.getAttributes());
if (mConnection == null) {
System.out.println("Connection to SAP Server failed.");
}
mRepository = new JCO.Repository("User", mConnection);
ftemplate = mRepository.getFunctionTemplate("RFC_READ_TABLE");
}
catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
}
JCO.Function function = ftemplate.getFunction();
JCO.ParameterList importParamList = function.getImportParameterList();
importParamList.setValue("EKKO", "QUERY_TABLE");//For Purchase Order
importParamList.setValue(",", "DELIMITER");
JCO.Table tableData = function.getTableParameterList().getTable("DATA");
System.out.println(""+tableData);
JCO.Table fields = function.getTableParameterList().getTable("FIELDS");
System.out.println(""+fields);
String sg =fields.getDescription("EBELN");
System.out.println("...."+sg);
mConnection.execute(function);
if (tableData.getNumRows() > 0) {
do {
System.out.println("Purchase Order Details::");
for (JCO.FieldIterator e = tableData.fields();e.hasMoreElements();) {
JCO.Field field = e.nextField();
String str = field.getString();
String[] values = str.split(",");
for (int j = 0; j < values.length; j++) {
System.out.println("\t"+values[j].trim());
}
}
} while (tableData.nextRow());
}
else
System.out.println("No results found");
mConnection.disconnect();
}
public static void main (String args[]) {
Test6 app = new Test6();
}
}
please suggest suitable code.....
Thanks in advance.....
Ramesh
Hi,
This line produces the error:
String sg =fields.getDescription("EBELN");
I would delete (comment out) these lines:
String sg =fields.getDescription("EBELN");
System.out.println("...."+sg);
Good luck, Roelof
PS what strange subject!?
Add a comment