How To Create Custom Concurrent Requests
How To Create Custom Concurrent Requests
Table Of Contents
How To Create Custom Concurrent Requests for Oracle ................................................ 1
Applications Release 11.X .............................................................................................. 1
PURPOSE ...................................................................................................................... 2
Registering Your Concurrent Request............................................................................. 2
Defining the Executable............................................................................................... 2
Defining the Concurrent Program ................................................................................ 3
Assigning the Concurrent Program to a Request Group .............................................. 5
Implementing a SQL*PLUS Concurrent Request ............................................................ 5
Implementing a PL/SQL Concurrent Request.................................................................. 6
Implementing a Host Concurrent Request....................................................................... 8
APPENDIX 1: Sample SQL*PLUS Script ........................................................................ 9
APPENDIX 2: Sample Stored Procedure ......................................................................10
APPENDIX 3: Sample Host Program (UNIX) ................................................................12
PURPOSE
This document discusses steps to set up custom concurrent request that are integrated
into Oracle Applications Release 11.0.X. The following discussion is pertinent for all
releases of Oracle Applications Release 11 on UNIX. This paper specifically addresses
SQL*PLUS, PL/SQL Stored Procedure, and HOST program concurrent request types
and generically addresses the steps to register any concurrent request.
Executable Name - is the logical name for the executable, it is informational only. The
executable name can be changed after the executable has already been assigned to a
concurrent program.
Short Name - is the Name that is queried from the executable zone on the Define
Concurrent Program form. The Short Name cannot be changed after the record has
been saved in the database.
Application - is the application that the executable should be registered under. The
Application field cannot be changed after the record has been saved in the database, the
Application determines the product_top that will be searched when Oracle Applications
attempts to locate the executable i.e. if you specify Application Object Library the
$FND_TOP will be searched.
Description - field is informational only and can be changed anytime.
The Execution Method - determines how Oracle Applications will invoke your concurrent
program and also determines which directory under the product top that will be
interrogated to find your executable i.e. if the Execution Method is SQL*PLUS then the
executable should be located under $PRODUCT_TOP/sql.
Execution File Name - is the name of the program unit that will be executed, this is a
physical entity and must be located in the correct directory in the file system or
database. The Execution File Name can be changed and does not permit the standard
extension to be specified, the standard extension should be used when the executable is
created in the file system i.e. specify TEST_SQL for the Execution File Name in the form
but create a script named TEST_SQL.sql on the file system.
Subroutine Name - is only applicable for the spawned and immediate execution
methods.
After an executable has been defined an executable cannot be deleted once it has been
assigned to a concurrent program. If you must delete the executable you would have to
delete the concurrent program first. (SEE 6-48 Oracle Applications Systems
Administration Guide)
Priority - is used to indicate the priority that the concurrent request will be assigned when
it is submitted. If you do not assign a priority, the user’s profile option Concurrent:Priority
sets the request’s priority at submission. For detail explanations of the Request zone,
Output zone and how to define incompatibilities from this form see (6-53 of the Oracle
Applications System Administration Guide).
Assigning the Concurrent Program to a Request Group
The last step to ready your custom concurrent request - so that it can be submitted from
applications - is to assign the concurrent program to a Request Group. Navigation to the
form is accomplished from SYSADMIN responsibility Security:Responsibility:Request.
Use Query from the toolbar, select Find and select the Report Group that you would like
to add
your concurrent request to. Then place your cursor in the TYPE column and use Edit
from the
toolbar to create a new record. Specify type as “program”and then select the concurrent
program from the LOV. After you have completed this step you are able to submit the
concurrent request from a responsibility that has the request group assigned.
The key item to remember when defining parameters for SQL*PLUS concurrent
programs is that the reference to the parameter being passed to the script is based on
the order of the parameters specified in the above form. For example in the above form
the parameter for the User ID should be named &1 and Signon Date should be named
&2 in the script (See Appendix 1 for example script). The sequence specified in the form
does not correlate to the value that should be specified in the script. For example if the
sequence for User Id remains 1 and the Signon Date is changed to sequence 5 the
names of the parameters in the script should still be called &1 and &2 respectively. If you
change the order of the parameters on the form you will have to change the script to
reflect the correct names based on the order of the parameters on the form. Lastly, the
name of the parameter must be a &number where number is the order of the parameter
specified on the form, i.e. the form has 5 parameters the names in the script would be
&1, &2, &3, &4 and &5 respectively. If your custom script contains a date format
parameter and you want to schedule the request and have the request increment that
date parameter the value set used for the parameter must be FND_DATE. Otherwise
when you submit the request to be rescheduled and check the box to increment date
parameters the date will not change from each execution to the next. The output from
any SQL select statements in your script will be written to the output file for the request
automatically. It is not necessary to specify an alternate spool file for output unless the
client wants the output to be written to a different directory or file name.
The parameters in $5 thru $9 are user defined and are passed in the order defined on
the Concurrent Program Parameters form. The total number of parameters passed is
shell (ksh, csh, bourne, etc) dependent. To be able to reference parameters 6 thru N
where parameter 6 would be the equivalent of $10 you must use the shift command to
place the value of the 10 th argument into $9 variable (see example script APPENDIX
3).
If you specify “encrypt”in the Execution Options filed of the Concurrent Programs
window.
This signals the concurrent manager to pass orauser\pwd in the environment variable
fcp_login. The password of the argument $1 will be populated with asterisks (SEE UNIX
Installation Guide B-12).After you have created your host concurrent program make sure
that you save the program with an extension of “YOUR_HOST.prog”. The execution file
specified when the executable is defined should be equal to “YOUR_HOST” excluding
the .prog extension. After you have saved your executable it is important to create a
symbolic link from “YOUR_HOST”to fndcpesr in the same directory that your host
concurrent program is saved. The command to create the symbolic link is:
“ln -s fndcpesr YOUR_HOST”
If you fail to create the symbolic link the parameters passed to your program will not be
passed in separate variables rather they will be passed as one long string in the $1
parameter. It is important to remember to grant executable permissions on the script file
that is your host concurrent program. The command to do this is:
chmod 755 YOUR_HOST.prog
if you fail to do this your concurrent program will fail and exit with status 1.
If you wish to direct output to the request log or output log for your host concurrent
program it is the responsibility of the programmer to construct the correct file name
based on the user name ($3) and request id ($4) parameters. The request log is of the
format “l######.req”where ###### = request id ($4). The output files fomat is
dependent upon the environment variable $APPCPNAM. If $APPCPNAM is set to
USER.REQUID then the naming convention for output files will be USERNAME.######
where ###### = request id ($4) and USERNAME is the user that submitted the request
($3). If APPCPNAM is not set the default 8.3 naming convention will be used which is
o######.out where ###### = request id ($4).
APPENDIX 1: Sample SQL*PLUS Script
SET PAGESIZE 40
SET LINESIZE 80
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING ON
TTITLE 'Userid|Activity Report'
BTITLE 'Confidential'
COLUMN c1 HEADING 'User Name'
COLUMN c2 HEADING 'Session Start Time'
COLUMN c3 HEADING 'Session End Time'
Package Body
/*
|| PACKAGE BODY
*/
CREATE or REPLACE PACKAGE BODY test_package AS
/*
|| Implementation of purge_signon_data
*/
PROCEDURE purge_signon_data ( errbuf OUT VARCHAR2
, retcode OUT NUMBER
, v_user_name IN VARCHAR2
, v_cutoff_date IN DATE )
IS
v_num_recs_deleted NUMBER := 0; -- records deleted
v_username VARCHAR2(100); -- user name
v_login_id NUMBER := 0; -- login id
v_text_msg VARCHAR2(100); -- text message
v_error_code NUMBER; -- error code
v_error_message VARCHAR2(255); -- error message
CURSOR purge_signon_cursor ( v_user_name VARCHAR2,
v_cutoff_date DATE )
IS
SELECT fu.user_name
, fl.login_id
FROM fnd_user fu
, fnd_logins fl
WHERE fu.user_id = fl.user_id
AND fu.user_name = UPPER(v_user_name)
AND fl.start_time < v_cutoff_date;
BEGIN
errbuf := NULL;
retcode := 0;
/*
|| Open cursor, fetch each record that meets selection criteria,
|| delete each record that meets selection criteria and commit
|| changes.
*/
fnd_file.put_line (fnd_file.log
, 'Beginning Procedure purge_signon_data');
fnd_file.put_line (fnd_file.log, '');
fnd_file.put_line (fnd_file.log
, 'User Name: ' || v_user_name);
fnd_file.put_line (fnd_file.log
, 'Cutoff Date: ' || v_cutoff_date);
fnd_file.put_line (fnd_file.log, '');
OPEN purge_signon_cursor ( v_user_name, v_cutoff_date );
LOOP
FETCH purge_signon_cursor
INTO v_username, v_login_id;
v_num_recs_deleted := v_num_recs_deleted + 1;
END LOOP;
CLOSE purge_signon_cursor;