Tuesday, June 3, 2014

Oracle Application Object Library (AOL)

AOL is a collection of pre-built application components and facilities and it consists of forms, 
subroutines, concurrent programs and reports, database tables and objects, messages, menus, 
responsibilities, flex filed definitions, various guides and library functions.

 

Objective:

§  Register custom Application components.

§  Understand the security authorization features of Oracle Applications.

§  Run concurrent programs using Standard Report Submission.

§  Design and implement Key and Descriptive Flex fields.

§  Define and modify user profile options.

 

Agenda:

§  Setting Up Your Application.

§  Flex fields.

§  Profiles.

 

Setting Up Your Application:

§  Oracle Applications and custom applications that integrate with Oracle

§  Applications need to have a particular directory structure where its

§  Components must be available. Those components are,

1.      Forms

2.      Menus

3.      Programs

4.      Reports.

 

Register Functions:

§  A function is a part of an application functionality that is registered under a unique name for the purpose of assigning /excluding it from a responsibility.

§  Application developers register functions when they develop forms.

 

select * from fnd_form_functions

select * from fnd_form_functions_tl

 

Menus:

§  A menu is a hierarchical arrangement of application functions that is displayed in the navigator window.

§  A menu consists of menu entries, which could be a submenu or a function.

§  Form functions are selected and navigated to using Navigator window.

§  Each responsibility has a menu associated with it.

§  Note the Menu name associated with a responsibility.

 

SELECT * FROM FND_RESPONSIBILITY_TL

WHERE RESPONSIBILITY_NAME = 'Application Developer'

 

Menus (Contd.):                                    

 

select * from FND_MENUS_VL

 

SELECT * FROM FND_MENUS

 

SELECT * FROM FND_MENUS_TL

 

SELECT * FROM FND_MENU_ENTRIES

 

SELECT * FROM FND_MENU_ENTRIES_TL

 

§  Query the menu name to find the menu entries.

§  Add your functions as menu entries here or create a new menu with your functions and add that as a sub- menu here.

§  Now you switch the responsibility and check whether your menu entry is appearing in corresponding responsibility.

 

List of Menus Excluded from a given Responsibility:

SELECT frv.responsibility_name,

       fmv.user_menu_name

  FROM fnd_resp_functions frf,

       fnd_menus_vl fmv,

       fnd_responsibility_vl frv

WHERE frf.rule_type = 'M'

   AND frf.action_id = fmv.menu_id

   AND frf.responsibility_id = frv.responsibility_id

   AND frv.responsibility_name = '&resp_name';

 

List of Functions Excluded from a given responsibility:

SELECT frv.responsibility_name,

       fffv.user_function_name

  FROM fnd_resp_functions frf,

       fnd_form_functions_vl fffv,

       fnd_responsibility_vl frv

WHERE frf.rule_type = 'F'

   AND frf.action_id = fffv.function_id

   AND frf.responsibility_id = frv.responsibility_id

   AND frv.responsibility_name = '&resp_name';

 

Concurrent Program Name, Responsibility Name and User Name for a concurrent request id?

SELECT fcr.request_id,

       frv.responsibility_name,

       fcpv.concurrent_program_name prog_short_name,

       fcpv.user_concurrent_program_name con_prog_name,

       fu.user_name requested_by

  FROM fnd_concurrent_requests fcr,

       fnd_concurrent_programs_vl fcpv,

       fnd_user fu,

       fnd_responsibility_vl frv

WHERE fcpv.concurrent_program_id = fcr.concurrent_program_id

   AND fu.user_id = fcr.requested_by

   AND frv.responsibility_id = fcr.responsibility_id

   AND fcr.request_id = &req_id;

 

Concurrent Program:

§  A concurrent program is an executable file that runs simultaneously with online operations and with other concurrent programs.

§  We need a concurrent program for ..

1.      Any long running data intensive program

2.      Operating system script

3.      Oracle Reports

§  The various steps to define and register a concurrent program are.

4.      Define concurrent program executable

5.      Define concurrent program

6.      Include the concurrent program in a request group

7.      Run concurrent program through submit request form.

 

Concurrent Program Executable:

 

 

§  Enter a name for executable and short name.

§  Choose the application to which this

§  executable belongs such that the system will

§  Look for this file in that directory structure.

§  Enter the execution method as

  1. Flex Rpt                                 The execution file is written using the Flex Report API.
  2. Flex Sql                                  The execution file is written using the Flex Sql API.
  3. Host                                        The execution file is a host script.
  4. Oracle Reports                      The execution file is an Oracle Reports file.
  5. PL/SQL Stored Procedure   The execution file is a stored procedure.
  6. SQL*Loader                          the execution file is a SQL script.
  7. SQL*Plus                               the execution file is a SQL*Plus script.
  8. SQL*Report                          the execution file is a SQL*Report script.
  9. Spawned                                The execution file is a C or Pro*C program.
  10. Immediate                              The execution file is a program written to run as a            subroutine of the concurrent manager.

§  Enter the execution file name without the file extension.

§  For PL/SQL stored procedures enter the <package>.<procedure name> in the execution        file name. This procedure must have 2 out parameters of type varchar2 preferably with names errbuf and errout. These two parameters should be added before adding any other parameters.

 

/*=============================================

CREATE CONCURRENT PROGRAM EXECUTABLE FROM BACKEND

==============================================*/ 

SELECT * FROM FND_APPLICATION_VL

WHERE 1=1

AND APPLICATION_SHORT_NAME LIKE 'XXCUST'

 

 

DECLARE

   v_executable   VARCHAR2 (50) := 'XXAA_AR_AGING';

BEGIN

   fnd_global.apps_initialize (user_id           => 1318,

                               resp_id           => 21623,

                               resp_appl_id      => 660

                              );                              

   fnd_program.executable (executable               => 'XXAA Ar Aging Report',                           application              => 'XXCUST Custom Application',

                           short_name               => 'XXAA_AR_AGING',

                           execution_method         => 'Oracle Reports',

                           execution_file_name      => 'XXAA_AR_AGING'

                          );                         

   COMMIT;

   DBMS_OUTPUT.put_line (   'succeefully created executable name is '|| v_executable );

END;

 

 

SELECT * FROM fnd_executables

WHERE execution_file_name = 'XXAA_AR_AGING'

 

/*=============================================

DELETE CONCURRENT PROGRAM EXECUTABLE FROM BACKEND

==============================================*/ 

DECLARE

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING';

BEGIN

   fnd_program.delete_executable (executable_short_name      => v_short_name,

                                  application                => 'XXCUST Custom Application'

                                 );

   COMMIT;

   DBMS_OUTPUT.put_line('Concurrent Program Executable succeefully Deleted'|| v_short_name );

END;

 

 

SELECT * FROM fnd_executables_vl

WHERE execution_file_name = 'XXAA_AR_AGING'

 

Concurrent Program:

§  Define a concurrent program,

§  Choose an executable created, which will be executed once this concurrent program is scheduled to run.

 

 Output formats of a concurrent program:

  • HTML.
  • PDF.
  • TEXT.
  • PS (Post Script).
  • PCL (HP’s Printer Control Language).

§   

 

 

/*=============================================

CREATE CONCURRENT PROGRAM DEFINE FROM BACKEND

==============================================*/ 

SELECT * FROM FND_APPLICATION_VL

WHERE 1=1

AND APPLICATION_NAME = 'XXCUST Custom Application'

 

DECLARE

   v_name   VARCHAR2 (50) := 'XXAA Ar Aging Report';

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING';

BEGIN

   fnd_global.apps_initialize (user_id           => 1318,

                               resp_id           => 21623,

                               resp_appl_id      => 660

                              );

   fnd_program.REGISTER (program                     => v_name,

                         application                 => 'XXCUST Custom Application',

                         enabled                     => 'Y',

                         short_name                  => v_short_name,

                         executable_short_name       => v_short_name,

                         executable_application      => 'XXCUST Custom Application',

                         style                       => 'A4',

                         output_type                 => 'TEXT',

                         use_in_srs                  => 'Y'

                        );

   COMMIT;

   DBMS_OUTPUT.put_line ('succeefully created concurrent program '|| v_short_name );

END;

 

SELECT * FROM fnd_concurrent_programs_vl

WHERE concurrent_program_name='XXAA_AR_AGING'

 

/*=============================================

DELETE CONCURRENT PROGRAM FROM BACKEND

==============================================*/ 

DECLARE

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING';

BEGIN

   fnd_program.delete_program (program_short_name      => v_short_name,

                               application             => 'XXCUST Custom Application'

                              );

   COMMIT;

   DBMS_OUTPUT.put_line ( 'Concurrent Program succeefully Deleted ' || v_short_name );

END;

 

SELECT * FROM fnd_concurrent_programs_vl

WHERE concurrent_program_name='XXAA_AR_AGING'

 

 

Define Concurrent Parameters:

§  The parameters are the placeholders for the input values to a concurrent program.

§  If the execution method of a concurrent program is Oracle Reports then each parameter is linked to the actual report parameter via the “Token” field in the parameters window

§  For PL/SQL stored procedures these parameters are passed to the program by position.

 

/*=============================================

CREATE PARAMETERS TO THE CONCURRENT PROGRAM FROM BACKEND

==============================================*/

DECLARE

   v_cprogram   VARCHAR2 (50) := 'XX_APPS88_HRMS';

BEGIN

   fnd_global.apps_initialize (user_id           => 1318,

                               resp_id           => 21623,

                               resp_appl_id      => 660

                              );

   fnd_program.parameter (program_short_name                 => v_cprogram,

                          application                        => 'Human Resources',

                          SEQUENCE                           => 10,

                          parameter                          => 'Employee Number',

                          enabled                            => 'Y',

                          value_set                          => '240 char',

                          display_size                       => 50,

                          description_size                   => 20,

                          concatenated_description_size      => 20,

                          prompt                             => 'P_EMPLOYEE_NUM',

                          token                              => 'P_EMPLOYEE_NUM'

                         );

   COMMIT;

   DBMS_OUTPUT.put_line (' successfully created parameter for concurrent program ' || v_cprogram );

EXCEPTION

   WHEN OTHERS

        THEN DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

END;

 

 

 

/*=============================================

DELETE PARAMETERS IN THE CONCURRENT PROGRAM FROM BACKEND

==============================================*/ 

DECLARE

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING'; --> Conc Program Short Name

BEGIN

   fnd_program.DELETE_PARAMETER (program_short_name      => v_short_name,

                                 application             => 'XXCUST Custom Application',

                                 parameter               => 'P_DATE'

                                );

   COMMIT;

   DBMS_OUTPUT.put_line (   'Parameter succeefully Deleted For The Concurrent Program ' || v_short_name );

END;

 

 

 

Define Request Group:

§  Note the Request group name for the responsibility, with which you want to attach the concurrent program.

 

SELECT * FROM FND_APPLICATION_VL

WHERE 1=1

AND APPLICATION_NAME = 'XXCUST Custom Application'

 

SELECT * FROM FND_RESPONSIBILITY_VL

WHERE 1=1

AND RESPONSIBILITY_NAME = 'Receivables, Vision Operations (USA)'

 

SELECT * FROM fnd_request_groups

WHERE 1=1

AND request_group_name like 'Receivables All'

 

 

 

Define Request Group (Contd.):

§  Query the request group and add your concurrent program to the group.

§  A request group is a collection of reports and concurrent programs.

§  A system administrator defines request group in order to control user access to reports and concurrent programs.

 

 

/*=============================================

ADD CONCURRENT PROGRAM TO THE REQUEST GROUP FROM BACKEND

==============================================*/ 

SELECT * FROM FND_APPLICATION_VL

WHERE 1=1

AND APPLICATION_NAME = 'XXCUST Custom Application'

 

SELECT * FROM FND_RESPONSIBILITY_VL

WHERE 1=1

AND RESPONSIBILITY_NAME = 'Receivables, Vision Operations (USA)'

 

SELECT * FROM fnd_request_groups

WHERE 1=1

AND request_group_name like 'Receivables All'

 

DECLARE

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING'; --> Conc Program Short Name

BEGIN

   fnd_global.apps_initialize (user_id           => 1318,

                               resp_id           => 21623,

                               resp_appl_id      => 660

                              );

   fnd_program.add_to_group (program_short_name       => v_short_name,

                             program_application      => 'XXCUST Custom Application',

                             request_group            => 'Receivables All',

                             group_application        => 'Receivables'

                            );

   COMMIT;

   DBMS_OUTPUT.put_line (   'succeefully attached concurrent program  to request group' || v_short_name );

EXCEPTION

   WHEN OTHERS

   THEN

      DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

END;

 

 

---->>==============================================================<<----

SELECT fcpt.user_concurrent_program_name,

       frg.request_group_name,

       fcp.concurrent_program_name,

       frt.responsibility_name,

       fat.application_name,

       fa.application_short_name,

       fa.basepath

  FROM fnd_request_group_units frgu,

       fnd_concurrent_programs fcp,

       fnd_concurrent_programs_tl fcpt,

       fnd_request_groups frg,

       fnd_executables fe,

       fnd_responsibility fr,

       fnd_responsibility_tl frt,

       fnd_application_tl fat,

       fnd_application fa

WHERE 1 = 1

   AND fat.application_id = frgu.application_id

   AND frgu.request_unit_id = fcp.concurrent_program_id

   AND frgu.request_group_id = frg.request_group_id

   AND fe.executable_id = fcp.executable_id

   AND fcp.concurrent_program_id = fcpt.concurrent_program_id

   AND frg.request_group_id = fr.request_group_id

   AND fr.responsibility_id = frt.responsibility_id

   AND fa.application_id = fat.application_id

   AND fcpt.user_concurrent_program_name LIKE 'XXAA Ar Aging Report'

ORDER BY 6,4,3,2

;

---->>==============================================================<<----

 

/*=============================================

DELETE CONCURRENT PROGRAM FROM THE REQUEST GROUP FROM BACKEND

==============================================*/ 

DECLARE

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING'; --> Conc Program Short Name

BEGIN

   fnd_global.apps_initialize (user_id           => 1318,

                               resp_id           => 21623,

                               resp_appl_id      => 660

                              );

   fnd_program.remove_from_group (program_short_name       => v_short_name,

                                  program_application      => 'XXCUST Custom Application',

                                  request_group            => 'Receivables All',

                                  group_application        => 'Receivables'

                                 );

   COMMIT;

   DBMS_OUTPUT.put_line (   'Successfully Deleted executable name is ' || v_short_name );

END;

 

 

/*========================================================================*/

SELECT * FROM FND_APPLICATION_VL

WHERE 1=1

AND APPLICATION_NAME = 'XXCUST Custom Application'

 

 

DECLARE

   v_name   VARCHAR2 (50) := 'XXAA Ar Aging Report';

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING';

BEGIN

   fnd_global.apps_initialize (user_id           => 1318,

                               resp_id           => 21623,

                               resp_appl_id      => 660

                              );                              

   fnd_program.executable (executable               => v_name,

                           application              => 'XXCUST Custom Application',

                           short_name               => v_short_name,

                           execution_method         => 'Oracle Reports',

                           execution_file_name      => v_short_name

                          );                         

   COMMIT;

   DBMS_OUTPUT.put_line (   'succeefully created executable name is '|| v_short_name );

END;

 

SELECT * FROM fnd_executables_vl

WHERE execution_file_name = 'XXAA_AR_AGING'

 

--->>>===========================================================

DECLARE

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING';

BEGIN

   fnd_program.delete_executable (executable_short_name      => v_short_name,

                                  application                => 'XXCUST Custom Application'

                                 );

   COMMIT;

   DBMS_OUTPUT.put_line('Concurrent Program Executable succeefully Deleted'|| v_short_name );

END;

 

 

SELECT * FROM fnd_executables_vl

WHERE execution_file_name = 'XXAA_AR_AGING'

 

/*========================================================================*/

 

SELECT * FROM FND_APPLICATION_VL

WHERE 1=1

AND APPLICATION_NAME = 'XXCUST Custom Application'

 

DECLARE

   v_name   VARCHAR2 (50) := 'XXAA Ar Aging Report';

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING';

BEGIN

   fnd_global.apps_initialize (user_id           => 1318,

                               resp_id           => 21623,

                               resp_appl_id      => 660

                              );

   fnd_program.REGISTER (program                     => v_name,

                         application                 => 'XXCUST Custom Application',

                         enabled                     => 'Y',

                         short_name                  => v_short_name,

                         executable_short_name       => v_short_name,

                         executable_application      => 'XXCUST Custom Application',

                         style                       => 'A4',

                         output_type                 => 'TEXT',

                         use_in_srs                  => 'Y'

                        );

   COMMIT;

   DBMS_OUTPUT.put_line ('succeefully created concurrent program '|| v_short_name );

END;

 

 

SELECT * FROM fnd_concurrent_programs_vl

WHERE concurrent_program_name='XXAA_AR_AGING'

 

 

--->>>===========================================================

DECLARE

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING';

BEGIN

   fnd_program.delete_program (program_short_name      => v_short_name,

                               application             => 'XXCUST Custom Application'

                              );

   COMMIT;

   DBMS_OUTPUT.put_line ( 'Concurrent Program succeefully Deleted ' || v_short_name );

END;

 

SELECT * FROM fnd_concurrent_programs_vl

WHERE concurrent_program_name='XXAA_AR_AGING'

 

/*========================================================================*/

 

DECLARE

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING'; --> Conc Program Short Name

BEGIN

   fnd_global.apps_initialize (user_id           => 1318,

                               resp_id           => 21623,

                               resp_appl_id      => 660

                              );

   fnd_program.parameter (program_short_name                 => v_short_name,

                          application                        => 'XXCUST Custom Application',

                          SEQUENCE                           => 10,

                          parameter                          => 'As Of Date',

                          enabled                            => 'Y',

                          value_set                          => '240 char',

                          display_size                       => 50,

                          description_size                   => 20,

                          concatenated_description_size      => 20,

                          prompt                             => 'As Of Date',

                          token                              => 'P_DATE'

                         );

   COMMIT;

   DBMS_OUTPUT.put_line (' successfully created parameter for concurrent program ' || v_short_name );

EXCEPTION

   WHEN OTHERS

        THEN DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

END;

 

--->>>===========================================================

 

DECLARE

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING'; --> Conc Program Short Name

BEGIN

   fnd_program.DELETE_PARAMETER (program_short_name      => v_short_name,

                                 application             => 'XXCUST Custom Application',

                                 parameter               => 'P_DATE'

                                );

   COMMIT;

   DBMS_OUTPUT.put_line (   'Parameter succeefully Deleted For The Concurrent Program ' || v_short_name );

END;

 

/*========================================================================*/

 

SELECT * FROM FND_APPLICATION_VL

WHERE 1=1

AND APPLICATION_NAME = 'XXCUST Custom Application'

 

SELECT * FROM FND_RESPONSIBILITY_VL

WHERE 1=1

AND RESPONSIBILITY_NAME = 'Receivables, Vision Operations (USA)'

 

SELECT * FROM fnd_request_groups

WHERE 1=1

AND request_group_name like 'Receivables All'

 

DECLARE

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING'; --> Conc Program Short Name

BEGIN

   fnd_global.apps_initialize (user_id           => 1318,

                               resp_id           => 21623,

                               resp_appl_id      => 660

                              );

   fnd_program.add_to_group (program_short_name       => v_short_name,

                             program_application      => 'XXCUST Custom Application',

                             request_group            => 'Receivables All',

                             group_application        => 'Receivables'

                            );

   COMMIT;

   DBMS_OUTPUT.put_line (   'succeefully attached concurrent program  to request group' || v_short_name );

EXCEPTION

   WHEN OTHERS

   THEN

      DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

END;

 

 

SELECT fcpt.user_concurrent_program_name,

       frg.request_group_name,

       fcp.concurrent_program_name,

       frt.responsibility_name,

       fat.application_name,

       fa.application_short_name,

       fa.basepath

  FROM fnd_request_group_units frgu,

       fnd_concurrent_programs fcp,

       fnd_concurrent_programs_tl fcpt,

       fnd_request_groups frg,

       fnd_executables fe,

       fnd_responsibility fr,

       fnd_responsibility_tl frt,

       fnd_application_tl fat,

       fnd_application fa

WHERE 1 = 1

   AND fat.application_id = frgu.application_id

   AND frgu.request_unit_id = fcp.concurrent_program_id

   AND frgu.request_group_id = frg.request_group_id

   AND fe.executable_id = fcp.executable_id

   AND fcp.concurrent_program_id = fcpt.concurrent_program_id

   AND frg.request_group_id = fr.request_group_id

   AND fr.responsibility_id = frt.responsibility_id

   AND fa.application_id = fat.application_id

   AND fcpt.user_concurrent_program_name LIKE 'XXAA Ar Aging Report'

ORDER BY 6,4,3,2

;

 

--->>>===========================================================

 

DECLARE

   v_short_name   VARCHAR2 (50) := 'XXAA_AR_AGING'; --> Conc Program Short Name

BEGIN

   fnd_global.apps_initialize (user_id           => 1318,

                               resp_id           => 21623,

                               resp_appl_id      => 660

                              );

   fnd_program.remove_from_group (program_short_name       => v_short_name,

                                  program_application      => 'XXCUST Custom Application',

                                  request_group            => 'Receivables All',

                                  group_application        => 'Receivables'

                                 );

   COMMIT;

   DBMS_OUTPUT.put_line (   'Successfully Deleted executable name is ' || v_short_name );

END;

/*========================================================================*/

 

Concurrent Programs Assigned to a Request Group:

SELECT fcpv.concurrent_program_name short_name,

       fcpv.user_concurrent_program_name conc_prog_name,

       frg.request_group_name req_group_name

  FROM fnd_concurrent_programs_vl fcpv,

       fnd_request_groups frg,

       fnd_request_group_units frgu

WHERE fcpv.concurrent_program_id = frgu.request_unit_id

   AND fcpv.enabled_flag = 'Y'

   AND frgu.request_group_id = frg.request_group_id

   AND frg.request_group_name = '&request_group_name';

 

Check if the concurrent program is assigned to a given responsibility:

SELECT fcpv.concurrent_program_name short_name,

       fcpv.user_concurrent_program_name conc_prog_name,

       frg.request_group_name req_group_name,

       frv.responsibility_name

  FROM fnd_concurrent_programs_vl fcpv,

       fnd_request_groups frg,

       fnd_request_group_units frgu,

       fnd_responsibility_vl frv

WHERE fcpv.concurrent_program_id = frgu.request_unit_id

   AND fcpv.enabled_flag = 'Y'

   AND frgu.request_group_id = frg.request_group_id

   AND frg.request_group_id = frv.request_group_id

   AND frv.responsibility_name = '&resp_name'

   AND fcpv.user_concurrent_program_name = '&con_prg_name';

 

SRS Form:

§  Then use SRS (Standard Report Submission) form for running and monitoring your application’s reports/concurrent programs at specific time interval.

§  This lets user specify run and print options and parameter value for reports and concurrent programs.

§  Use fnd_file.put_line(fnd_file.log, ‘any message’) to show message in conc program log file.

 

Switch Responsibility to ‘Receivables, Vision Operations (USA)à View à Requests à   

 

 

A concurrent request proceeds through three, possibly four, life cycle stages or phases:

ü  Pending                                       Request is waiting to be run

ü  Running                                       Request is running

ü  Completed                                   Request has finished

ü  Inactive                                       Request cannot be run.

 

Concurrent Programs Business Events:

In R12 for concurrent programs submission and completion has business events associated with them
in the concurrent program definition form there is a business events tab which displays the list of events associated

here you specify the points at which business events are enabled. The possible points are:
Request Submitted 
Request On Hold 
Request Resumed 
Request Running 
Program Completed 
Post Processing Started 
Post Processing Ended 
Request Completed
.

But make sure you set the profile "Concurrent: Business Intelligence Integration Enable". You will need to set "Yes" to enable Business Events from Concurrent Processing System

Within each phase, a request’s condition or status may change.  Below appears a listing of each phase and the various states that a concurrent request can go through. 

 

Concurrent Request Phase and Status

Phase: PENDING:

·         Normal: Request is waiting for the next available manager.

·         Standby: Program to run request is incompatible with other program(s) currently running.

·         Scheduled: Request is scheduled to start at a future time or date.

·         WaitingA child request is waiting for its Parent request to mark it ready to run.   

Phase: RUNNING:

·         Normal: Request is running normally.

·         Paused: Parent request pauses for all its child requests to complete. 

·         Resuming: All requests submitted by the same parent request have completed running.  The Parent   request is waiting to be restarted.

·         Terminating: Running request is terminated, by selecting Terminate in the Status field of the Request Details zone.

Phase: COMPLETED:

·         Normal: Request completes normally.

·         Error: Request failed to complete successfully.

·         Warning: Request completes with warnings.  For example, a report is generated successfully but fails to print.

·         Cancelled: Pending or Inactive request is cancelled, by selecting Cancel in the Status field of the Request Details zone.

·         Terminated: Running request is terminated, by selecting Terminate in the Status field of the Request Details zone.

 Phase: INACTIVE:

·         Disabled: Program to run request is not enabled.  Contact your system administrator.

·         On Hold: Pending request is placed on hold, by selecting Hold in the Status field of the Request Details zone.

·         No Manager: No manager is defined to run the request.  Check with your system administrator.

 

Request Set:

§  Request Sets are a method of grouping multiple reports and/or concurrent programs by business function with common run and print options.

§  The various tasks of the request set are linked together to determine the execution order, whether the tasks execute sequentially or in parallel.

§  Stage is a component of a request set used to group requests within the set. All requests in a stage are run in parallel, while stages themselves are run sequentially in the set.

§  Tasks that must operate separately are created in different stages.

§  After defining the initial stage for execution, all subsequent stages are defined under the three completion status codes for the previous stage.

 

 

Useful FND Queries:

1. Concurrent Program Info
SELECT   fcpt.user_concurrent_program_name concurrent_program,

         fdfcu.column_seq_num sequence_number,

         fdfcu.DEFAULT_VALUE DEFAULT_VALUE,

         fdfcut.form_left_prompt prompt,

         fdfcut.description description,

         ffvs.flex_value_set_name,

         fl.meaning,

         fe.executable_name

    FROM apps.fnd_concurrent_programs fcp,

         apps.fnd_concurrent_programs_tl fcpt,

         apps.fnd_concurrent_programs_tl fcpd,

         apps.fnd_descr_flex_col_usage_tl fdfcut,

         apps.fnd_descr_flex_column_usages fdfcu,

         apps.fnd_descr_flex_col_usage_tl fdfcud,

         apps.fnd_application fa,

         apps.fnd_flex_value_sets ffvs,

         apps.fnd_lookups fl,

         apps.fnd_executables fe

   WHERE fcpt.user_concurrent_program_name = 'Payables Open Interface Import'

     AND fcp.concurrent_program_id = fcpt.concurrent_program_id

     AND fcpt.concurrent_program_id = fcpd.concurrent_program_id

     AND fdfcut.application_id = fa.application_id

     AND fdfcut.descriptive_flex_context_code = 'Global Data Elements'

     AND fdfcut.descriptive_flexfield_name = '$SRS$.' || fcp.concurrent_program_name

     AND fdfcut.application_id = fdfcu.application_id

     AND fdfcut.descriptive_flex_context_code = fdfcu.descriptive_flex_context_code

     AND fdfcut.descriptive_flexfield_name = fdfcu.descriptive_flexfield_name

     AND fdfcut.application_column_name = fdfcu.application_column_name

     AND fdfcut.application_id = fdfcud.application_id

     AND fdfcut.descriptive_flex_context_code = fdfcud.descriptive_flex_context_code

     AND fdfcut.descriptive_flexfield_name = fdfcud.descriptive_flexfield_name

     AND fdfcut.application_column_name = fdfcud.application_column_name

     AND fdfcu.flex_value_set_id = ffvs.flex_value_set_id

     AND fcp.execution_method_code = fl.lookup_code

     AND fl.lookup_type = 'CP_EXECUTION_METHOD_CODE'

     AND fcp.executable_id = fe.executable_id

ORDER BY 1, 2, 3

 

SELECT   cpt.user_concurrent_program_name,

         cpt.description,

         cp.concurrent_program_name,

         a.application_short_name,

         e.executable_name,

         cp.creation_date,

         uc.user_name creator,

         cp.last_update_date,

         ulu.user_name updater,

         cp.enabled_flag,

         cp.run_alone_flag,

         cp.srs_flag,

         cp.print_flag,

         cp.save_output_flag,

         cp.required_style,

         cp.output_print_style,

         cp.printer_name,

         cp.minimum_width,

         cp.minimum_length,

         cp.output_file_type,

         cp.enable_trace,

         cp.restart,

         cp.nls_compliant,

         cp.request_set_flag

    FROM applsys.fnd_concurrent_programs cp,

         applsys.fnd_concurrent_programs_tl cpt,

         applsys.fnd_application a,

         applsys.fnd_executables e,

         applsys.fnd_user uc,

         applsys.fnd_user ulu

   WHERE cp.creation_date > TO_DATE ('17-MAY-1995')     -- Enter Creation Date

     AND cp.application_id = cpt.application_id

     AND cp.concurrent_program_id = cpt.concurrent_program_id

     AND cpt.LANGUAGE = SYS_CONTEXT ('USERENV', 'LANG')

     AND cp.application_id = a.application_id

     AND cp.executable_application_id = e.application_id

     AND cp.executable_id = e.executable_id

     AND cp.created_by = uc.user_id

     AND cp.last_updated_by = ulu.user_id

     AND cpt.user_concurrent_program_name = 'Payables Open Interface Import'

ORDER BY cp.concurrent_program_name

2. Concurrent Program parameters
SELECT   cp.concurrent_program_name,

         cu.*,

         vs.flex_value_set_name

    FROM applsys.fnd_concurrent_programs cp,

         applsys.fnd_descr_flex_column_usages cu,

         applsys.fnd_flex_value_sets vs

   WHERE cp.creation_date > TO_DATE ('17-MAY-1995')      --Enter Creation Date

     AND cu.application_id = cp.application_id

     AND cu.descriptive_flexfield_name = '$SRS$.' || cp.concurrent_program_name

     AND cu.flex_value_set_id = vs.flex_value_set_id

     AND cp.concurrent_program_id = :concurrent_program_id --(Enter CONCURRENT_PROGRAM_ID of CONCURRENT_PROGRAM)

ORDER BY cp.concurrent_program_name,

         cu.column_seq_num


3. Concurrent Request Details 

SELECT p.concurrent_program_name,

       pt.user_concurrent_program_name,

       rt.responsibility_name,

       r.*

  FROM applsys.fnd_concurrent_requests r,

       applsys.fnd_concurrent_programs p,

       applsys.fnd_concurrent_programs_tl pt,

       applsys.fnd_responsibility rsp,

       applsys.fnd_responsibility_tl rt

WHERE r.request_id = &request_id                          -- Enter Request ID

   AND r.program_application_id = p.application_id

   AND r.concurrent_program_id = p.concurrent_program_id

   AND p.application_id = pt.application_id

   AND p.concurrent_program_id = pt.concurrent_program_id

   AND pt.LANGUAGE = SYS_CONTEXT ('USERENV', 'LANG')

   AND r.responsibility_application_id = rsp.application_id

   AND r.responsibility_id = rsp.responsibility_id

   AND rsp.application_id = rt.application_id

   AND rsp.responsibility_id = rt.responsibility_id

   AND rt.LANGUAGE = SYS_CONTEXT ('USERENV', 'LANG')


4. Request Group Details

SELECT rga.application_short_name "Req Grp App",

       rg.request_group_name "Request Group Name",

       rg.request_group_code "Request Group Code",

       rg.description "Request Group Desc",

       cp.concurrent_program_name "Concurrent Program",

       ea.application_short_name "Exec App",

       e.executable_name "Executable",

       rga.application_id "Req Grp App ID",

       rg.request_group_id "Req Grp ID",

       e.application_id "Exec App ID"

  FROM applsys.fnd_executables e,

       applsys.fnd_concurrent_programs cp,

       applsys.fnd_request_group_units rgu,

       applsys.fnd_request_groups rg,

       applsys.fnd_application rga,

       applsys.fnd_application ea

WHERE e.application_id LIKE '%'-- Enter Application ID

   AND e.executable_name LIKE '%' -- Enter Executable Name

   AND cp.executable_application_id = e.application_id

   AND cp.executable_id = e.executable_id

   AND cp.enabled_flag = 'Y'

   AND rgu.request_unit_id = cp.concurrent_program_id

   AND rgu.unit_application_id = cp.application_id

   AND rgu.request_unit_type = 'P'

   AND rg.application_id = rgu.application_id

   AND rg.request_group_id = rgu.request_group_id

   AND rga.application_id = rgu.application_id

   AND ea.application_id = e.application_id


5. Request Set Details

SELECT   rst.user_request_set_name,

         rs.request_set_name,

         rsst_start.user_stage_name start_stage,

         rss.display_sequence stage_sequence,

         rss.stage_name,

         rss.request_set_stage_id,

         rss.success_link,

         rss.warning_link,

         rss.error_link,

         rsst.user_stage_name,

         rsst.description stage_description,

         rsp.SEQUENCE program_sequence,

         cp.user_concurrent_program_name,

         pa.*

    FROM applsys.fnd_request_sets_tl rst,

         applsys.fnd_request_sets rs,

         applsys.fnd_request_set_stages_tl rsst_start,

         applsys.fnd_request_set_stages rss,

         applsys.fnd_request_set_stages_tl rsst,

         applsys.fnd_request_set_programs rsp,

         applsys.fnd_concurrent_programs_tl cp,

         applsys.fnd_request_set_program_args pa

   WHERE rs.request_set_name LIKE '%' -- Enter Request Set Name

    AND rs.application_id = rst.application_id

     AND rs.request_set_id = rst.request_set_id

     AND rst.LANGUAGE = SYS_CONTEXT ('USERENV', 'LANG')

     AND rsst_start.set_application_id = rs.application_id

     AND rsst_start.request_set_id = rs.request_set_id

     AND rsst_start.request_set_stage_id = rs.start_stage

     AND rsst_start.LANGUAGE = 'US'

     AND rss.set_application_id = rs.application_id

     AND rss.request_set_id = rs.request_set_id

     AND rsst.set_application_id = rss.set_application_id

     AND rsst.request_set_id = rss.request_set_id

     AND rsst.request_set_stage_id = rss.request_set_stage_id

     AND rsst.LANGUAGE = 'US'

     AND rsp.set_application_id = rss.set_application_id

     AND rsp.request_set_id = rss.request_set_id

     AND rsp.request_set_stage_id = rss.request_set_stage_id

     AND rsp.program_application_id = cp.application_id

     AND rsp.concurrent_program_id = cp.concurrent_program_id

     AND cp.LANGUAGE = 'US'

     AND pa.application_id(+) = rsp.set_application_id

     AND pa.request_set_id(+) = rsp.request_set_id

     AND pa.request_set_program_id(+) = rsp.request_set_program_id

ORDER BY rst.user_request_set_name,

         rss.display_sequence,

         rsp.SEQUENCE,

         pa.descriptive_flex_appl_id,

         pa.descriptive_flexfield_name,

         pa.application_column_name

 

1.Find Locks Info
SELECT SID,

       id1,

       id2,

       lmode,

       request,

       BLOCK

  FROM v$lock

WHERE SID = &sid


2.Find Session Info

SELECT module,

      action,

       SID,

       serial#

  FROM v$session

WHERE action LIKE '%%'


3.Find Lock Mode

SELECT a.SID,

       b.NAME,

       a.id1,

       a.lmode,

       a.request

  FROM v$lock a,

       SYS.obj$ b

WHERE b.obj# = a.id1

 

4.Find Locked Objects 
SELECT   oracle_username,

         os_user_name,

         session_id,

         process,

         locked_mode,

         o.owner,

         o.object_type,

         o.object_name

    FROM v$locked_object l,

         SYS.dba_objects o

   WHERE l.object_id = o.object_id

ORDER BY o.owner,

         o.object_name,

         session_id


5.Control File Query
SELECT * FROM v$controlfile


6.Folder Info Query
SELECT   b.application_short_name,

         d.responsibility_name,

         a.OBJECT,

         c.NAME folder_name

    FROM apps.fnd_default_folders a,

         apps.fnd_application b,

         apps.fnd_folders c,

         apps.fnd_responsibility_vl d

   WHERE a.application_id = b.application_id

     AND a.folder_id = c.folder_id

     AND d.responsibility_id = - (a.user_id)

     AND d.responsibility_name LIKE '%%'

ORDER BY b.application_short_name,

         d.responsibility_name;

 

 

 

 

Create Users and assign Responsibilities:

§  Switch to System Administrator responsibility

§  Navigate to Security-->User-->Define

§  Add or query a User.

§  Add responsibility to user as required.

 

/*=============================================

CREATE APPLICATIONS USER FROM BACKEND

==============================================*/

DECLARE

   v_user_name    VARCHAR2 (30) := UPPER ('Raju');

   v_password     VARCHAR2 (30) := '******';

   v_email        VARCHAR2 (30) := UPPER ('raju@appsassociates.com.com');

BEGIN

   fnd_user_pkg.createuser (x_user_name                 => v_user_name,

                            x_owner                     => NULL,

                            x_unencrypted_password      => v_password,

                            x_start_date                => SYSDATE,

                            x_end_date                  => NULL,

                            x_email_address             => v_email

                           );

   COMMIT;

   DBMS_OUTPUT.put_line ('User:' || v_user_name || 'Created Successfully');

EXCEPTION

   WHEN OTHERS

   THEN

      DBMS_OUTPUT.put_line (   'Unable to create User due to' || SQLCODE || ' ' || SUBSTR (SQLERRM, 1, 100) );

      ROLLBACK;

END;

 

select * from fnd_user

where user_name like 'RAJU'

 

/*=============================================

PASSWORD RESET FOR THE APPLICATIONS USER FROM BACKEND

==============================================*/

DECLARE

   v_user_name      VARCHAR2 (30) := UPPER ('RAJU');

   v_new_password   VARCHAR2 (30) := '********';

   v_status         BOOLEAN;

BEGIN

   v_status         :=

      fnd_user_pkg.changepassword (username         => v_user_name,

                                   newpassword      => v_new_password

                                  );

 

   IF v_status = TRUE

   THEN

      DBMS_OUTPUT.put_line ( 'The password reset successfully for the User:' || v_user_name );

      COMMIT;

   ELSE

      DBMS_OUTPUT.put_line (   'Unable to reset password due to' || SQLCODE || ' ' || SUBSTR (SQLERRM, 1, 100) );

      ROLLBACK;

   END IF;

END;

 

/*=============================================

Assign the Responsibilities to User from Backend 

==============================================*/

DECLARE

V_username  VARCHAR2 (30) := UPPER ('RAJU');

cursor cur is

    SELECT   r.responsibility_key,

             a.application_short_name,

             r.responsibility_name

        FROM fnd_responsibility_vl r,

             fnd_application_vl a

       WHERE a.application_id = r.application_id

         AND responsibility_name IN

                                    ('Application Developer'

                                    ,'Functional Administrator'

                                    ,'XML Publisher Administrator'

                                    ,'System Administrator'

                                    ,'General Ledger, Vision Operations (USA)'

                                    ,'Inventory, Vision Operations (USA)'

                                    ,'Payables, Vision Operations (USA)'

                                    ,'Receivables, Vision Operations (USA)'

                                    ,'Purchasing, Vision Operations (USA)'

                                    )    

    ;        

 

BEGIN

 

    FOR rec in cur

    loop      

       fnd_user_pkg.addresp (username            => V_username,

                             resp_app            => rec.application_short_name,

                             resp_key            => rec.responsibility_key,

                             security_group      => 'STANDARD',

                             description         => NULL,

                             start_date          => SYSDATE,

                             end_date            => NULL

                            );

 

      DBMS_OUTPUT.put_line ( rec.responsibility_name || 'Responsibility Assigned to' || v_username );

      COMMIT; 

    END LOOP;

   

    EXCEPTION

     WHEN OTHERS

        THEN DBMS_OUTPUT.put_line (   'Unable to Assign Responsibilities to User' || SQLCODE || ' ' || SUBSTR (SQLERRM, 1, 100) );

      ROLLBACK; 

END;

 

Key Flex fields:

§  Most businesses use codes made up of meaningful segments to identify Account Number, Part number and other business entities, eg: a company might have a part number

”PAD–NR–YEL–8 1/2x14” indicating a notepad, narrow–ruled, yellow, and 14” by 8 1/2”.

§  A Flex field is a field which is made up of segments. 

§  Each segment has a name and a set of valid values.

§  A Key flex field identifies an entity.

 

Register Key Flex fields:

§  Register your key flex field with Oracle Application Object Library.

§  Each key flex field has one corresponding table, known as the combinations table, where the flex field stores a list of the complete codes, with one column for each segment of the code.

§  There is a corresponding unique ID number (a code combination ID number or CCID) for that code which is also stored in the combination table.

§  A flex field structure is a specific configuration of segments. Same flex field can have multiple segment structure.

 

Customize Key Flex field Segments:

§  A segment is a single sub–field within a flex field. You define the appearance and meaning of individual segments when customizing a flex field.

§  A segment is represented in your database as a single table column.

§  Flex field validates each segment against a set of valid values, which are mostly predefined

§  A flex field qualifier identifies a particular segment of a key flex field.

 

Key Flex field Feature:

§  Dynamic Insertion:

§  The insertion of a new valid combination into a combinations table from a form other than the combinations form.

 

Key Flex field Cross validation:

Cross–Validation:

§  Cross–validation rules prevent users from creating new key flex field combinations that contain values that should not coexist in the same combination.

 

Descriptive Flex fields:

§  Descriptive flex fields provide customizable "expansion space" on your forms. You can use descriptive flex fields to have additional information, important and unique to your business that would not otherwise be captured by the form.

§  A descriptive flex field appears on a form as a single-character, unnamed field enclosed in brackets.

§  Descriptive flex fields have two different types of segments, global and context-sensitive.

§  A global segment is a segment that always appears in the descriptive flex field pop-up window.

§  A context-sensitive segment is a segment that may or may not appear depending upon what other information is present in your form.

 

Global Segments:

§  In Order management, if you want to add some extra Order line information, then query the DFF for “Additional Line Attribute information”

§  Go to Global Data Elements context field.

§  Click segments to view the DFF segments.

 

Global Segments (Contd.):

§  Already used segments for the DFF will appear here

§  You can create a new record and use a previously unused attribute and make it enabled and displayed

§  Save and compile the flex field definition.

§  Navigate to Order Management, Enter orders screen.

§  Enter or query an order and go to line DFF

§  You can see the additional information you enabled now

§  The DFF data gets stored in attribute columns of the base table.

 

Context sensitive Segments:

§  A context-sensitive descriptive flex field can gather context information from either a field on the form, or from a special field (a context field) inside the descriptive flex field pop-up window.

§  If the descriptive flex field derives the context information from a form field, that field is called a reference field for the descriptive flex field.

§  In DFF Segments form check Displayed for the context.

§  Optionally change the prompt of context

§  Choose the reference field from LOV, which should be initially defined in Register DFF form.

 

§  The reference field is same as a normal form field.

§  Reference fields provide a way to map the context-sensitivity of descriptive flex field information that has been captured to existing conditions in your business data.

§  Descriptive flex field segments...

Ø  Multiple Structure

Ø  Reference field

Ø  Structure Column

 

§  If you use a reference field, the value of that field populates its own column. For example, if the reference field on the form is the "Country" field, it populates the "country" column in the table.

§  However, the reference field value also populates the structure (context) column in the table, since that value specifies which structure the flex field displays.

 

Benefits of Flex fields:

§  Flex fields provides features that are required to satisfy the following business needs:

1.      Customize your applications to conform to your current business practice for accounting codes, product codes, and other codes.

2.      Customize your applications to capture data that would not otherwise be tracked by your application.

3.      Have “intelligent fields” that are fields comprised of one or more segments, where each segment has both a value and a meaning.

4.      Rely upon your application to validate the values and the combination of values that you enter in intelligent fields (Cross Validation Rules).

5.      Have the structure of an intelligent field change depending on data in your form or application data.

6.      Customize data fields to your meet your business needs without programming.

7.      Query intelligent fields for very specific information.

 

Value Sets:

 

Ø  Use value set to:

§  Determine which values users can enter into flex field segments and concurrent program parameters.

§  Provide a list of valid values using list of values feature

 

Ø  Validation Type for Value Set:

§  None (not validated at all)

§  Table

§  Independent

§  Dependent

 

Table validated Value Sets:

§  Create a validation table in your database

§  Register your table with Oracle Application Object Library (as a table)

§  Create the necessary grants and synonyms

§  Define a value set that uses your validation table

§  Define your flex field structure to use that value set for a segment.

 

§  Create a value set with a name, format type and length.

§  Specify validation type as Table and click on details button

§  Enter the Application name (optional), table name.

§  Enter the column names which you want to display as value and meaning (optional)

§  Enter the column name which need to be stored in the database in ID field

§  Mention the data type of these columns

§  Enter where and order by clause as appropriate.

 

Independent/Dependent Value Sets:

         Create your independent value set first

         Create your dependent value set, specifying a default value

         Define your independent values

         Define your dependent values.

 

This Query gives details of value sets that are based on a oracle application tables:

Profiles:

User Profile:

 

§  A profile is a set of changeable options that affects the way your application runs

§  System Profile Options

1.      Set by the System administrator

2.      User  cannot change

3.      Any change in the system profile becomes effective only when the user logs on again or change responsibility

§  Personal Profile Options

1.      Set by the System Administrator

2.      User can change the option values

3.      Any changes become effective immediately

§  You need to create a profile in Application Developer responsibility and then assign its system and personal values.

 

§  User Profile Forms:

§  Define new user profile option at the time of developing a new application

§  Profile names must be unique

§  A profile option cannot be deleted.

 

Setting Profile Values:

 

Setting System Profile

 

Values

      Navigate to

      Sysadmin à Profiles

 

Setting Personal Profile

Values:

 

      Click on Menu Edit -> Preferences -> Profile.

 

 

User Profile:

Ø  User Profile Levels

§  A value set at the higher level overrides the one set at the lower level. “User” is the highest level.

§  After implementation System Administrator sets the default profile values at the site level

§  Option values are dynamically set at the run time.

 

User Profile Routines:

Ø  User Profile routines that helps in retrieving option values are,

         FND_PROFILE.GET (name IN varchar2, value OUT varchar2) is a procedure.

         FND_PROFILE.VALUE (name IN varchar2) return varchar2 is a function.

Ø  Syntax  of referring a profile option value in value sets or concurrent program parameters  is :$PROFILES$.option_name

Ø  Seeded profiles are

     USERNAME

     USER_ID

     RESP_ID

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SELECT * FROM FND_APPLICATION_VL

WHERE 1=1

AND APPLICATION_NAME = 'XXCUST Custom Application'

 

SELECT * FROM FND_RESPONSIBILITY_VL

WHERE 1=1

AND RESPONSIBILITY_NAME = 'Receivables, Vision Operations (USA)'

 

SELECT * FROM fnd_request_groups

WHERE 1=1

AND request_group_name like 'Receivables All'

 

 

/*==========================

PACKAGE SPECIFICATION

===========================*/

CREATE OR REPLACE PACKAGE apps.xxaa_fnd_concprg_registration

AS

   v_executable    VARCHAR2 (50) := 'XXAA_AR_AGING';

   v_application   VARCHAR2 (20) := 'Receivables';

   v_cprogram      VARCHAR2 (50) := 'XXAA_AR_AGING';

   v_exec          NUMBER (2);

   v_cp            NUMBER (2);

   v_req_id        NUMBER (10);

 

   PROCEDURE xxaa_fnd_concprg_executable;

 

   PROCEDURE xxaa_fnd_concprg_define;

 

   PROCEDURE xxaa_fnd_concprg_parameter;

 

   PROCEDURE xxaa_fnd_concprg_addtogroup;

 

   PROCEDURE xxaa_fnd_concprg_submit;

 

   PROCEDURE xxaa_fnd_concprg_wait_request;

 

   PROCEDURE xxaa_fnd_concprg_main;

END;

/

 

/*==========================

PACKAGE BODY

===========================*/

CREATE OR REPLACE PACKAGE BODY apps.xxaa_fnd_concprg_registration

AS

/*

Author              :   Oralce Applications

Created_Date        :  

Last_Update_by      :      

Last_Updated_Date   :   

Purpose             :   Used Register Concurrent Program into apps (by creating Executable, Define and Submit the Concurrent Program)

*/

   ----->>>=======================================================

 

   PROCEDURE xxaa_fnd_concprg_executable

   IS

   BEGIN

      SELECT COUNT (*)

        INTO v_exec

        FROM fnd_executables

       WHERE executable_name = v_executable;

 

      IF v_exec = 0

      THEN

         fnd_global.apps_initialize (user_id           => 1318,

                                     resp_id           => 21623,

                                     resp_appl_id      => 660

                                    );

                                   

         fnd_program.executable (executable               => v_executable,

                                 application              => v_application,

                                 short_name               => v_executable,

                                 execution_method         => 'Oracle Reports',

                                 execution_file_name      => v_executable

                                );

         COMMIT;

         DBMS_OUTPUT.put_line (   'succeefully created executable name is ' || v_executable );

      ELSE

         DBMS_OUTPUT.put_line (   'this executable ' || v_executable || 'is already created' );

      END IF;

   EXCEPTION

      WHEN OTHERS

      THEN

         DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

   END xxaa_fnd_concprg_executable;

  

   ----->>>=======================================================

 

   PROCEDURE xxaa_fnd_concprg_define

   IS

   BEGIN

      SELECT COUNT (*)

        INTO v_exec

        FROM fnd_executables

       WHERE executable_name = v_executable;

 

      IF v_exec = 1

      THEN

         --DBMS_OUTPUT.PUT_LINE ('succeefully created executable name is '||V_EXECUTABLE) ;

         SELECT COUNT (*)

           INTO v_cp

           FROM fnd_concurrent_programs

          WHERE concurrent_program_name = v_cprogram;

 

         IF v_cp = 0

         THEN

            fnd_global.apps_initialize (user_id           => 1318,

                                        resp_id           => 21623,

                                        resp_appl_id      => 660

                                       );

            fnd_program.REGISTER (program                     => v_cprogram,

                                  application                 => v_application,

                                  enabled                     => 'Y',

                                  short_name                  => v_cprogram,

                                  executable_short_name       => v_executable,

                                  executable_application      => v_application,

                                  style                       => 'A4',

                                  output_type                 => 'TEXT',

                                  use_in_srs                  => 'Y'

                                 );

            COMMIT;

            DBMS_OUTPUT.put_line (   'succeefully created concurrent program ' || v_cprogram );

         ELSE

            DBMS_OUTPUT.put_line (   'concurrent program is not created' || SQLCODE || SQLERRM );

         END IF;

      ELSE

         DBMS_OUTPUT.put_line (   'this executable' || v_executable || ' is not created ' );

      END IF;

   EXCEPTION

      WHEN OTHERS

      THEN

         DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

   END xxaa_fnd_concprg_define;

  

   ----->>>=======================================================

 

   PROCEDURE xxaa_fnd_concprg_parameter

   IS

   BEGIN

      SELECT COUNT (*)

        INTO v_cp

        FROM fnd_concurrent_programs

       WHERE concurrent_program_name = v_cprogram;

 

      IF v_cp = 1

      THEN

         BEGIN

            --DBMS_OUTPUT.PUT_LINE ('succeefully created concurrent program '||V_EXECUTABLE) ;

            fnd_global.apps_initialize (user_id           => 1318,

                                        resp_id           => 21623,

                                        resp_appl_id      => 660

                                       );

            fnd_program.parameter (program_short_name                 => v_cprogram,

                                   application                        => v_application,

                                   SEQUENCE                           => 10,

                                   parameter                          => 'Date From',

                                   enabled                            => 'Y',

                                   value_set                          => '240 char',

                                   display_size                       => 50,

                                   description_size                   => 20,

                                  concatenated_description_size      => 20,

                                   prompt                             => 'Date From',

                                   token                              => 'P_DATE_FROM'

                                  );

            COMMIT;

            DBMS_OUTPUT.put_line

                (   ' successfully created parameter for concurrent program  '

                 || v_cprogram

                );

         EXCEPTION

            WHEN OTHERS

           THEN

               DBMS_OUTPUT.put_line ('ERROR OUT HERE' || SQLCODE || SQLERRM);

         END;

 

         BEGIN

            fnd_program.parameter (program_short_name                 => v_cprogram,

                                   application                        => v_application,

                                   SEQUENCE                           => 20,

                                   parameter                          => 'Date To',

                                   enabled                            => 'Y',

                                   value_set                          => '240 char',

                                   display_size                       => 50,

                                   description_size                   => 20,

                                   concatenated_description_size      => 20,

                                   prompt                             => 'Date To',

                                   token                              => 'P_DATE_TO'

                                  );

            COMMIT;

            DBMS_OUTPUT.put_line ('successfully created parameter for concurrent program ' || v_cprogram );

         EXCEPTION

            WHEN OTHERS

            THEN

               DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

         END;

      ELSE

         DBMS_OUTPUT.put_line ('concurrent program ' || v_cprogram || ' is not created' );

      END IF;

   EXCEPTION

      WHEN OTHERS

      THEN

         DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

   END xxaa_fnd_concprg_parameter;

 

   ----->>>=======================================================

 

   PROCEDURE xxaa_fnd_concprg_addtogroup

   IS

   BEGIN

      SELECT COUNT (*)

        INTO v_cp

        FROM fnd_concurrent_programs

       WHERE concurrent_program_name = v_cprogram;

 

      IF v_cp = 1

      THEN

         BEGIN

            fnd_global.apps_initialize (user_id           => 1318,

                                        resp_id           => 21623,

                                        resp_appl_id      => 660

                                       );

            fnd_program.add_to_group

                                   (program_short_name       => v_cprogram,

                                    program_application      => v_application,

                                    request_group            => 'Receivables All',

                                    group_application        => 'Receivables'

                                   );

            COMMIT;

            DBMS_OUTPUT.put_line

                  ('succeefully attached concurrent program  to request group');

         EXCEPTION

            WHEN OTHERS

            THEN

               DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

         END;

      ELSE

         DBMS_OUTPUT.put_line (   'concurrent program ' || v_cprogram || ' IS NOT CREATED' );

      END IF;

   EXCEPTION

      WHEN OTHERS

      THEN

         DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

   END xxaa_fnd_concprg_addtogroup;

 

   ----->>>=======================================================

 

   PROCEDURE xxaa_fnd_concprg_submit

   IS

   BEGIN

      BEGIN

         fnd_global.apps_initialize (user_id           => 1318,

                                     resp_id           => 21623,

                                     resp_appl_id      => 660

                                    );

         v_req_id         :=

            fnd_request.submit_request (application      => 'AR',

                                        program          => v_cprogram,

                                        argument1        => '10',

                                        argument2        => '1000'

                                       );

         COMMIT;

         DBMS_OUTPUT.put_line (   'successfully submitted. request id is' || v_req_id );

      EXCEPTION

         WHEN OTHERS

         THEN

            DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

      END;

   EXCEPTION

      WHEN OTHERS

      THEN

         DBMS_OUTPUT.put_line ('error out here' || SQLCODE || SQLERRM);

   END xxaa_fnd_concprg_submit;

  

   ----->>>=======================================================

 

   PROCEDURE xxaa_fnd_concprg_wait_request

   IS

      v_req_id2   NUMBER (2);

      v_phase     VARCHAR2 (10);

      v_status    VARCHAR2 (10);

      v_phase1    VARCHAR2 (10);

      v_status1   VARCHAR2 (10);

      v_phase2    VARCHAR2 (10);

      v_status2   VARCHAR2 (10);

      v_b         BOOLEAN;

   BEGIN

      SELECT COUNT (*)

        INTO v_req_id2

        FROM fnd_concurrent_requests

       WHERE request_id = v_req_id;

 

      IF v_req_id2 = 1

      THEN

         --DBMS_OUTPUT.PUT_LINE ('succeefully submitted request id is '||V_REQ_ID) ;

         BEGIN

            fnd_global.