public JCoParameterList execute()

in code/src/main/java/Utils.java [131:229]


    public JCoParameterList execute(String exportType, HashMap<String, Object> importParameters, String rfc, String prefix, Integer frequency) throws JCoException
    {
        JCoParameterList result = null;
        JCoFunction function_read = null;
        
        System.out.println("...DataProvider"+prefix+"...");

        if (config.iteration % frequency == 0 || config.iteration == 1) { //execute every iteration/function call

            System.out.println("Executing RFC '"+rfc+"'...");

            //final JCoDestination destination = JCoDestinationManager.getDestination(config.destination_name);

            if (function_read == null) { 
                function_read = config.destination.getRepository().getFunction(rfc);
            } else {
                System.out.println("Use function definition from cache...");
            }

            if (function_read == null) {
                throw new RuntimeException("RFC '"+rfc+"' not found! Check the SAP user authorization and required SAP release!");
            }

            for (HashMap.Entry<String, Object> entry : importParameters.entrySet()) {
                String key = entry.getKey();
                Object value = entry.getValue();
                
                if(key.equals("json"))
                {
                    function_read.getImportParameterList().fromJSON(value.toString());
                    System.out.println(value);
                }
                else
                {
                    if(value instanceof HashMap)
                    {
                        HashMap<String, Object> tmpvalue = (HashMap<String, Object>) value;
                        for (HashMap.Entry<String, Object> entry1 : tmpvalue.entrySet()) {
                            String key1 = entry1.getKey();
                            Object value1 = entry1.getValue();
                            function_read.getImportParameterList().getStructure(key).setValue(key1, value1);
                            
                            if(value1 instanceof java.util.Date)
                            {
                                SimpleDateFormat de_formatter = new SimpleDateFormat("dd.MM.yyyy");
                                value1 = de_formatter.format(value1);
                            }
                            
                            System.out.println("-> "+key+"/"+key1+": "+value1);
                        }
                    }
                    else
                    {
                        function_read.getImportParameterList().setValue(key, value);
                    
                        if(value instanceof java.util.Date)
                        {
                            SimpleDateFormat de_formatter = new SimpleDateFormat("dd.MM.yyyy");
                            value = de_formatter.format(value);
                        }
                        
                        System.out.println("-> "+key+": "+value);
                    }
                }
            }
            
            if(config.debug)
            System.out.println(function_read.getImportParameterList());

            final long startTime = System.currentTimeMillis();
            try {
                function_read.execute(config.destination);
            } catch (final AbapException e) {
                System.out.println(e.toString());
                throw new RuntimeException("Connection lost: " + e.toString());
            }

            final long stopTime = System.currentTimeMillis();
            final long elapsedTime = stopTime - startTime;
            System.out.println("PING: " + elapsedTime + " ms");

            System.out.println("RFC '"+rfc+"' finished!");
            
            if(exportType.equals("TABLE"))
                result = function_read.getTableParameterList();
            else
                result = function_read.getExportParameterList();
            
            if(config.debug)
            System.out.println(result.toXML());
            
        }
        else
        {
            System.out.println("Skipping - Run only every " + frequency + "th iteration!");
        }
        
        return result;
    }