慕桂英546537
java程序远程调用sap函数代码: JCoDestination destination = rfcSource.getDestination(); JCoFunction function = destination.getRepository().getFunction(funcName); JCoParameterList paramStrlist = function.getImportParameterList(); JCoParameterList paramTableList = function.getTableParameterList(); List<String> paramList = getParamList(); for (String param : paramList) { int index = param.indexOf(":{"); if(index >= 0){ String type = param.substring(0,index); if(type.toLowerCase().equals("strings")){ String typeValues = param.substring(index + 2,param.length() - 1); String[] paramArray = typeValues.split("[|]"); for (String pa : paramArray) { paramStrlist.setValue(pa, paramMap.get(pa)); } }else if(type.toLowerCase().equals("tables")){ String typeValues = param.substring(index + 2,param.length() - 1); String[] paramArray = typeValues.split("[;]"); for (String pa : paramArray) { int tabIndex = pa.indexOf(":"); if(tabIndex >= 0){ String tableName = pa.substring(0,tabIndex); String tableFields = pa.substring(tabIndex +1); // String[] tfArray = tableFields.split("[|]"); paramTableList.getTable(tableName).appendRow(); for (String tf: tfArray) { paramTableList.getTable(tableName).setValue(tf, paramMap.get(tableName+ "." + tf)); } } paramTableList.set } } } } function.execute(destination); String queryString = getQryString(); String rfcName = queryString.substring(0, queryString.indexOf(",")); String rfcParam = queryString.substring(rfcName.length() + 1); final String[] returnType = { "TABLES", "STRUCTURES", "STRINGS" }; //SAP输出类型格式