Follow us: Connect on YouTube Connect on YouTube Connect on YouTube

Pages

Sunday, 8 October 2017

Concurrent Program Overview in Oracle Apps


Concurrent Program

Concurrent Program is an instance of an execution file, along with parameter definitions and incompatibilities
Several concurrent programs may use the same execution file to perform their specific tasks, each having different parameters, defaults and compatibles


Purpose of concurrent program

To satisfy the needs of site users and to give flexibility to administrators to set up concurrent processing
To take advantage of multitasking and parallel processing

Benefits of Concurrent Program

Consistent response time
Portable interface to user computer programs
Online request review
Can control and change certain run options for each of users’ concurrent requests


Concurrent Program Executable

An Executable file is the one that performs a specific task
The file may be a program written in a standard language, a reporting tool or an operating system language


Concurrent request

A request to run a concurrent program is called as a concurrent request

Concurrent Process

An instance of a running concurrent program that runs simultaneously with other concurrent processes

Concurrent Manager

A program that processes user’s requests and runs concurrent Programs
System Administrator defines concurrent manger to run different kind of requests

Concurrent Queue

List of concurrent requests awaiting processing by concurrent manager

  
Request Sets

Request sets define run and print options, and possibly, parameter values, for a collection of reports or concurrent program.

Note:
End users and System Administrators can define request sets. System administrator has request set privileges beyond those of an end user.


Concurrent Managers

When an application user submits a request to run a program, the request is entered into a database table that lists all of the requests. Concurrent managers read requests from the table and start programs running.

Note:
A concurrent manager is itself a concurrent program that starts running other concurrent programs.

Registering a concurrent program in Oracle Apps


The following are the steps required when defining a concurrent program

1.     Define executable for concurrent program

2.     Define the concurrent program

3.     Define parameters for concurrent program if needed

4.     Get the Request Group associated with the Responsibility in which the program is to be run

5.     Add the concurrent program to the Request Group associated with the responsibility

6.       Submit your concurrent program using that responsibility
 

Registering the Concurrent Executable


Responsibility: System Administrator  
Navigation: Concurrent ->Programs ->Executables 
Executables screen in oracle applications



Field description
 
Executable:

   To assign the concurrent program to associate it with the executable logic.



Short Name:

   This is the short name for executable.



Application:

   It determines in which directory structure the concurrent managers should look for the execution file, log and output files.



Description:

   A short description on the Executable may be written in this field.



Execution Method:
   Let us look into some of the most common methods
Host: The execution file is a host script (for example a Shell Script)
Oracle reports
PL/SQL stored procedure: For database objects like PL/SQL packages
SQL*loader: The execution file is a SQL script
SQL*Plus: The execution file is PL/SQL anonymous block
Spawned: The execution file is a C or PRO*C Program
Immediate: The execution file is a program written to run as a subroutine of the concurrent manager
Other options being: Java Stored Procedure; Java Concurrent Program, Multi Language Function; Request Set Stage Function; Perl Concurrent Program

Execution File Name:
    Name of the Execution file (without any file extension) is mentioned in this field

Subroutine Name:
   Name of the C or PRO*C program subroutine is mentioned here [without any spaces or periods(.)] in this  field
 
 
Completing the Registration of Concurrent Executable
 Complete Executables screen in oracle applications

  
Registering the Concurrent Program 



Responsibility: System Administrator  
Navigation: Concurrent ->Programs ->Define 

Concurrent Program in oracle apps

Field description
 
Program:

   Whatever name the user mentions as the Program Name, the same name gets displayed in the Requests window while submitting the concurrent request.



Short Name:

   This is the short name for executable and must be same as mentioned by the user during the Executable registration.



Application:

   It determines in which directory structure the concurrent managers should look for the execution file, log and output files (same as mentioned by the user during the Executable registration).



Description:

   A short description on the Concurrent Program may be written in this field.



Name:
   Executable name that must be same as mentioned by the user during the Executable registration.

Method:
   This is the executable method and must be same as mentioned by the user during the Executable registration. (This field will be disabled and will be same as the one selected during the registering of Executable)

Output:
   User must select a option from HTML, PCL, PDF, PostScript, Text or XML depending on the output of the concurrent program.


Click on the “Parameters” button to add parameters to the concurrent program (if the concurrent program requires any inputs from the user at runtime).


Completing the registering of Concurrent Program
Completed Concurrent program


  Field description

Program:
   This field will get defaulted from the Concurrent Program screen with the Concurrent Program Name.

Application:
   This field will get defaulted from the Concurrent Program screen with the Concurrent Program Application.

Seq:
   The concurrent manager will receive the parameters in the same order in which the user has given the sequence number for the Parameter field.

Parameter:
   Parameter Name must be entered by the user.

Description (Parameter):
   Parameter description may be given here.

Enabled:
   Disabled parameters are not displayed when submitting the request and not passed to execution file. 

Value Set:
   Name of value set to validate the parameter. 

Default Type:
   User may select a default type for the parameter (it maybe Constant, Profile, SQL statement, Segment).

Default Value:
   User may select a default value for the parameter. This is the value which appears automatically in the request submitting screen.

Required:
   This determines if the parameter is mandatory or optional.

Display Characteristics:

Display Size:
   This field determines the Parameter field length in the Parameter form of concurrent request.

Description Size:
   A user sees the prompt instead of the parameter name.

Prompt:
   Prompt gets displayed in the Parameter form while submitting the concurrent program.

Token:
   For a parameter in an Oracle Apps program, the keyword or parameter appears here. (case sensitive)




Completing the Parameter registration for Concurrent Program  

Completed Concurrent Program Parameter screen



Query the Responsibility for Request Group



Responsibility: System Administrator  
Navigation: Security-> Responsibility ->Define


Responsibility screen in oracle apps



Note:
   While Querying for one particular Responsibility, the user must make sure that he/ she is having the responsibility attached to his/her Oracle Apps User-ID.
   Once the Responsibility is queried, the user must make a note of the Request Group field.



Query for the Request Group



Responsibility: System Administrator  
Navigation: Security-> Responsibility ->Request  


Request Group screen in oracle apps



Note:
   Enter the Request Group name in the Group field and query for the Request Group.
   Then attach the Concurrent Program to the Request Group.
 
Field description

Type:
   Concurrent Program type must be mentioned here. It can be Application; Program; Set or Stage Function.
Name:
   Concurrent Program Name must be mentioned in this field.
Application:
   It gets defaulted from the Concurrent Program form.
Description:
   It gets defaulted from the Concurrent Program form.



Attaching the Concurrent Program to a Request Group

Request Group screen after completed in oracle apps

Now the user can run the concurrent request by logging with his user name and using the Application Developer responsibility.


Running the Concurrent Request from Database:


In PL/SQL code you may run the concurrent Request by invoking the following Procedure:


DECLARE
   l_responsibility_id   NUMBER;
   l_application_id      NUMBER;
   l_user_id             NUMBER;
   l_request_id          NUMBER;
BEGIN

   SELECT DISTINCT fr.responsibility_id, frx.application_id
              INTO l_responsibility_id, l_application_id
              FROM apps.fnd_responsibility frx, apps.fnd_responsibility_tl fr
             WHERE fr.responsibility_id = frx.responsibility_id
               AND LOWER (fr.responsibility_name) LIKE LOWER ('XXTest Resp');
   SELECT user_id
     INTO l_user_id
     FROM fnd_user
    WHERE user_name = 'DAYAKAR';
   --To set environment context.
   apps.fnd_global.apps_initialize (l_user_id,
                                    l_responsibility_id,
                                    l_application_id
                                   );

   --Submitting Concurrent Request
   l_request_id :=
      fnd_request.submit_request (application      => 'XXCUST',
                                  program          => 'XXEMP',
                                  description      => 'XXTest Employee Details',
                                  start_time       => SYSDATE,
                                  sub_request      => FALSE,
                                  argument1        => 'Smith'
                                 );
   --
   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');
   END IF;
--
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line (   'Error While Submitting
Concurrent Request '
                            || TO_CHAR (SQLCODE)
                            || '-'
                            || SQLERRM
                           );
END;

/



PL / SQL API’s for Concurrent Programs:



FND_CONC_GLOBAL: This package is used for submitting sub–requests from PL/SQL concurrent programs
FND_CONCURRENT: This package is used for retrieving Information on Submitted Requests
FND_FILE: This package is used for file I/O.
FND_PROGRAM: This package includes procedures for creating concurrent program executables, concurrent programs with parameters and incompatibility rules, request sets, and request groups
FND_SET: The FND_SET package includes procedures for creating concurrent program request sets, adding programs to a request set, deleting programs from a request set. and defining parameters for request sets
FND_REQUEST: This package is used for submitting concurrent requests
FND_REQUEST_INFO: FND_REQUEST_INFO APIs can be used in multi–lingual support functions (MLS functions) to get information for a request.
FND_SUBMIT: This package is used for submitting Request Sets



Which is the better approach?
1.     Registering the concurrent request through Oracle Apps
2.       Registration through PL/SQL script


Registration through PL/SQL script is more advantageous…
Because:
1.     It is very easy to register the program through the PL/SQL script (All you need to do is run the same code in all the required instances)
2.     No manual errors
3.       Registration is faster

Remove the request group incase it is already registered before

BEGIN
   fnd_program.remove_from_group (program_short_name    => 'HRML',
                                  program_application   => 'PER',
                                  request_group         => 'HRMgmt',
                                  group_application     => 'Oracle HR');
   DBMS_OUTPUT.put_line (' Removed the program from the request group');
EXCEPTION
   WHEN NO_DATA_FOUND
   THEN
      NULL;
   WHEN OTHERS
   THEN
      NULL;
END;

Remove the program and Executable incase it is already registered before.

BEGIN
      fnd_program.delete_program    (     program_short_name  =>'‘HRML',
                                                                  application                => 'PER');
      dbms_output.put_line ('Program Deleted');
      fnd_program.delete_executable(    executable_short_name   => 'HRML',
                                                               application                      => 'PER');
      DBMS_OUTPUT.put_line ('Executable  Deleted');
    EXCEPTION
      when others then
        DBMS_OUTPUT.put_line ('Error deleting program: '|| SQLERRM);
END;
 
 
Create the executable program from database



BEGIN
      fnd_program.executable(    executable                => 'HRML',
                      application                => 'PER',
                      short_name              => 'HRML',
                      description                => 'HR Management Module',
                      execution_method    => 'PL/SQL Stored Procedure',
                      execution_file_name  => 'Package_Name.Procedure_Name',
                      subroutine_name         => '');
    EXCEPTION
      when others then
        DBMS_OUTPUT.put_line ('Error Creating Executable: '|| SQLERRM);
    END;


Register the Program from database



BEGIN
   fnd_program.register (program => 'HR MANAGEMENT Module ',
               application                  =>'PER',
                enabled                      =>'Y',
               short_name                   =>'HRML',
                description                  =>'HR Management Module ',
                executable_short_name        =>'HRML',
               executable_application       =>'PER',
                save_output                  =>'Y',
                PRINT                        =>'Y',
            style_required               =>'N',
            use_in_srs                   =>'Y',
                allow_disabled_values        =>'N',
            run_alone                    =>'N');
      EXCEPTION
      when others then
        DBMS_OUTPUT.put_line ('Error in Registering the Program' || SQLERRM);
    END;

Add Parameters:

BEGIN

          fnd_program.parameter(    program_short_name         => 'HRML',
                                application             => 'PER',
                                sequence             => 50,
                                parameter             => 'Start Date',
                                description             => 'Effective Start Date',
                                enabled                     => 'Y',
                                value_set                             => 'FND_STANDARD_DATE',
                   default_type             => 'Current Date',
                required             => 'N',

                                display             => 'Y',
                                display_size             => 11,
                                description_size         => 50,
                                concatenated_description_size    => 25,
                                prompt                                => 'Effective Date');
    DBMS_OUTPUT.put_line ('Added Parameter Effective Start date');
EXCEPTION
      When others then
        DBMS_OUTPUT.put_line ('Error while adding parameter Effective date: ' || SQLERRM);
END;
 


Add the registered concurrent Program to the request group

BEGIN

   fnd_program.add_to_group (program_short_name    => 'ECM_SCF',

                             program_application   => 'PER',

                             request_group         => 'HRMgmt',

                             group_application     => 'Oracle HR');

EXCEPTION

   WHEN OTHERS

   THEN

      DBMS_OUTPUT.

       put_line (

         'Error while adding concurrent program to request group: '
         || SQLERRM);
END;
 


Share this article :

3 comments:

  1. Oracle apps and Fusion Self Paced Training Videos by Industry Experts. Please Check oracleappstechnical.com

    ReplyDelete
  2. Oracle Apps R12 and Oracle Fusion Cloud Self Paced Online Training Videos Published on Udemy with Life Time Access & Live Meeting Support to Clear your Queries. Avail 25% to 80% discount. Please Check https://www.oracleappstechnical.com for Never Before Offers and Discount Coupon Codes.

    ReplyDelete
  3. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. app creator

    ReplyDelete