Anda di halaman 1dari 10

Oracle Applications: Submitting Concurrent Request Using

FND_CONCURRENT.WAIT_FOR_REQUEST Sample Code


Posted by Jiltin 15 May, 2009 15,154 views
• Oracle Applications: The Concurrent Jobs Ran Yesterday and Failed – SQL script & Unix
Shell Script
• Pending normal jobs running (oracle 11i) in oracle applications
• Oracle applications – List all the concurrent Jobs ran by user.
• How to run a unix host command from oracle plsql package?
• Oracle Applications Concurrent Requests and Concurrent processing.
When submitting concurrent requests using PL/SQL, it is often desired to have
the parent process wait until all the child processes have completed before
completing itself. The following describes the function used to accomplish this.
Refer Metalink 1021956.6: The following describes how to submit concurrent requests using
PL/SQL and have the parent request ‘wait’ until each of the child processes have completed
before it completes.

Use the FND_CONCURRENT.WAIT_FOR_REQUEST function documented in the Oracle


Applications Developer’s Guide, RELEASE 11i, Page 21-8 See the
FND_CONCURRENT.WAIT_FOR_REQUEST function description.
Summary
<strong>FUNCTION FND_CONCURRENT.WAIT_FOR_REQUEST</strong>

(request_id IN number DEFAULT NULL,


interval IN number DEFAULT 60,
max_wait IN number DEFAULT 0,
phase OUT varchar2,
STATUS OUT varchar2,
dev_phase OUT varchar2,
dev_status OUT varchar2,
message OUT varchar2) RETURN BOOLEAN;

Description
Wait for the request completion, then return the request phase/status and
completion message to the caller. Also call sleep between database checks.
Arguments (input)

request_id
The request ID of the program to wait on.
interval
Time to wait between checks. This is the number of seconds to sleep.
The default is 60 seconds.
max_wait
The maximum time in seconds to wait for the requests completion.
Arguments (output)

phase
The user friendly request phase from FND_LOOKUPS.
status
The user friendly request status from FND_LOOKUPS.
dev_phase
The request phase as a constant string that can be used for program
logic comparisons.
dev_status
The request status as a constant string that can be used for program
logic comparisons.
message
The completion message supplied if the request has completed.
BEGIN
l_request_id :=
fnd_request.submit_request (‘XXCUS’,
‘XXCUSSPOOL’,
NULL,
NULL,
FALSE,
p_filename_i,
p_seq_i
);
END;
p_request_id_o := l_request_id;

fnd_file.put_line (fnd_file.LOG,‘XXCUSSPOOL Submitted.


Request_id=’”p_request_id_o”‘ Filename=’”p_filename_i”‘ Seq=’”p_seq_i );
IF p_request_id_o =0
THEN
ec_log_debug (p_filename_i,‘SUBMIT_FILE_CREATION’,4090, ‘XXCUSSPOOL
submission failed for ‘”p_filename_i”‘Request_id=’”p_request_id_o );
ELSE
l_return :=
fnd_concurrent.wait_for_request (request_id => p_request_id_o,
INTERVAL => 10,
max_wait => 300, – Null means wait forever, I normally
provide 300 = 5 mins
phase => l_phase,
STATUS => l_status,
dev_phase => l_dev_phase,
dev_status => l_dev_status,
MESSAGE => l_message
);
END IF;

Oracle applications – List all the concurrent Jobs ran by user.

Author: Jay
Substitute &user or pass as parameter
******************/
SELECT
fcr.REQUEST_ID,
FU.USER_NAME,
fcr.PHASE_CODE,
fcr.STATUS_CODE,
(fcr.ACTUAL_COMPLETION_DATE –
fcr.ACTUAL_START_DATE) * 24* 60 TIME_MINS,
fcpt.USER_CONCURRENT_PROGRAM_NAME,
fcp.CONCURRENT_PROGRAM_NAME,
fcr.ACTUAL_START_DATE,
fcr.ACTUAL_COMPLETION_DATE,
fcp.CONCURRENT_PROGRAM_NAME
FROM
apps.FND_CONCURRENT_REQUESTS FCR,
apps.FND_CONCURRENT_PROGRAMS FCP,
apps.FND_CONCURRENT_PROGRAMS_TL FCPT,
apps.FND_USER FU
WHERE 1=1
AND FCP.CONCURRENT_PROGRAM_ID=FCR.CONCURRENT_PROGRAM_ID
AND FCPT.CONCURRENT_PROGRAM_ID=FCP.CONCURRENT_PROGRAM_ID
AND FCR.REQUESTED_BY = FU.USER_ID
AND FU.USER_NAME = ‘&user’
ORDER BY FCR.REQUEST_ID DESC;

Oracle Applications Concurrent Requests and Concurrent


processing.
Posted by Jiltin 16 March, 2009 21,061 views
• Pending normal jobs running (oracle 11i) in oracle applications
• Oracle applications – List all the concurrent Jobs ran by user.
• Oracle Applications: The Concurrent Jobs Ran Yesterday and Failed – SQL script & Unix
Shell Script
• Oracle Applications: Submitting Concurrent Request Using
FND_CONCURRENT.WAIT_FOR_REQUEST Sample Code
• Oracle Applications – How to register Forms or Reports?
The Concurrent Requests window displays a phase and status summary for each concurrent
request listed

A concurrent request has a life cycle consisting of the following phases: pending, running,
completed, and inactive.
During each phase, a concurrent request has a specific condition or status. lists each
phase/status combination and describes its meaning in relation to a request.
If a request is pending, you can determine when it will start by using the Concurrent
Managers For the Request window from the Requests window to review the request’s
position in the queues of current managers that can run that request.

The database tables that are affected by running the Purge Concurrent Request and/or
Manager Data program are:

FND_CONCURRENT_REQUESTS
This table contains a complete history of all concurrent requests.
FND_RUN_REQUESTS
When a user submits a report set, this table stores information about the reports in the
report set and the parameter values for each report.
FND_CONC_REQUEST_ARGUMENTS
This table records arguments passed by the concurrent manager to each program it starts
running.
FND_DUAL
This table records when requests do not update database tables.
FND_CONCURRENT_PROCESSES
This table records information about Oracle Applications and operating system processes.
FND_CONC_STAT_LIST
This table collects runtime performance statistics for concurrent requests.
FND_CONC_STAT_SUMMARY
This table contains the concurrent program performance statistics generated by the Purge
Concurrent Request and/or Manager Data program. The Purge Concurrent Request and/or
Manager Data program uses the data in FND_CONC_STAT_LIST to compute these
statistics.
Phase Status Description
PENDING Normal Request is waiting for the next available manager
Program to run request is incompatible with other program(s) currently
Standby running
Scheduled Request is scheduled to start at a future time or date.
A child request is waiting for its Parent request to mark it ready to run.
For example, a request in a request set that runs sequentially must wait
Waiting for a prior request to complete
RUNNING Normal Request is running normally
Parent request pauses for all its child requests to finish running. For
Paused example, a request set pauses for all requests in the set to complete.
All requests submitted by the same parent request have completed
Resuming running. The Parent request resumes running.
Request is terminated by choosing the Cancel Request button in Requests
Terminating window
COMPLETEDNormal Request completed successfully.
Error Request failed to complete successfully
Request completed with warnings. For example, a request is generated
Warning successfully but fails to print
Pending or Inactive request is cancelled by choosing the Cancel Request
Cancelled button in the Requests window.
Request is terminated by choosing the Cancel Request button in the
Terminated Requests window.
Inactive Disabled Program to run request is not enabled. Contact your system administrator.
Pending request is placed on hold by choosing the Hold Request button
On Hold in the Requests window.
No manager is defined to run the request. Check with your system
No administrator. A status of No Manager is also given when all managers
Manager are locked by run-alone requests.
Oracle Concurrent query slow, what happened?
You have to have request_id in where clause with request_id > :id so that it uses index and runs faster.
There may be other issues involved with slow performance, but I find this one is common.

List the responsibilities that can run a given concurrent


program
Posted by Jiltin 12 March, 2008 1,130 views
• Oracle applications – List all the concurrent Jobs ran by user.
• Pending normal jobs running (oracle 11i) in oracle applications
• Oracle Applications: The Concurrent Jobs Ran Yesterday and Failed – SQL script & Unix
Shell Script
• Oracle Applications – How to register Forms or Reports?
• List Reponsibilities for an user
————————————————————————-
— Author : Jay Gopal
————————————————————————-
SELECT fr.responsibility_name RN ,fcpt.user_concurrent_program_name
FROM fnd_request_groups frg,
fnd_request_group_units frgu,
fnd_concurrent_programs fcp,
fnd_concurrent_programs_tl fcpt,
fnd_responsibility_vl fr
WHERE frgu.request_unit_type = ‘P’
and UPPER(fcpt.user_concurrent_program_name) = UPPER(’Journal Entries
Report’)
AND frgu.request_group_id = frg.request_group_id
AND frgu.request_unit_id = fcp.concurrent_program_id
AND fr.request_group_id = frg.request_group_id
AND fcp.CONCURRENT_PROGRAM_ID = fcpt.CONCURRENT_PROGRAM_ID
ORDER BY 1

Pending normal jobs running (oracle 11i) in oracle applications


Posted by Jiltin 10 November, 2008 2,168 views
• Oracle applications – List all the concurrent Jobs ran by user.
• Oracle Applications: The Concurrent Jobs Ran Yesterday and Failed – SQL script & Unix Shell
Script
• Oracle Applications Concurrent Requests and Concurrent processing.
• Oracle Applications: Submitting Concurrent Request Using
FND_CONCURRENT.WAIT_FOR_REQUEST Sample Code
• List the responsibilities that can run a given concurrent program
/*
Description: This script will all the pending normal jobs running (oracle 11i) in oracle
applications
Backend query is always faster than front end query
Author: Jay Gopal / Jiltin
Input: none
*/
Download the Code
SELECT
fcr.REQUEST_ID,
fu.user_name,
fcr.PHASE_CODE,
fcr.STATUS_CODE,
(fcr.ACTUAL_COMPLETION_DATE – fcr.ACTUAL_START_DATE) * 24 * 60 TIME_MINS,
fcpt.USER_CONCURRENT_PROGRAM_NAME,
fcp.CONCURRENT_PROGRAM_NAME,
fcr.ACTUAL_START_DATE,
fcr.ACTUAL_COMPLETION_DATE,
fcp.CONCURRENT_PROGRAM_NAME
FROM
apps.FND_CONCURRENT_REQUESTS FCR,
apps.FND_CONCURRENT_PROGRAMS FCP,
apps.FND_CONCURRENT_PROGRAMS_TL FCPT,
apps.FND_USER FU
WHERE 1=1
AND fcr.PHASE_CODE = ‘P’ — Pending
AND fcr.STATUS_CODE = ‘I’ — Normal
AND fcp.CONCURRENT_PROGRAM_ID=fcr.CONCURRENT_PROGRAM_ID
AND fcpt.CONCURRENT_PROGRAM_ID=fcp.CONCURRENT_PROGRAM_ID
AND FCR.REQUESTED_BY = FU.USER_ID
ORDER BY fcr.request_id DESC;
Oracle Applications: Key Flex Field Structures & How to
Retrieve Information.
Posted by Jiltin 18 May, 2009 15,167 views
• Oracle Applications : Descriptive Flexfields Overview and the SQL to find the Columns & Details.
• Oracle applications – What is a FlexField ? What are Descriptive and Key Flexfields ?
• Oracle applications – List of Key flex fields and the tables associated with it.
• What is FNDLOAD and how to use it?
• Oracle Applications: What is AutoAccounting?
Here is some of quite commonly used AOL FND ( Foundation) tables and their
usage. There are many other tables also in FND but here i am putting only few
commonly used tables. for other table if needed we can dig further.
FND_ID_FLEXS stores registration information about key flexfields. Each row includes the
four–character code that identifies the key flexfield, the title of the flexfield (by which a user
identifies theflexfield), the name of the combinations table that contains the key flexfield
columns, and the name of the structure defining (MultiFlex) column for the flexfield
(SET_DEFINING_COLUMN_NAME). Each row also contains values that identify the
application that owns the combination table and the application that owns the key flexfield, a
table–type flag that specifies whether the combinations table is specificor generic (S or G),
whether dynamic inserts are feasible for the flexfield(Y or N), whether the key flexfield can use ID
type value sets, and the name of the unique ID column in the combinations table. You need one
row for each key flexfield in each application. Oracle Application ObjectLibrary uses this
information to generate a compiled key flexfield definition
FND_ID_FLEX_SEGMENTS: FND_ID_FLEX_SEGMENTS stores setup information about
keyflexfield segments, as well as the correspondences between application table columns and the
key flexfield segments the columns are used for. Each row includes a flexfield application
identifier, the flexfield code,which identifies the key flexfield, the structure
number(ID_FLEX_NUM), the value set application identifier, the segment number (the
segment’s sequence in the flexfield window), the name of the column the segment corresponds to
(usually SEGMENTn, where n is an integer). Each row also includes the segment name, whether
security is enabled for the segment, whether the segment is required, whether the segment is one
of a high, low segment pair, whether the segment is displayed, whether the segment is enabled (Y
or N), type of default value, display information about the segment such as prompts and display
size, and the value set the segment uses. Each row also includes a flag for whether the table
column is indexed; this value is normally Y. You need one row for each segment of each structure
for each flexfield. Oracle Application Object Library uses this information to generate a compiled
key flexfield definition to store in the FND_COMPILED_ID_FLEXS table Thanks – Shivmohan
Purohit
FND_ID_FLEX_STRUCTURES : FND_ID_FLEX_STRUCTURES stores structure
information about keyflexfields. Each row includes the flexfield code and the structurenumber
(ID_FLEX_NUM), which together identify the structure, and the name and description of the
structure. Each row also includes values that indicate whether the flexfield structure is currently
frozen, whether rollup groups are frozen (FREEZE_STRUCTURED_HIER_FLAG), whether
users can dynamically insert new combinations of segment values through the flexfield pop–up
window, and whether the flexfield should use segment cross–validation rules. Each row also
contains information about shorthand flexfield entry for this structure, including whether
shorthand entry is enabled, the prompt for the shorthand window, and the length of the
shorthand alias field in the shorthandwindow. You need one row for each structure of each key
flexfield. Oracle Application Object Library uses this information to generate acompiled key
flexfield definition to store in the FND_COMPILED_ID_FLEXS table
FND_FLEX_VALUES stores valid values for key and descriptive flexfield segments. Oracle
Application Object Library uses this table when users define values for independent or dependent
type value sets. Oracle Application Object Library also uses this table when users define parent
values for ranges of child values that exist in a validation table(Oracle Application Object Library
stores the parent values in this table). Each row includes the value (FLEX_VALUE) and its
hierarchy level if applicable as well as the identifier of the value set the value belongs to. If the
value is a dependent value, PARENT_FLEX_VALUE_LOW contains the independent value this
value depends upon. Oracle Application Object Library does not use the
PARENT_FLEX_VALUE_HIGH column. If ENABLED_FLAG contains N, this value is currently
invalid, regardless of the start and end dates.
If ENABLED_FLAG contains Y, the start and end dates indicate if this value is currently
valid.SUMMARY_FLAG indicates if this value is a parent value that has child values, and
STRUCTURED_HIERARCHY_LEVEL contains the rollup group the parent value belongs to, if
any (1 through 9). COMPILED_VALUE_ATTRIBUTES contains the compiled values of
anysegment qualifiers assigned to this value. These values are in a special Oracle Application
Object Library format, and you should never modify them.

VALUE_CATEGORY and ATTRIBUTE1 through ATTRIBUTE50 are descriptive flexfield


columns, where VALUE_CATEGORY is the context (structure defining) column.

These descriptive flexfield columns do not contain values unless you have defined the descriptive
flexfield at your site. You need one row for each independent, dependent or parent value
belonging to a value set.Oracle Application Object Library uses this information to ensure that
users enter valid values in flexfield segments

FND_FLEX_VALUE_HIERARCHIES stores information about child value ranges for key


flexfield segment values. Each row includes an identification of the parent value the range
belongs to, as well as the low and high values that make up the range of child values.
FLEX_VALUE_SET_ID identifies the value set to which the parent value belongs. You need one
row for each range of child values (you can have more than one row for each parent value). Oracle
Application Object Library provides this information for applications reporting purposes.
SELECT
B.APPLICATION_ID, B.ID_FLEX_CODE, B.ID_FLEX_NUM,
B.ID_FLEX_STRUCTURE_CODE,
B.CONCATENATED_SEGMENT_DELIMITER,
B.CROSS_SEGMENT_VALIDATION_FLAG, B.DYNAMIC_INSERTS_ALLOWED_FLAG,
B.ENABLED_FLAG,
B.FREEZE_FLEX_DEFINITION_FLAG, B.FREEZE_STRUCTURED_HIER_FLAG,
B.SHORTHAND_ENABLED_FLAG,
T.ID_FLEX_STRUCTURE_NAME, T.DESCRIPTION
FROM FND_ID_FLEX_STRUCTURES_TL T, FND_ID_FLEX_STRUCTURES B
WHERE B.APPLICATION_ID = T.APPLICATION_ID
AND B.ID_FLEX_CODE = T.ID_FLEX_CODE
AND B.ID_FLEX_NUM = T.ID_FLEX_NUM
AND T.LANGUAGE = userenv(‘LANG’)
AND B.ENABLED_FLAG = ‘Y’
AND B.FREEZE_STRUCTURED_HIER_FLAG = ‘Y’
AND B.ID_FLEX_CODE = ‘GL#’
AND B.ID_FLEX_NUM = &&number

Here are some more SQLs to find the GL combinations structures:


SELECT s.FLEX_VALUE_SET_ID,s.FLEX_VALUE_SET_NAME, v.FLEX_VALUE, t.DESCRIPTION
FROM fnd_flex_values v,fnd_flex_value_sets s,fnd_flex_values_tl t
WHERE FLEX_VALUE_SET_NAME LIKE ‘%&&Company_Department%’
AND s.FLEX_VALUE_SET_ID = v.FLEX_VALUE_SET_ID
AND t.FLEX_VALUE_ID = v.FLEX_VALUE_ID
ORDER BY FLEX_VALUE
SELECT s.FLEX_VALUE_SET_ID,s.FLEX_VALUE_SET_NAME, v.FLEX_VALUE,
t.DESCRIPTION
FROM fnd_flex_values v,fnd_flex_value_sets s,fnd_flex_values_tl t
WHERE FLEX_VALUE_SET_NAME LIKE ‘%&&Company_Account%’
AND s.FLEX_VALUE_SET_ID = v.FLEX_VALUE_SET_ID
AND t.FLEX_VALUE_ID = v.FLEX_VALUE_ID
ORDER BY FLEX_VALUE
SELECT s.FLEX_VALUE_SET_ID,s.FLEX_VALUE_SET_NAME, v.FLEX_VALUE,
t.DESCRIPTION
FROM fnd_flex_values v,fnd_flex_value_sets s,fnd_flex_values_tl t
WHERE FLEX_VALUE_SET_NAME LIKE ‘%&&Company_Future%’
AND s.FLEX_VALUE_SET_ID = v.FLEX_VALUE_SET_ID
AND t.FLEX_VALUE_ID = v.FLEX_VALUE_ID
ORDER BY FLEX_VALUE
SELECT s.FLEX_VALUE_SET_ID,s.FLEX_VALUE_SET_NAME, v.FLEX_VALUE,
t.DESCRIPTION
FROM fnd_flex_values v,fnd_flex_value_sets s,fnd_flex_values_tl t
WHERE FLEX_VALUE_SET_NAME LIKE ‘%&&Company_Location_FA%’
AND s.FLEX_VALUE_SET_ID = v.FLEX_VALUE_SET_ID
AND t.FLEX_VALUE_ID = v.FLEX_VALUE_ID
ORDER BY FLEX_VALUE
SELECT s.FLEX_VALUE_SET_ID,s.FLEX_VALUE_SET_NAME, v.FLEX_VALUE,
t.DESCRIPTION
FROM fnd_flex_values v,fnd_flex_value_sets s,fnd_flex_values_tl t
WHERE FLEX_VALUE_SET_NAME LIKE ‘%&&Company_Country_FA%’
AND s.FLEX_VALUE_SET_ID = v.FLEX_VALUE_SET_ID
AND t.FLEX_VALUE_ID = v.FLEX_VALUE_ID
ORDER BY FLEX_VALUE
SELECT s.FLEX_VALUE_SET_ID,s.FLEX_VALUE_SET_NAME, v.FLEX_VALUE,
t.DESCRIPTION
FROM fnd_flex_values v,fnd_flex_value_sets s,fnd_flex_values_tl t
WHERE FLEX_VALUE_SET_NAME LIKE ‘%&&Company_State_FA%’
AND s.FLEX_VALUE_SET_ID = v.FLEX_VALUE_SET_ID
AND t.FLEX_VALUE_ID = v.FLEX_VALUE_ID
ORDER BY FLEX_VALUE
SELECT s.FLEX_VALUE_SET_ID,s.FLEX_VALUE_SET_NAME, v.FLEX_VALUE,
t.DESCRIPTION
FROM fnd_flex_values v,fnd_flex_value_sets s,fnd_flex_values_tl t
WHERE FLEX_VALUE_SET_NAME LIKE ‘%&&Company_City_FA%’
AND s.FLEX_VALUE_SET_ID = v.FLEX_VALUE_SET_ID
AND t.FLEX_VALUE_ID = v.FLEX_VALUE_ID
ORDER BY FLEX_VALUE

Oracle Applications: The Concurrent Jobs Ran Yesterday


and Failed – SQL script & Unix Shell Script
Posted by Jiltin 10 June, 2009 2,308 views
• Pending normal jobs running (oracle 11i) in oracle applications
• Oracle applications – List all the concurrent Jobs ran by user.
• Oracle Applications: Submitting Concurrent Request Using
FND_CONCURRENT.WAIT_FOR_REQUEST Sample Code
• List the responsibilities that can run a given concurrent program
• Auto shipment notification to companies using oracle applications – Concurrent Job shell
script

I often use this script to find the concurrent jobs ran yesterday and
Failed. You can also automate the script into unix shell or some oracle alerts.
SELECT
fu.user_name,
fcpt.USER_CONCURRENT_PROGRAM_NAME,
fcpt.description,
fcp.CONCURRENT_PROGRAM_NAME,
fcr.REQUEST_ID,
round((fcr.actual_completion_date –
decode(trunc(fcr.request_date),fcr.requested_start_date,fcr.request_date,fcr.re
quested_start_date))*60*24)WaitTimeMIN,
DECODE(fcr.PHASE_CODE,‘C’,‘Completed’,‘R’,‘Running’,fcr.PHASE_CODE) PHASE_CODE,
DECODE(fcr.STATUS_CODE,‘C’,‘Completed’,‘R’,‘Running’,‘W’,‘Paused’,‘E’,‘Error’,‘
G’, ‘Warning’, fcr.STATUS_CODE) STATUS_CODE,
to_char(fcr.request_date,‘DD-MON-YYYY HH24:MI:SS’) request_date,
to_char(fcr.requested_start_date,‘DD-MON-YYYY HH24:MI:SS’) start_time,
to_char(fcr.actual_completion_date,‘DD-MON-YYYY HH24:MI:SS’) complete_time
FROM
fnd_concurrent_requests fcr,
fnd_concurrent_programs fcp,
fnd_concurrent_programs_tl fcpt,
fnd_user fu
WHERE 1=1
AND fcp.CONCURRENT_PROGRAM_ID=fcr.CONCURRENT_PROGRAM_ID
AND fcpt.CONCURRENT_PROGRAM_ID=fcp.CONCURRENT_PROGRAM_ID
AND fcr.requested_by = fu.user_id
AND trunc(fcr.request_date) BETWEEN sysdate – 1 AND sysdate
AND fcr.status_code IN (‘E’,‘G’)
ORDER BY fcr.status_code,fcp.CONCURRENT_PROGRAM_NAME,fcr.REQUEST_ID;

Here is the shell script that you can put it in crontab to run daily to send you
email
#!/bin/sh
#
# Author: Jiltin
# Test email for future cronjobs
#
FILENAME=DailyReport
FILETEXT=$FILENAME.txt
source /usr/local/bin/production.env
sqlplus -s username/password@database <<EOF
–alter session set current_schema=apps;
SET echo OFF
SET feedback OFF
SET heading on
SET linesize 221
SET pagesize 55
SET newpage 0
spool $FILETEXT
column today new_value CURR_DATE noprint
SELECT to_char(sysdate,‘DD-MON-YYYY HH24:MI:SS’) today from dual;
TTITLE left ‘JILERRCC’ CENTER ‘Jiltin Corporation’ –
RIGHT ‘DATE:’ CURR_DATE skip 1 -
CENTER ‘Concurrent Jobs Errored Yesterday’ -
RIGHT ‘PAGE:’ format 999 SQL.PNO skip 1 -
column user_name format a10
column USER_CONCURRENT_PROGRAM_NAME format a40
column description format a50
column CONCURRENT_PROGRAM_NAME format a10
column REQUEST_ID format 99999999
column WaitTimeMIN format 9999.99
column PHASE_CODE format a10
column STATUS_CODE format a10
column request_date format a20
column start_time format a20
column complete_time format a20
BREAK ON status_code SKIP 1
SELECT
fu.user_name,
fcpt.USER_CONCURRENT_PROGRAM_NAME,
fcpt.description,
fcp.CONCURRENT_PROGRAM_NAME,
fcr.REQUEST_ID,
round((fcr.actual_completion_date –
decode(trunc(fcr.request_date),fcr.requested_start_date,fcr.request_date,fcr.requested_sta
rt_date))*60*24) WaitTimeMIN,

DECODE(fcr.PHASE_CODE,‘C’,‘Completed’,‘R’,‘Running’,fcr.PHASE_CODE) PHASE_CO
DE,

DECODE(fcr.STATUS_CODE,‘C’,‘Completed’,‘R’,‘Running’,‘W’,‘Paused’,‘E’,‘Error’,‘G’, ‘War
ning’, fcr.STATUS_CODE) STATUS_CODE,
to_char(fcr.request_date,‘DD-MON-YYYY HH24:MI:SS’) request_date,
to_char(fcr.requested_start_date,‘DD-MON-YYYY HH24:MI:SS’) start_time,
to_char(fcr.actual_completion_date,‘DD-MON-YYYY HH24:MI:SS’) complete_time
FROM
fnd_concurrent_requests fcr,
fnd_concurrent_programs fcp,
fnd_concurrent_programs_tl fcpt,
fnd_user fu
WHERE 1=1
AND fcp.CONCURRENT_PROGRAM_ID=fcr.CONCURRENT_PROGRAM_ID
AND fcpt.CONCURRENT_PROGRAM_ID=fcp.CONCURRENT_PROGRAM_ID
AND fcr.requested_by = fu.user_id
and trunc(fcr.request_date) between sysdate – 1 and sysdate
AND fcr.status_code in (‘E’,‘G’)
order by fcr.status_code,fcp.CONCURRENT_PROGRAM_NAME,fcr.REQUEST_ID;
spool off;
EOF
mail -s "Yesterday Concurrent Program status! Reported on `date` " support@notesbit.com
< $FILETEXT

Anda mungkin juga menyukai