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

PROBLEM WITH RFC_READ_TABLE

Former Member
0 Likes
523

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();

}

}

1 REPLY 1
Read only

Former Member
0 Likes
369

do u have authorization to read the std.tables of SAP.

Regards

Prabhu