i want to run concurrent program from database

There are many available reports in Oracle Apps so you can discuss the requirements related to these reports here.
Post Reply
j_naren_oracle
Posts: 2
Joined: Wed Dec 12, 2007 4:31 am
Location: India

i want to run concurrent program from database

Post by j_naren_oracle »

Dear members,
i have generated one report in report builder.i have registered with apps.
i run the report in apps.it's run correctly.
But i want to run the concurrent program (report) from database.
i have tried using with FND_REQUEST API.But i could not run the concurrent program.
plz help
ahmadbilal
Posts: 615
Joined: Mon Sep 18, 2006 1:32 am
Location: United Arab Emirates
Contact:

Post by ahmadbilal »

<b>Metalink Note Id 221542.1 </b>
Sample Code for FND_SUBMIT and FND_REQUEST API's


Purpose
This sample code provides an example of usage of FND_REQUEST and FND_SUBMIT API's.
Software Requirements/Prerequisites

Register the procedure as a concurrent program
Configuring the Script

FND_SUBMIT test procedure and sample code

Creates a procedure called fnd_submit_test that can be registered and run as a concurrent program.
This procedure will use the FND_SUBMIT API to submit a request set. (Function Security Reports - This request set should be seeded, if it is not available the values in the script may need to be changed.) The procedure will then place itself in a Paused status until the request set completes.
Running the Script

1. Install this procedure in the APPS schema.
2. Register the procedure as a concurrent program
Caution
This script is provided for educational purposes only and not supported by Oracle Support Services. It has been tested internally, however, and works as documented. We do not guarantee that it will work for you, so be sure to test it in your environment before relying on it.

Proofread this script before using it! Due to the differences in the way text editors, e-mail packages and operating systems handle text formatting (spaces, tabs and carriage returns), this script may not be in an executable state when you first receive it. Check over the script to ensure that errors of this type are corrected.
Script
REM +==========================================================================
REM | Concurrent Processing Sample Code
REM |
REM | FILE:
REM | fnd_submit_test.pls
REM |
REM | REVISION:
REM | $Id$
REM |
REM | DESCRIPTION:
REM | FND_SUBMIT test procedure and sample code
REM | Creates a procedure called fnd_submit_test that can be registered
REM | and run as a concurrent program.
REM | This procedure will use the FND_SUBMIT API to submit a request set.
REM | (Function Security Reports - This request set should be seeded, if
REM | it is not available the values in the script may need to be changed.)
REM | The procedure will then place itself in a Paused status until the
REM | request set completes.
REM |
REM | INSTRUCTIONS:
REM |
REM | 1. Install this procedure in the APPS schema.
REM |
REM | 2. Register the procedure as a concurrent program
REM |
REM |
REM +==========================================================================

whenever sqlerror exit failure rollback;

create or replace procedure fnd_submit_test (errbuf out varchar2,
retcode out varchar2) as

success boolean;
req_id number;
req_data varchar2(10);
srs_failed exception;
submitprog_failed exception;
submitset_failed exception;

begin

-- Use FND_FILE to output messages at each stage
fnd_file.put_line(fnd_file.log, 'Starting test...');

-- Read fnd_conc_global.request_data, if available then we have been
-- reawakened after the request set has completed.
-- If so, exit.
req_data := fnd_conc_global.request_data;

if (req_data is not null) then

errbuf := 'Done!';
retcode := 0 ;
return;
end if;


-- Step 1 - call set_request_set
fnd_file.put_line(fnd_file.log, 'Calling set_request_set...');

success := fnd_submit.set_request_set('FND', 'FNDRSSUB43');
if ( not success ) then
raise srs_failed;
end if;


fnd_file.put_line(fnd_file.log, 'Calling submit program first time...');

-- Step 2 - call submit program for each program in the set
success := fnd_submit.submit_program('FND','FNDMNFUN', 'STAGE10', 'System Administrator', chr(0));
if ( not success ) then
raise submitprog_failed;
end if;


fnd_file.put_line(fnd_file.log, 'Calling submit program second time...');

success := fnd_submit.submit_program('FND','FNDMNMNU', 'STAGE10', 'System Administrator', chr(0));
if ( not success ) then
raise submitprog_failed;
end if;


fnd_file.put_line(fnd_file.log, 'Calling submit program third time...');

success := fnd_submit.submit_program('FND','FNDMNNAV', 'STAGE10', 'System Administrator', chr(0));
if ( not success ) then
raise submitprog_failed;
end if;


-- Step 3 - call submit_set
fnd_file.put_line(fnd_file.log, 'Calling submit_set...');

req_id := fnd_submit.submit_set(null,true);

if (req_id = 0 ) then
raise submitset_failed;
end if;

fnd_file.put_line(fnd_file.log, 'Finished.');


-- Set conc_status to PAUSED, set request_data to 1 and exit
fnd_conc_global.set_req_globals(conc_status => 'PAUSED', request_data => '1') ;

errbuf := 'Request set submitted. id = ' || req_id;
retcode := 0;


exception
when srs_failed then
errbuf := 'Call to set_request_set failed: ' || fnd_message.get;
retcode := 2;
fnd_file.put_line(fnd_file.log, errbuf);
when submitprog_failed then
errbuf := 'Call to submit_program failed: ' || fnd_message.get;
retcode := 2;
fnd_file.put_line(fnd_file.log, errbuf);
when submitset_failed then
errbuf := 'Call to submit_set failed: ' || fnd_message.get;
retcode := 2;
fnd_file.put_line(fnd_file.log, errbuf);
when others then
errbuf := 'Request set submission failed - unknown error: ' || sqlerrm;
retcode := 2;
fnd_file.put_line(fnd_file.log, errbuf);
end;
/
rem ===================================================================
commit;
exit;
References
11i Application Developers Guide
rehmans
Posts: 15
Joined: Sun Sep 09, 2007 2:55 pm
Location: Pakistan

Post by rehmans »

What error it displays when you run the program?

Regards
Zia
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests