Wednesday 23 January 2019

Query to Find Scheduled Concurrent Programs

SELECT DISTINCT
     fcr.request_id
     ,fcpt.user_concurrent_program_name|| NVL2(fcr.description, ' (' || fcr.description || ')', NULL) Concurrent_program_name
     ,fu.user_name requestor
     ,fu.description requested_by
     ,fu.email_address
     ,frt.responsibility_name requested_by_resp
     ,(SELECT meaning
         FROM fnd_lookups
        WHERE lookup_type= 'CP_PHASE_CODE'
          AND lookup_code =fcr.phase_code) program_Phase
     ,(SELECT meaning
         FROM fnd_lookups
        WHERE lookup_type= 'CP_STATUS_CODE'
        AND lookup_code =fcr.status_code) program_Status
     ,fcr.argument_text program_parameters
      , TO_CHAR(fcr.request_date, 'DD-MON-YYYY HH24:MI:SS') requested
     ,TO_CHAR(fcr.requested_start_date, 'DD-MON-YYYY HH24:MI:SS') requested_start  
     ,TO_CHAR((fcr.requested_start_date), 'HH24:MI:SS') start_time
     ,DECODE(fcr.hold_flag, 'Y', 'Yes', 'N', 'No') on_hold
     ,CASE WHEN fcr.hold_flag = 'Y' THEN
          Substr( fu.description, 0 , 40)
      END last_update_by
     ,CASE WHEN fcr.hold_flag = 'Y' THEN
           fcr.last_update_date
       END last_update_date
     ,fcr.increment_dates
     ,CASE WHEN fcrc.CLASS_INFO IS NULL THEN
        'Yes: ' || TO_CHAR(fcr.requested_start_date, 'DD-MON-YYYY HH24:MI:SS')
       ELSE 'N/A'
       END RUN_ONCE
     ,CASE WHEN fcrc.class_type = 'P' THEN
        'Repeat every ' ||
        substr(fcrc.class_info, 1, instr(fcrc.class_info, ':') - 1) ||
        decode(substr(fcrc.class_info, instr(fcrc.class_info, ':', 1, 1) + 1, 1),
               'N', ' minutes',
               'M', ' months',
               'H', ' hours',
               'D', ' days') ||
        decode(substr(fcrc.class_info, instr(fcrc.class_info, ':', 1, 2) + 1, 1),
               'S', ' from the start of the prior run',
               'C', ' from the completion of the prior run')
       ELSE 'N/A'
       END set_days_of_week
     ,fcr.resubmit_interval||' '||fcr.resubmit_interval_unit_code Resubmit_Interval
     ,NVL2(fcr.resubmit_interval,'PERIODICALLY',NVL2(fcr.release_class_id, 'ON SPECIFIC DAYS','ONCE')) schedule_type
  FROM fnd_concurrent_requests fcr
      ,fnd_user fu
      ,fnd_concurrent_programs fcp
      ,fnd_concurrent_programs_tl fcpt
      ,fnd_printer_styles_tl fpst
      ,fnd_conc_release_classes fcrc
      ,fnd_responsibility_tl frt
      ,fnd_lookups fl
 WHERE 1=1
   AND fcp.application_id = fcpt.application_id
   AND fcr.requested_by = fu.user_id
   AND fcr.concurrent_program_id = fcp.concurrent_program_id
   AND fcr.program_application_id = fcp.application_id
   AND fcr.concurrent_program_id = fcpt.concurrent_program_id
   AND fcr.responsibility_id = frt.responsibility_id
   AND fcr.print_style = fpst.printer_style_name(+)
   AND fcr.release_class_id = fcrc.release_class_id(+)
   AND fcr.status_code = fl.lookup_code
   AND fl.lookup_type = 'CP_STATUS_CODE'
   AND (fcpt.user_concurrent_program_name = :P_PROGRAM_NAME OR :P_PROGRAM_NAME IS NULL)
Order By Fu.Description;

No comments:

Post a Comment