有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

在或多个运营商SAP Java中

我正在使用JCO、SAP util为以下代码创建一个查询,例如:

public static void TEST() throws JCoException {
            JCoDestination destination;
            JCoRepository sapRepository;

            destination = JCoDestinationManager.getDestination(ABAP_AS);
            JCoDestinationManager.getDestination(ABAP_AS);
            System.out.println("Attributes:");
            System.out.println(destination.getAttributes());
            System.out.println();

            try {
                JCoContext.begin(destination);
                sapRepository = destination.getRepository();

                if (sapRepository == null) {
                    System.out.println("Couldn't get repository!");
                    System.exit(0);
                } 
                JCoFunctionTemplate functionTemplate = sapRepository.getFunctionTemplate("EM_GET_NUMBER_OF_ENTRIES");
                JCoFunction function =  functionTemplate.getFunction();
                JCoTable itTable = function.getTableParameterList().getTable("IT_TABLES");
                itTable.appendRow();

                itTable.setValue("TABNAME", "USR02");
//              JCoTable returnOptions_ = function.getTableParameterList().getTable("OPTIONS");
//              returnOptions_.appendRow();
////                //returnOptions.setValue("TEXT", "MODDA GE '20140908' AND MODTI GT '000000'");
//              returnOptions_.setValue("TEXT", "BNAME EQ 'USER'");
                function.execute(destination);
                System.out.println( function.getTableParameterList().getTable("IT_TABLES").getInt("TABROWS"));
                JCoFunctionTemplate template2 = sapRepository.getFunctionTemplate("RFC_READ_TABLE");
                System.out.println("Getting template");
                JCoFunction function2 = template2.getFunction();
                function2.getImportParameterList().setValue("QUERY_TABLE", "USR02");
                function2.getImportParameterList().setValue("DELIMITER", ",");
                function2.getImportParameterList().setValue( "ROWCOUNT",5);
                function2.getImportParameterList().setValue( "ROWSKIPS",5);



                System.out.println("Setting OPTIONS");
//              Date date = new Date(1410152400000L);
                SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
//              String dateString = formatter.format(date);

//              String dt = dateString.substring(0, 8);
//              String tm = dateString.substring(8);
//              System.out.println("dt > " + dt + ", tm > " + tm);

                JCoTable returnOptions = function2.getTableParameterList().getTable("OPTIONS");
                returnOptions.appendRow();
                //returnOptions.setValue("TEXT", "MODDA GE '20140908' AND MODTI GT '000000'");
                returnOptions.setValue("TEXT", "BNAME LIKE 'S%'");

//              returnOptions.appendRow();
//              returnOptions.setValue("TEXT", "AND TYPE = 'DN'");

                System.out.println("Setting FIELDS");
                JCoTable returnFields = function2.getTableParameterList().getTable("FIELDS");
                returnFields.appendRow();
                returnFields.setValue("FIELDNAME", "BNAME");
                returnFields.appendRow();
                returnFields.setValue("FIELDNAME", "GLTGB");
                returnFields.appendRow();
                returnFields.setValue("FIELDNAME", "CLASS");
//              returnFields.appendRow();
                function2.execute(destination);

//              JCoTable jcoTablef = function2.getTableParameterList().getTable("FIELDS");
                JCoTable jcoTabled = function2.getTableParameterList().getTable("DATA");

                int icodeOffSet = 0;
                int icodeLength = 0;


                int numRows = jcoTabled.getNumRows();
                System.out.println("numRows > " + numRows);
                for(int i=0; i<numRows; i++) {
                    jcoTabled.setRow(i);
                    System.out.println(jcoTabled.getRow());
                    String BNAME = "BNAE:" +  jcoTabled.getString(0);
//                  String GLTGB = "GLTGB:" + jcoTabled.getString(2);
//                  String cls = "GLTGB:" + jcoTabled.getString(3);
                    System.out.println(BNAME + "..." );
                }

            } catch (Exception e) {
                e.printStackTrace();
                System.out.println("ERROR: " + e.getMessage());   
            } finally {
                JCoContext.end(destination);
            }
        }
        static void createDestinationDataFile(String destinationName, Properties connectProperties)
        {
            File destCfg = new File(destinationName+".jcoDestination");
            try
            {
                FileOutputStream fos = new FileOutputStream(destCfg, false);
                connectProperties.store(fos, "for tests only !");
                fos.close();
            }
            catch (Exception e)
            {
                throw new RuntimeException("Unable to create the destination files", e);
            }
        }

当我使用EQ运算符时,前面的代码运行良好。 然而,当我使用IN运算符时:

BNAME IN ('USER1','USER','USER3')

或者

BNAME EQ 'USER1' OR BNAME EQ 'USER' OR BNAME EQ 'USER3'

它抛出一个异常:Unexpected dynamic condition

条件大小是否有任何限制?因为我在in条件中有22个字段,每个值的大小都是10


共 (1) 个答案