title: JCO_CONVERTION_ERROR (122) Table to StructureRecord type
body: <p>I use SAPJCo3.jar for java to sap connection and communication but when execute the program, get error at JcoStructure part.Debugger pass successfully to function module connection part I see at debugger but in this line I get interesting error :</p>
  
  <pre><code>JCoStructure returnStructure = function.getExportParameterList().getStructure("ET_CUSTOMERS");
  </code></pre>
  
  <p>and i get this exeption when run to the program : </p>
  
  <pre><code>Exception in thread "main" com.sap.conn.jco.ConversionException: (122) JCO_ERROR_CONVERSION: Cannot convert field ET_CUSTOMERS of type TABLE to StructureRecord
  at com.sap.conn.jco.rt.AbstractRecord.createConversionException(AbstractRecord.java:416)
  at com.sap.conn.jco.rt.AbstractRecord.createConversionException(AbstractRecord.java:411)
  at com.sap.conn.jco.rt.AbstractRecord.getStructure(AbstractRecord.java:2585)
  at com.sap.conn.jco.rt.AbstractRecord.getStructure(AbstractRecord.java:3060)
  at com.sap.conn.jco.rt.AbstractRecord.getStructure(AbstractRecord.java:53)
  at SAP.GetCustomers.step4WorkWithTable(GetCustomers.java:100)
  at SAP.Main.main(Main.java:13)
  </code></pre>
  
  <p>that is the complete code of my function :</p>
  
  <pre><code>public static void step4WorkWithTable() throws JCoException
      {
          JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME2);
          JCoFunction function = destination.getRepository().getFunction("Z_SYCLO1_GET_CUSTOMERS");
          if(function == null)
              throw new RuntimeException("Z_SYCLO1_GET_CUSTOMERS not found in SAP.");
  
  
          JCoStructure returnStructure = function.getExportParameterList().getStructure("ET_CUSTOMERS");
          if (! (returnStructure.getString("TYPE").equals("")||returnStructure.getString("TYPE").equals("S"))) 
          {
             throw new RuntimeException(returnStructure.getString("MESSAGE"));
          }
  
          JCoTable codes = function.getTableParameterList().getTable("Z_SYCLO1_CUSTOMERS_LIST_TT");
          for (int i = 0; i &lt; codes.getNumRows(); i++) 
          {
              codes.setRow(i);
              System.out.println(codes.getString("KUNNR") + '\t' + 
                                 codes.getString("NAME1") + '\t' + 
                                 codes.getString("NAME2") + '\t' + 
                                 codes.getString("TELF1") + '\t' + 
                                 codes.getString("STRAS") + '\t' + 
                                 codes.getString("ORT01") + '\t' + 
                                 codes.getString("REGIO") + '\t' + 
                                 codes.getString("PSTLZ") + '\t' + 
                                 codes.getString("LAND1"));
          }
  
  
          codes.firstRow();
          for (int i = 0; i &lt; codes.getNumRows(); i++, codes.nextRow()) 
          {
              function = destination.getRepository().getFunction("Z_SYCLO1_GET_CUSTOMERS");
              if (function == null) 
                  throw new RuntimeException("Z_SYCLO1_GET_CUSTOMERS not found in SAP.");
              function.getImportParameterList().setValue("IV_USERNAME", codes.getString("UOZKER"));
  
              function.getExportParameterList().setActive("ET_CUSTOMERS",false);
  
              try
              {
                  function.execute(destination);
              }
              catch (AbapException e)
              {
                  System.out.println(e.toString());
                  return;
              }
  
              returnStructure = function.getExportParameterList().getStructure("ET_CUSTOMERS");
              if (! (returnStructure.getString("TYPE").equals("") ||
                     returnStructure.getString("TYPE").equals("S") ||
                     returnStructure.getString("TYPE").equals("W")) ) 
              {
                  throw new RuntimeException(returnStructure.getString("MESSAGE"));
              }
  
              JCoStructure detail = function.getExportParameterList().getStructure("ET_CUSTOMERS");
  
              System.out.println(codes.getString("KUNNR") + '\t' + 
                     codes.getString("NAME1") + '\t' + 
                     codes.getString("NAME2") + '\t' + 
                     codes.getString("TELF1") + '\t' + 
                     codes.getString("STRAS") + '\t' + 
                     codes.getString("ORT01") + '\t' + 
                     codes.getString("REGIO") + '\t' + 
                     codes.getString("PSTLZ") + '\t' + 
                     codes.getString("LAND1"));
          }
  </code></pre>