Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.

Saturday, September 26, 2015

Concurrent Processing - Sample Code for FND_SUBMIT and FND_REQUEST API's

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;

/

No comments:

Post a Comment

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Best Blogger TipsGet Flower Effect