‎2007 Jan 05 6:21 AM
Hi All,
While executing the following code by passing 'EKKO' table I got ''No results found'' error. In the same code by passing 'ZSTU' table(Userdefined) I am getting data.
please any one suggest me the correct code.
Regards,
RAJESH.
import com.sap.mw.jco.*;
public class Test3 {
JCO.Client mConnection;
JCO.Repository mRepository;
IFunctionTemplate ftemplate;
public Test3() {
try {
mConnection =
JCO.createClient("800","sapuser","sapuser","en","10.113.10.201","00");
mConnection.connect();
System.out.println(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");
importParamList.setValue("$", "DELIMITER");
importParamList.setValue("x", "NO_DATA");
JCO.Table tableData = function.getTableParameterList().getTable("DATA");
JCO.Table fields = function.getTableParameterList().getTable("FIELDS");
mConnection.execute(function);
System.out.println("fields:----"+ tableData.fields().hasNextFields());
System.out.println("GET VALUES:----"+tableData.getNumRows());
if (tableData.getNumRows() > 0) {
do {
for (JCO.FieldIterator e = tableData.fields(); e
.hasMoreElements();) {
JCO.Field field = e.nextField();
String str = field.getString();
String[] values = str.split(";");
for(int i = 0; i < values.length; i++){
System.out.println(" VALUES:----"+values);
}
}
} while (tableData.nextRow());
} else {
System.out.println("No results found");
}
mConnection.disconnect();
}
public static void main (String args[]) {
Test3 app = new Test3();
}
}
‎2007 Jan 05 6:32 AM
do u have authorization to read the std.tables of SAP.
Regards
Prabhu