Showing posts with label Concurrent Program Registration Scripts. Show all posts
Showing posts with label Concurrent Program Registration Scripts. Show all posts

Friday, 13 December 2013

Executable Delete Script



/***************************************************
*PURPOSE: DELETE  EXECUTABLE FROM BACK-END  
*AUTHOR: Shravan Purohit 
*SYNTAX:
 DELETE_EXECUTABLE (PROGRAM_SHORT_NAME, APPLICATION_SHORT_NAME)               
***************************************************/

DECLARE
   L_EXE_SHORT_NAME    VARCHAR2 (240);
   L_APPL_SHORT_NAME   VARCHAR2 (240);
BEGIN
   -- SET THE VARIABLES FIRST
   L_EXE_SHORT_NAME := 'XX_MOTRAS_SHORT_EXE'; -- CONCURRENT EXECUTABLE SHORT NAME
   L_APPL_SHORT_NAME := 'PO';                        -- APPLICATION SHORT NAME

   -- SEE IF THE EXECUTABLE EXISTS. IF FOUND, DELETE THE PROGRAM
   IF FND_PROGRAM.EXECUTABLE_EXISTS (LV_EXE_SHORT_NAME, L_APPL_SHORT_NAME)
   THEN
      FND_PROGRAM.DELETE_EXECUTABLE (LV_EXE_SHORT_NAME, L_APPL_SHORT_NAME);

      COMMIT;

      DBMS_OUTPUT.PUT_LINE (L_EXE_SHORT_NAME || ' Deleted Successfully');
   -- IF THE PROGRAM EXECUTABLE DOES NOT EXIST IN THE SYSTEM
   ELSE
      DBMS_OUTPUT.PUT_LINE (L_EXE_SHORT_NAME || ' Not Found');
   END IF;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.PUT_LINE ('Error: ' || SQLERRM);
END;

Executable Registration Scripts

/**************************************************
*PURPOSE: To Create an Executable from backend    *
*AUTHOR: Shravan Purohit                    *
****************************************************/

DECLARE
   --
   l_executable            VARCHAR2 (200);
   l_application           VARCHAR2 (200);
   l_short_name            VARCHAR2 (200);
   l_description           VARCHAR2 (200);
   l_execution_method      VARCHAR2 (200);
   l_execution_file_name   VARCHAR2 (200);
   l_subroutine_name       VARCHAR2 (200);
   l_icon_name             VARCHAR2 (200);
   l_language_code         VARCHAR2 (200);
   l_execution_file_path   VARCHAR2 (200);
   l_check                 VARCHAR2 (2);
--
BEGIN
   --
   l_executable := 'XX_MOTRAS_EXE';
   l_application := 'PO';                            -- Application Short Name
   l_short_name := 'XX_MOTRAS_SHORT_EXE';
   l_description := 'Test Script for creating Executable from Backend';
   l_execution_method := 'Oracle Reports';
   l_execution_file_name := 'XX_MOTRAS_FILE';
   l_subroutine_name := NULL;
   l_icon_name := NULL;
   l_language_code := 'US';
   l_execution_file_path := NULL;
   --
   --Calling API to create executable
   --
   apps.fnd_program.executable (
      executable            => l_executable,
      application           => l_application,
      short_name            => l_short_name,
      description           => l_description,
      execution_method      => l_execution_method,
      execution_file_name   => l_execution_file_name,
      subroutine_name       => l_subroutine_name,
      icon_name             => l_icon_name,
      language_code         => l_language_code,
      execution_file_path   => l_execution_file_path
   );
   COMMIT;

   BEGIN
      --
      --To check whether executable is created or not
      --
      SELECT   'Y'
        INTO   l_check
        FROM   fnd_executables
       WHERE   executable_name = 'XX_ORACLEAPPSDNA_EXE';

      DBMS_OUTPUT.put_line ('Executable Created Successfully');
   --
   EXCEPTION
      WHEN NO_DATA_FOUND
      THEN
         DBMS_OUTPUT.put_line ('Executable Registration Failed');
   --
   END;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Executable Registration Failed');
END;