Monday, 15 July 2013

Custom Package to create Concurrent Program through API’s

--Custom Package to create Concurrent Program through API’s

CREATE OR REPLACE PACKAGE APPS.XXSANTOSHALL_CONPRG_DETAIL
AS
   PROCEDURE xxcreate_cpexecuitable(
/*–===============================================
–Create Concurrent Program Executable FROM BACK END
–=============================================== */
                                     v_executable             VARCHAR2,
                                     v_application            VARCHAR2,
                                     v_short_name             VARCHAR2,
                                     v_execution_method       VARCHAR2,
                                     v_execution_file_name    VARCHAR2);
   PROCEDURE xxdelete_cpexecuitable (
   /*–===================================================
TO DELETE CONCURRENT PROGRAM EXECUTABLE FROM BACK END                                    
 –===================================================*/
                                     v_executable_short_name    VARCHAR2,
                                     v_application              VARCHAR2);
   PROCEDURE XXCREATE_CONCURRENT_PROGRAM (
      /*–===========================================
      –Create Concurrent Program Define FROM BACK END
      –============================================*/
      V_PROGRAME                  VARCHAR2,
      V_APPLICATION               VARCHAR2,
      V_ENABLED                   VARCHAR2,
      V_SHORT_NAME                VARCHAR2,
      V_EXECUTABLE_SHORT_NAME     VARCHAR2,
      V_EXECUTABLE_APPLICATION    VARCHAR2,
      V_STYLE                     VARCHAR2,
      V_USE_IN_SRS                VARCHAR2,
      V_OUTPUT_TYPE               VARCHAR2);
   PROCEDURE XXDELETE_CONCURRENT_PROGRAM (v_program_short_name    VARCHAR2,
                                          v_application           VARCHAR2);
   PROCEDURE XXCREATE_CON_PROG_PARAMETOR (
/*–===============================================
–Creating Parameters For Concurrent Program
–===================================================*/
                                          V_program_short_name    VARCHAR2,
                                          V_application           VARCHAR2,
                                          V_sequence              NUMBER,
                                          V_parameter             VARCHAR2,
                                          V_description           VARCHAR2,
                                          V_enabled               VARCHAR2,
                                          V_value_set             VARCHAR2,
                                          V_display_size          NUMBER,
                                          V_description_size      NUMBER,
                                          V_concat_des_size       NUMBER,
                                          V_prompt                VARCHAR2,
                                          V_token                 VARCHAR2);
   PROCEDURE XXDELETE_CON_PROG_PARAMETOR (
/* –===============================================
TO DELETE PARAMETER FROM BACK END
–===============================================*/
                                          V_program_short_name    VARCHAR2,
                                          V_application           VARCHAR2,
                                          V_parameter             VARCHAR2);
   PROCEDURE XXADD_CP_TO_REQST_GROUP (
/*–===============================================
— Add To The Request Group
–===============================================*/
                                      V_program_short_name    VARCHAR2,
                                      V_prog_application      VARCHAR2,
                                      V_request_group         VARCHAR2,
                                      V_grp_appl              VARCHAR2);
   PROCEDURE XXREMOV_CP_FROM_REQST_GROUP (
   /*–===============================================
    TO REMOVE PROGRAM FROM REQUEST GROUP
–===============================================*/
                                          V_program_short_name    VARCHAR2,
                                          V_prg_appl              VARCHAR2,
                                          V_reqst_grp             VARCHAR2,
                                          V_grp_appl              VARCHAR2);
   PROCEDURE xxsubmit_xml_cp_4m_bkend (
      v_template_appl_name    VARCHAR2,
      v_template_code         VARCHAR2,
      v_template_language     VARCHAR2,
      v_template_territory    VARCHAR2,
      v_output_format         VARCHAR2,
      v_application           VARCHAR2,
      v_program               VARCHAR2,
      v_description           VARCHAR2,
      v_start_time            VARCHAR2,
      v_sub_request           BOOLEAN := FALSE,
      v_argument1             VARCHAR2 DEFAULT CHR (0),
      v_argument2             VARCHAR2 DEFAULT CHR (0),
      v_argument3             VARCHAR2 DEFAULT CHR (0),
      v_argument4             VARCHAR2 DEFAULT CHR (0),
      v_argument5             VARCHAR2 DEFAULT CHR (0));

END;



 /*–===============================================
    -----Package Body-----------
–===============================================*/


CREATE OR REPLACE PACKAGE BODY APPS.XXSANTOSHALL_CONPRG_DETAIL
AS
   PROCEDURE xxcreate_cpexecuitable (
/*===============================================
–Create Concurrent Program Executable FROM BACK END
–===============================================*/
                                     v_executable             VARCHAR2,
                                     v_application            VARCHAR2,
                                     v_short_name             VARCHAR2,
                                     v_execution_method       VARCHAR2,
                                     v_execution_file_name    VARCHAR2)
   IS
   BEGIN
      FND_GLOBAL.APPS_INITIALIZE (user_id        => 0,
                                  resp_id        => 20434,
                                  resp_appl_id   => 101);
      --userid,responcibility,application detail
      COMMIT;
      fnd_program.EXECUTABLE (executable            => v_executable,
                              -- ‘XXPRDBANKOVERDRAFT’ ,
                              application           => v_application,
                              short_name            => v_short_name,
                              execution_method      => v_execution_method,
                              execution_file_name   => v_execution_file_name);

      COMMIT;
   END;

   PROCEDURE xxdelete_cpexecuitable (
/*–===================================================
TO DELETE CONCURRENT PROGRAM EXECUTABLE FROM BACK END
–===================================================*/
                                 v_executable_short_name    VARCHAR2,
                                     v_application              VARCHAR2)
   IS
   BEGIN
      FND_GLOBAL.APPS_INITIALIZE (user_id        => 0,
                                  resp_id        => 20434,
                                  resp_appl_id   => 101);
      -- userid,responcibility,application detail
      FND_PROGRAM.DELETE_EXECUTABLE (
         executable_short_name   => v_executable_short_name,
         --— ‘XXPRD_PTL_MREPT’,
         application             => v_application);          --— ‘PFC Records’
      COMMIT;
   END;
   PROCEDURE XXCREATE_CONCURRENT_PROGRAM (
      /* –===========================================
      –Create Concurrent Program Define FROM BACK END
      –============================================*/
      V_PROGRAME                  VARCHAR2,
      V_APPLICATION               VARCHAR2,
      V_ENABLED                   VARCHAR2,
      V_SHORT_NAME                VARCHAR2,
      V_EXECUTABLE_SHORT_NAME     VARCHAR2,
      V_EXECUTABLE_APPLICATION    VARCHAR2,
      V_STYLE                     VARCHAR2,
      V_USE_IN_SRS                VARCHAR2,
      V_OUTPUT_TYPE               VARCHAR2)
   IS
   BEGIN
      FND_GLOBAL.APPS_INITIALIZE (user_id        => 0,
                                  resp_id        => 20434,
                                  resp_appl_id   => 101); --— userid,responcibility,application detail
      fnd_program.register (
         program                  => V_PROGRAME, --— ‘Auto Posting MIS Report’,
         application              => V_APPLICATION,         --— ‘PFC Records’,
         enabled                  => V_ENABLED,                       --— ‘Y’,
         short_name               => V_SHORT_NAME,      --–‘XXPRDAUTOPOSTMIS’,
         executable_short_name    => V_EXECUTABLE_SHORT_NAME, --— ‘XXPRDAUTOPOSTMIS’,
         executable_application   => V_EXECUTABLE_APPLICATION, --— ‘PFC Records’,
         style                    => V_STYLE,                        --— ‘A4?,
         use_in_srs               => V_USE_IN_SRS,                    --— ‘Y’,
         output_type              => V_OUTPUT_TYPE                    --–‘XML’
                                                  );
      COMMIT;
   END;
   PROCEDURE XXDELETE_CONCURRENT_PROGRAM (v_program_short_name    VARCHAR2,
                                          v_application           VARCHAR2)
   IS
   /* –===============================================
   TO DELETE CONCURRENT PROGRAM FROM BACK END
   –===============================================*/
   BEGIN
      FND_GLOBAL.APPS_INITIALIZE (user_id        => 0,
                                  resp_id        => 20434,
                                  resp_appl_id   => 101); --/— userid,responcibility,application detail
      FND_PROGRAM.DELETE_PROGRAM (
         program_short_name   => v_program_short_name,   --–‘XXPRD_PTL_MREPT’,
         application          => v_application               --— ‘PFC Records’
                                              );
      COMMIT;
   END;
   PROCEDURE XXCREATE_CON_PROG_PARAMETOR (
/*–===============================================
–Creating Parameters For Concurrent Program
–===============================================*/
                                      V_program_short_name    VARCHAR2,
                                          V_application           VARCHAR2,
                                          V_sequence              NUMBER,
                                          V_parameter             VARCHAR2,
                                          V_description           VARCHAR2,
                                          V_enabled               VARCHAR2,
                                          V_value_set             VARCHAR2,
                                          V_display_size          NUMBER,
                                          V_description_size      NUMBER,
                                          V_concat_des_size       NUMBER,
                                          V_prompt                VARCHAR2,
                                          V_token                 VARCHAR2)
   IS
   BEGIN
      FND_GLOBAL.APPS_INITIALIZE (user_id        => 0,
                                  resp_id        => 20434,
                                  resp_appl_id   => 101); --— userid,responcibility,application detail
      FND_PROGRAM.parameter (
         program_short_name              => V_program_short_name, --–‘XXC_AJ_ORDER1?,
         application                     => V_application, --— ‘Order Management’,
         sequence                        => V_sequence,                 --— 5,
         parameter                       => V_parameter,   --— ‘P_Order_from’,
         description                     => V_description, --— ‘asdfghjklmnopqrstuvxyz123245?,
         enabled                         => V_enabled,                --— ‘Y’,
         value_set                       => V_value_set, --— ‘XDO_15_DIGIT_NUMBER’,
         display_size                    => V_display_size,            --— 25,
         description_size                => V_description_size,        --— 50,
         concatenated_description_size   => V_concat_des_size,         --— 30,
         prompt                          => V_prompt,      --— ‘P_order_from’,
         token                           => V_token              --–‘P_ORDER1?
                                                   );
      COMMIT;
   END;
   PROCEDURE XXDELETE_CON_PROG_PARAMETOR (
   /* –===============================================
      TO DELETE PARAMETER FROM BACK END
    –===============================================*/
                                          V_program_short_name    VARCHAR2,
                                          V_application           VARCHAR2,
                                          V_parameter             VARCHAR2)
   IS
   BEGIN
      FND_GLOBAL.APPS_INITIALIZE (user_id        => 0,
                                  resp_id        => 20434,
                                  resp_appl_id   => 101); --— userid,responcibility,application detail
      FND_PROGRAM.DELETE_PARAMETER (
         program_short_name   => V_program_short_name,      --–‘XXC_AJ_ORDER’,
         application          => V_application,        --— ‘Order Management’,
         parameter            => V_parameter                 --–‘P_Order_to’);
                                            );

      COMMIT;
   END;
   PROCEDURE XXADD_CP_TO_REQST_GROUP (
   /*–===============================================
    — Add To The Request Group
    –===============================================*/
                                      V_program_short_name    VARCHAR2,
                                      V_prog_application      VARCHAR2,
                                      V_request_group         VARCHAR2,
                                      V_grp_appl              VARCHAR2)
   IS
   BEGIN
      FND_GLOBAL.APPS_INITIALIZE (user_id        => 0,
                                  resp_id        => 20434,
                                  resp_appl_id   => 101); --— userid,responcibility,application detail
      fnd_program.ADD_TO_GROUP (program_short_name    => V_program_short_name, --— ‘XXPRDAUTOPOSTMIS’,
                                program_application   => V_prog_application, --— ‘PFC Records’,
                                request_group         => V_request_group, --— ‘GL Concurrent Program Group’,--– ‘OM Concurrent Programs’,
                                group_application     => V_grp_appl --— ‘General Ledger’
                                                                  );
      COMMIT;
   END;
   PROCEDURE XXREMOV_CP_FROM_REQST_GROUP (
   /*–===============================================
    TO REMOVE PROGRAM FROM REQUEST GROUP
  –===============================================*/
                                          V_program_short_name    VARCHAR2,
                                          V_prg_appl              VARCHAR2,
                                          V_reqst_grp             VARCHAR2,
                                          V_grp_appl              VARCHAR2)
   IS
   BEGIN
      FND_GLOBAL.APPS_INITIALIZE (user_id        => 0,
                                  resp_id        => 20434,
                                  resp_appl_id   => 101); --— userid,responcibility,application detail
      fnd_program.REMOVE_FROM_GROUP (
         program_short_name    => V_program_short_name,   --— ‘ORDER_DETAILS’,
         program_application   => V_prg_appl,           --–‘Order Management’,
         request_group         => V_reqst_grp,   --— ‘OM Concurrent Programs’,
         group_application     => V_grp_appl            --— ‘Order Management’
                                            );
      COMMIT;
   END;
   PROCEDURE xxsubmit_xml_cp_4m_bkend (
      v_template_appl_name    VARCHAR2,
      v_template_code         VARCHAR2,
      v_template_language     VARCHAR2,
      v_template_territory    VARCHAR2,
      v_output_format         VARCHAR2,
      v_application           VARCHAR2,
      v_program               VARCHAR2,
      v_description           VARCHAR2,
      v_start_time            VARCHAR2,
      v_sub_request           BOOLEAN := FALSE,
      v_argument1             VARCHAR2 DEFAULT CHR (0),
      v_argument2             VARCHAR2 DEFAULT CHR (0),
      v_argument3             VARCHAR2 DEFAULT CHR (0),
      v_argument4             VARCHAR2 DEFAULT CHR (0),
      v_argument5             VARCHAR2 DEFAULT CHR (0))
   IS
      v_return    BOOLEAN;
      v_request   NUMBER;
   BEGIN
      fnd_global.apps_initialize (user_id        => 2836,
                                  resp_id        => 20434,
                                  resp_appl_id   => 101);
      --— santosh userid,responcibility,application detail
      v_return :=
         fnd_request.add_layout (template_appl_name   => v_template_appl_name,
                                 template_code        => v_template_code,
                                 template_language    => v_template_language,
                                 template_territory   => v_template_territory,
                                 output_format        => v_output_format);
      v_request :=
         fnd_request.submit_request (application   => v_application,
                                     program       => v_program,
                                     description   => v_description,
                                     start_time    => v_start_time,
                                     sub_request   => v_sub_request,
                                     argument1     => v_argument1,
                                     argument2     => v_argument2,
                                     argument3     => v_argument3,
                                     argument4     => v_argument4,
                                     argument5     => v_argument5);
      DBMS_OUTPUT.put_line ('Request Number' || v_request);
   END;
END;

No comments:

Post a Comment