Friday, September 19, 2014

Registering a Concurrent Program From Backend

The scripts in this article can be used to:
1) Register the executable and Program
2) Attach Concurrent program to a Request Group
3) Submit Concurrent program

  1)      Registering the Executable from back end
 Usually we create executable in the front-end, but this can be done from the database tier i.e. back-end too. 
       Below is the PL/SQL code to create an executable from back-end


BEGIN
   FND_PROGRAM.EXECUTABLE ('XX_PO'            -- executable
                                  ,
                           'Purchasing'       -- application
                                       ,
                           'XX_PO'           -- short_name
                                  ,
                           'Executable for Purchase Order' -- description
                                                                      ,
                           'Oracle Reports'      -- execution_method
                                           ,
                           'XX_PO' -- execution_file_name
                           );

   COMMIT;
END;

Query in the front-end to see whether your executable is created or not.

2)      Registering the Concurrent program from back end
Usually we create Concurrent program in the front-end, but this can be done from the database tier too.
Below is the program to create a Concurrent program from back-end.

  BEGIN

                     FND_PROGRAM.register('Purchase Order Report' -- program

                                                                , 'Purchasing' -- application

                                                                , 'Y' -- enabled

                                                                , 'XX_PO' -- short_name

                                                                , 'Purchase Order' -- description

                                                                , 'XX_PO' -- executable_short_name

                                                                , 'Purchasing' -- executable_application

                                                                , '' -- execution_options

                                                                , '' -- priority

                                                                , 'Y' -- save_output

                                                                , 'Y' -- print

                                                                , '' -- cols

                                                                , '' -- rows

                                                                , '' -- style

                                                                , 'N' -- style_required

                                                                , '' -- printer

                                                                , '' -- request_type

                                                                , '' -- request_type_application

                                                                , 'Y' -- use_in_srs

                                                                , 'N' -- allow_disabled_values

                                                                , 'N' -- run_alone

                                                                , 'TEXT' --output_type

                                                                , 'N' -- enable_trace

                                                                , 'Y' -- restart

                                                                , 'Y' -- nls_compliant

                                                                , '' -- icon_name

                                                                , 'US'); -- language_code

                        COMMIT;

            END;
Query in the front-end to see whether your Concurrent program is created or not.

3) Attaching the concurrent program to the request group
Usually we Attach Concurrent program to the request group in the front-end, but this can be done from database tier too.
Below is the program to Attach Concurrent program to the request group from back-end.


BEGIN

                        FND_PROGRAM.add_to_group('XX_PO' -- program_short_name

                                                                             , 'Purchasing' -- application

                                                                             , 'All Reports' -- Report Group Name

                                                                             , 'Purchasing'); -- Report Group Application

                        COMMIT;

              END;
Query in the front-end to see whether your Concurrent program is Attached to Request Group or not.
3)      Submitting Concurrent Program from Back-end
We first need to initialize oracle applications session using
fnd_global.apps_initialize(user_id,responsibility_id,application_responsibility_id) and then run fnd_request.submit_request

CREATE OR REPLACE PROCEDURE APPS.XX_PO --IF PROGRAM HAVE PARAMETER THEN TAKE THIS( P_PARMETER1 IN VARCHAR2, P_PARMETER2 IN VARCHAR2 )
AS
   V_REQ_ID         NUMBER;
   XML_LAYOUT       BOOLEAN;
   G_USER_ID        NUMBER := 1318;                 --APPS.FND_GLOBAL.USER_ID;
   G_RESP_ID        NUMBER := 50554;                --APPS.FND_GLOBAL.RESP_ID;
   G_RESP_APPL_ID   NUMBER := 200;             --APPS.FND_GLOBAL.RESP_APPL_ID;
BEGIN
   APPS.FND_GLOBAL.APPS_INITIALIZE (USER_ID        => G_USER_ID,
                                    RESP_ID        => G_RESP_ID,
                                    RESP_APPL_ID   => G_RESP_APPL_ID);

   XML_LAYOUT :=
      FND_REQUEST.ADD_LAYOUT ('PO',
                              'XX_PO',
                              'en',
                              '00',
                              'PDF');
   V_REQ_ID :=
      FND_REQUEST.SUBMIT_REQUEST (APPLICATION   => 'PO',
                                  PROGRAM       => 'XX_PO',
                                  DESCRIPTION   => NULL,
                                  START_TIME    => SYSDATE,
                                  SUB_REQUEST   => FALSE);
   -- IF WE HAVE PARAMETER THEN ,ARGUMENT1     => P_PARMETER1,  ARGUMENT2=>P_PARMETER2);
   COMMIT;
END;

And Execute This Procedure

BEGIN
   APPS.XX_PO;
END;
  

To get the resp_id and resp_appl_id use the below queries.

                   --SELECT APPLICATION_ID, RESPONSIBILITY_ID

                          FROM FND_RESPONSIBILITY_TL

                          WHERE RESPONSIBILITY_NAME='Purchasing'

                       --SELECT USER_ID FROM FND_USER WHERE USER_NAME='OPERATIONS'

1 comment:

  1. According to Stanford Medical, It's in fact the SINGLE reason women in this country get to live 10 years longer and weigh on average 19 kilos lighter than us.

    (Just so you know, it has NOTHING to do with genetics or some hard exercise and EVERYTHING related to "HOW" they eat.)

    BTW, What I said is "HOW", and not "what"...

    TAP on this link to uncover if this easy questionnaire can help you release your real weight loss potential

    ReplyDelete