Skip to Content
avatar image
Former Member

JCo Error importing a Table from ABAP

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Feb 26, 2008 at 04:45 PM

    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

    Add comment
    10|10000 characters needed characters exceeded