0

I am re-writing my JCo2 code to JCo3 code to run on a 64 bit Windows server. When I try to read my SAP table with the JCo3 code it is returning an empty table. However when I run the JCo2 code I have 2 records in the table.

The result is records = 0. When I run the JCo2 code on the same table the result is records = 2.

Please tell me what I am missing.

Here is a snippet of my JCo3 code:

System.out.print("after try");
try {
    ABAP_AS2 = JCoDestinationManager.getDestination(ABAP_MS);
} catch (Exception e) {
    ABAP_AS2 = null;
    System.out.print("ABAP_AS2 = null");
}
ABAP_AS2.ping();
JCoFunction function = ABAP_AS2.getRepository().getFunction("ZPC_RFC_READ_QMLN");
function.execute(ABAP_AS2);
System.out.println("STFC_CONNECTION finished:");
JCoTable return_table = function.getTableParameterList().getTable("DATA");   
Sytem.out.println("get table");
int records = return_table.getRow();
System.out.println(records);
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48

1 Answers1

1

Apparently you haven’t read the API documentation:

`int getRow()`
Returns the current row number. The first row number is 0, the second is 1, and so on.

You probably want to switch to getNumRows().

vwegert
  • 18,371
  • 3
  • 37
  • 55
  • Thank you. So I changed the code to getNumRows() and I still get records = 0. When I try to execute the code: for (int i = 0; i < return_table.getNumRows(); i++) - (which comes directly from the API documentation) it doesn't enter the loop. Any other ideas? – user3654038 May 21 '14 at 20:38
  • Have you used the remote debugging facility to find out whether the function module recieves and returns the correct values in the first place? – vwegert May 22 '14 at 07:08
  • I don't know your RFC. Are there any import parameters you should have set? Something like `function.getImportParameterList().setValue("DATUM_VON", datum_von);` Or is there any return code you can check? `String rc = function.getExportParameterList().getString("RETURNCODE");` – rawdog Jun 13 '14 at 13:50
  • Thank you all for the comments. It seems my problems was with the install of the JCO on the server. :( My code was not the problem. – user3654038 Jun 18 '14 at 13:53