public void startSMONJob()

in code/src/main/java/DataProviderSMON.java [191:284]


    public void startSMONJob() throws JCoException
    {
        System.out.println("Executing RFC '/SDF/SMON_ANALYSIS_START'...");

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

        if (function_start == null) {
            function_start = destination.getRepository().getFunction("/SDF/SMON_ANALYSIS_START");
        } else {
            System.out.println("Use function definition from cache...");
        }

        if (function_get == null) {
            throw new RuntimeException("RFC '/SDF/SMON_ANALYSIS_START' not found! Check the SAP user authorization and required SAP release (ST-PI >= SP08)!");
        }

        java.text.Format formatter = new SimpleDateFormat("HH:mm:ss");
        String start_time = formatter.format(config.system_date);
        String end_time = "23:59:59";

        SimpleDateFormat de_formatter = new SimpleDateFormat("dd.MM.yyyy");
        System.out.println("-> DATUM: " + de_formatter.format(config.system_date));
        System.out.println("-> ST_DAT: " + de_formatter.format(config.system_date));
        System.out.println("-> ENDDAT: " + de_formatter.format(config.system_date));
        System.out.println("-> ST_TIM: " + start_time);
        System.out.println("-> ENDTIM: " + end_time);

        //START IMPORT PARAMETERS
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("DESCRIPTION", config.sdfmon_name);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("DATUM", config.system_date);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("ST_DAT", config.system_date);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("ENDDAT", config.system_date);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("ST_TIM", start_time);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("ENDTIM", end_time);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("FREQU", 30);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("FREQU_DB", 1);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("SM50", "X");
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("SM50_CT", 1);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("ST06", "X");
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("ST06_CT", 2);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("ST02", "X");
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("ST02_CT", 1);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("QUEUE", "X");
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("QUEUE_CT", 1);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("USERS", "X");
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("USERS_CT", 1);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("SM12", "X");
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("SM12_CT", 10);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("TRANSPARENT", "X");
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("UNAME", config.username);

        final Calendar cal = Calendar.getInstance();
        cal.setTime(config.system_date);
        cal.add(Calendar.DAY_OF_WEEK, 7);
        function_start.getImportParameterList().getStructure("ANALYSIS").setValue("KEEP_UNTIL", cal.getTime());
        //END IMPORT PARAMETERS

        try {
            function_start.execute(destination);
        } catch (final AbapException e) {
            System.out.println(e.toString());
            return;
        }

        System.out.println("RFC '/SDF/SMON_ANALYSIS_START' finished!");

        final JCoParameterList result = function_start.getExportParameterList();

        if(config.debug)
        System.out.println(result.toXML());

        java.util.Date mytime = null;
        try {
            mytime = new SimpleDateFormat("HH:mm:ss").parse("23:59:59"); 
        } catch (Exception e) {
            System.out.println(e);
        }

        config.guid = result.getString("GUID");
        config.guid_validity = Utils.copyTimeToDate(config.system_date, mytime);

        System.out.println("/SDF/SMON scheduled with guid " + config.guid + " validity " + config.guid_validity);

        if (config.iteration == 1) {

            try {
                System.out.println("Sleeping 5s until collector has started...");
                Thread.sleep(5000);
            } catch (InterruptedException ex) {
                Thread.currentThread().interrupt();
            }
            getSMONJob();
        }
    }