R12.2 Apps DBA. Powered by Blogger.

Submit a Concurrent Program/Request from PL/SQL

No comments :
/*********************************************************
*PURPOSE: To Submit a Concurrent Request from backend    *
*AUTHOR: *******                                  *
**********************************************************/
--
DECLARE
   l_responsibility_id     NUMBER;
   l_resp_application_id   NUMBER;
   l_security_group_id     NUMBER;
   l_user_id               NUMBER;
   l_request_id            NUMBER;
BEGIN
   --
   -- Get the apps environment variables --
   --
   SELECT user_id, responsibility_id, responsibility_application_id,
          security_group_id
     INTO l_user_id, l_responsibility_id, l_resp_application_id,
          l_security_group_id
     FROM fnd_user_resp_groups
    WHERE user_id = (SELECT user_id
                       FROM fnd_user
                      WHERE user_name = '&USER_NAME')
      AND responsibility_id =
             (SELECT responsibility_id
                FROM fnd_responsibility_vl
               WHERE responsibility_name = '&RESP_NAME');


   --
   --To set environment context.
   --
   apps.fnd_global.apps_initialize (l_user_id,
                                    l_responsibility_id,
                                    l_resp_application_id
                                   );
   --
   --Submitting Concurrent Request
   --
   l_request_id :=
      fnd_request.submit_request (application      => 'XXCUST',         -- Application Short Name
                                  program          => 'XX_DEPT_DTLS',   -- Program Short Name
                                  description      => 'XX_DESCRIPTION', -- Any Meaningful Description
                                  start_time       => SYSDATE,          -- Start Time
                                  sub_request      => FALSE,            -- Subrequest Default False
                                  argument1        => 'Accounting'      -- Parameters Starting
                                 );
   --
   COMMIT;

   --
   IF l_request_id = 0
   THEN
      DBMS_OUTPUT.put_line ('Concurrent request failed to submit');
   ELSE
      DBMS_OUTPUT.put_line ('Successfully Submitted the Concurrent Request: '||l_request_id);
   END IF;
   --
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line (   'Error While Submitting Concurrent Request '
                            || TO_CHAR (SQLCODE)
                            || '-'
                            || SQLERRM
                           );
END;
/

No comments :

Post a Comment

Note: only a member of this blog may post a comment.