cancel
Showing results for 
Search instead for 
Did you mean: 

JCo Error importing a Table from ABAP

Former Member
0 Kudos

Hello,

I'm programming a Server using JCo.

1)

I call the function from ABAP:

      call function 'Z_ZZ_ETI_PRINT'
        destination p_rfc
        exporting
          i_lines = it_lines
        exceptions
          others  = 1.

2)

Here is the java part (the error should be here, because the other function works fine)

			if (function.getName().equals("Z_ZZ_ETI_PRINT")) {
				System.out.println("[CALL_PR01]");
				JCO.Table lines = tables.getTable("I_LINES");
				if (lines!=null) {
					System.out.println("[CALL_PR01b]");
					for (int i = 0; i < lines.getNumRows(); i++)   {
						lines.setRow(i);
						System.out.println(">"+lines.getString("TEXT") + "\n");
					}
				}				
				System.out.println("[CALL_PR02]");
			}

The variable lines is not null but the table is empty (in any case the loop has no steps).

Thank you for any hint!

Regards,

Tommaso

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member187444
Participant
0 Kudos

Try this:

JCO.Table lines = function.getTableParameterlist.getTable("I_LINES");
for(int i=0;i<lines.getNumRows();i++,lines.getNextRow()){
  	lines.setRow(i);
        System.out.println(">"+lines.getString("TEXT") + "\n");
}

lines.getNextRow() method is used to get next row in JCO

Former Member
0 Kudos

Thank you.

The problem was on ABAP site.

Regards,

Tommaso