REM RMINC_concmgrerrors.sql
REM
REM Copyright 2000, All Rights Reserved, Reed-Matthews, Inc.
REM
REM Concurrent Requests That Errored or Terminated (RMINC)
REM Tells you requests that errored out AND requests that were 
REM terminated
REM
REM &1 days of history to go back
REM &2 user who ran this report (optional)
set pagesize 999
set wrap on
set heading on
column FAILED     format a17 heading 'Failed At'
column REQUEST    format 999999999999999 heading 'Request'
column PROGRAM    format a53 heading 'Program Name'
column REQUESTOR  format a15 heading 'Requested By'
column PARENT     format 999999999999999 heading 'Parent ID'
column MESSAGE    format a240 heading 'Error Message'
ttitle center 'Requests That Errored Out' SKIP 2 

SELECT to_char(actual_completion_date,'MON-DD-YY HH24:MI') FAILED,
       request_id REQUEST,
       substr(program,1,53) PROGRAM,
       substr(requestor,1,15) REQUESTOR, 
       parent_request_id PARENT,
       completion_text MESSAGE
FROM   FND_CONC_REQ_SUMMARY_V 
WHERE  STATUS_CODE = 'E' 
AND    ((DECODE(IMPLICIT_CODE, 'N', STATUS_CODE,'E', 'E', 'W', 'G') = STATUS_CODE 
OR     DECODE(IMPLICIT_CODE, 'W', 'E') = STATUS_CODE)) 
and    actual_completion_date > sysdate - &1
and    requestor like ('%&2%')
order by REQUEST_ID DESC;

REM concmgrtermd.sql
REM
REM Tells you requests that were terminated
REM
REM &1 days of history to go back
REM &2 user who ran this report (optional)
column TERMINATED     format a17 heading 'Terminated'
column REQUEST    format 999999999999999 heading 'Request'
column PROGRAM    format a53 heading 'Program Name'
column REQUESTOR  format a15 heading 'Requested By'
column PARENT     format 999999999999999 heading 'Parent ID'
column MESSAGE    format a240 heading 'Error Message'
ttitle center 'Requests That Were Terminated' SKIP 2 

SELECT to_char(actual_completion_date,'MON-DD-YY HH24:MI') TERMINATED,
       request_id REQUEST,
       substr(program,1,53) PROGRAM,
       substr(requestor,1,15) REQUESTOR, 
       parent_request_id PARENT,
       completion_text MESSAGE
FROM   FND_CONC_REQ_SUMMARY_V 
WHERE  STATUS_CODE = 'X' 
and    actual_completion_date > sysdate - &1
and    requestor like ('%&2%')
order by REQUEST_ID DESC;
