Tuesday, February 25, 2014

How to find out execution time of a Concurrent Request in Oracle Apps R12

SELECT   f.request_id,
         pt.user_concurrent_program_name user_concurrent_program_name,
         f.actual_start_date actual_start_date,
         f.actual_completion_date actual_completion_date,
            FLOOR (  (  (f.actual_completion_date - f.actual_start_date)
                      * 24
                      * 60
                      * 60
                     )
                   / 3600
                  )
         || ' HOURS '
         || FLOOR (  (  (  (f.actual_completion_date - f.actual_start_date)
                         * 24
                         * 60
                         * 60
                        )
                      -   FLOOR (  (  (  f.actual_completion_date
                                       - f.actual_start_date
                                      )
                                    * 24
                                    * 60
                                    * 60
                                   )
                                 / 3600
                                )
                        * 3600
                     )
                   / 60
                  )
         || ' MINUTES '
         || ROUND ((  (  (f.actual_completion_date - f.actual_start_date)
                       * 24
                       * 60
                       * 60
                      )
                    -   FLOOR (  (  (  f.actual_completion_date
                                     - f.actual_start_date
                                    )
                                  * 24
                                  * 60
                                  * 60
                                 )
                               / 3600
                              )
                      * 3600
                    - (  FLOOR (  (  (  (  f.actual_completion_date
                                         - f.actual_start_date
                                        )
                                      * 24
                                      * 60
                                      * 60
                                     )
                                   -   FLOOR (  (  (  f.actual_completion_date
                                                    - f.actual_start_date
                                                   )
                                                 * 24
                                                 * 60
                                                 * 60
                                                )
                                              / 3600
                                             )
                                     * 3600
                                  )
                                / 60
                               )
                       * 60
                      )
                   )
                  )
         || ' SECS ' time_difference,
         DECODE (p.concurrent_program_name,
                 'ALECDC', p.concurrent_program_name || '[' || f.description
                  || ']',
                 p.concurrent_program_name
                ) concurrent_program_name,
         DECODE (f.phase_code,
                 'R', 'Running',
                 'C', 'Complete',
                 f.phase_code
                ) phase,
         f.status_code
    FROM apps.fnd_concurrent_programs p,
         apps.fnd_concurrent_programs_tl pt,
         apps.fnd_concurrent_requests f
   WHERE f.concurrent_program_id = p.concurrent_program_id
     AND f.program_application_id = p.application_id
     AND f.concurrent_program_id = pt.concurrent_program_id
     AND f.program_application_id = pt.application_id
     AND pt.LANGUAGE = USERENV ('lang')
     AND f.actual_start_date IS NOT NULL
     AND f.request_id=1234567890

Sunday, February 23, 2014

Find out Executable Details of a Concurrent Program in Oracle Apps R12

SELECT prog.user_concurrent_program_name "program name",
       prog.concurrent_program_name "program short name",
       appl.application_name "program application name",
       prog.description "program description",
       exe.executable_name "executable name",
       exe.execution_file_name "executable file name",
       DECODE (exe.execution_method_code,
               'I', 'PLSQL Stored Procedure',
               'P', 'Report',
               'L', 'SQL Loader',
               'Q', 'SQL*Plus',
               exe.execution_method_code
              ) "execution method"
  FROM fnd_executables exe,
       fnd_application_tl appl,
       fnd_concurrent_programs_vl prog
 WHERE exe.application_id = appl.application_id
   AND exe.executable_id = prog.executable_id
   AND appl.LANGUAGE = 'US'
   AND prog.user_concurrent_program_name = 'XXDA User Concurrent Program Name'

Find out Responsibility & Request Group of a Concurrent Program in Oracle Apps R12

SELECT frt.responsibility_name, frg.request_group_name,
       fcp.concurrent_program_name, fcpt.user_concurrent_program_name
  FROM fnd_request_groups frg,
       fnd_request_group_units frgu,
       fnd_concurrent_programs fcp,
       fnd_concurrent_programs_tl fcpt,
       fnd_responsibility_tl frt,
       fnd_responsibility frs
 WHERE frgu.unit_application_id = fcp.application_id
   AND frgu.request_unit_id = fcp.concurrent_program_id
   AND frg.request_group_id = frgu.request_group_id
   AND frg.application_id = frgu.application_id
   AND fcpt.source_lang = USERENV ('LANG')
   AND fcp.application_id = fcpt.application_id
   AND fcp.concurrent_program_id = fcpt.concurrent_program_id
   AND frs.application_id = frt.application_id
   AND frs.responsibility_id = frt.responsibility_id
   AND frt.source_lang = USERENV ('LANG')
   AND frs.request_group_id = frg.request_group_id
   AND frs.application_id = frg.application_id
   AND fcp.concurrent_program_name LIKE '%XXDA_DA_NAME%'
--AND   fcpt.user_concurrent_program_name LIKE '%XXDA Concurrent Program Name%'   

-- Request Set

SELECT frt.responsibility_name, frg.request_group_name,
       frgu.request_unit_type, frgu.request_unit_id,
       fcpt.user_request_set_name
  FROM apps.fnd_responsibility fr,
       fnd_responsibility_tl frt,
       fnd_request_groups frg,
       fnd_request_group_units frgu,
       fnd_request_sets_tl fcpt
 WHERE frt.responsibility_id = fr.responsibility_id
   AND frg.request_group_id = fr.request_group_id
   AND frgu.request_group_id = frg.request_group_id
   AND fcpt.request_set_id = frgu.request_unit_id
   AND frt.LANGUAGE = USERENV ('LANG')
   AND fcpt.LANGUAGE = USERENV ('LANG')

   AND fcpt.user_request_set_name LIKE 'XXTEST Request Set'

How to make a concurrent program to run for a Single Operating Unit in Oracle Apps R12?

Navigation as follows:

--> System Administrator Responsibility:
--> System Administration --> Concurrent --> Program

1) Enter Concurrent Program Name/Short Name and click on "Go" button
2) Click on Update Pencil bar
3) Go to Request Tab
4) Select the Operating Unit Mode as "Single" from List
5) Click on "Apply" button

How to find out Operating Unit of Responsibility in Oracle Apps R12

SELECT fr.responsibility_name, fpov.profile_option_value orgid, NAME org_name
  FROM fnd_profile_options_vl fpo,
       fnd_profile_option_values fpov,
       applsys.fnd_responsibility_tl fr,
       hr_operating_units hou
 WHERE UPPER (fpo.user_profile_option_name) LIKE UPPER ('MO%OPERATIN%')
   AND profile_option_name = 'ORG_ID'
   AND fpo.profile_option_id = fpov.profile_option_id
   AND TO_NUMBER (fpov.level_value) = fr.responsibility_id
   AND TO_CHAR (hou.organization_id) = TO_CHAR (fpov.profile_option_value)
   AND fr.responsibility_name LIKE 'XXDA_DA_AYAAN_RESP%'

How to find out GL Set of Books of a Responsibility in Oracle Apps R12

SELECT fr.responsibility_name, fpov.profile_option_value set_of_books_name
  FROM fnd_profile_options_vl fpo,
       fnd_profile_option_values fpov,
       applsys.fnd_responsibility_tl fr
 WHERE fpo.user_profile_option_name = 'GL Set of Books Name'
   AND fpo.profile_option_id = fpov.profile_option_id
   AND fpov.level_value = fr.responsibility_id
   AND fr.responsibility_name LIKE 'XXDA_DA_RESP%'

Set Org Context in Oracle Apps R12

BEGIN
MO_GLOBAL.SET_POLICY_CONTEXT('S',204);
END;

Get the File Base Path for a Execution Method in Oracle Apps R12

SELECT fa.basepath
  FROM fnd_application fa, fnd_executables fe
 WHERE fe.application_id = fa.application_id
   AND fe.execution_file_name LIKE 'XXDA_DA_PESA%'