Thursday, 8 November 2012

Query : Profile Options Value at all Levels

SELECT pot.user_profile_option_name "Profile",pot.profile_option_name,
       DECODE (a.profile_option_value, '1', '1 (may be "Yes")',
                                       '2', '2 (may be "No")', a.profile_option_value) "Value",
       DECODE (a.level_id, 10001, 'Site',
                           10002, 'Appl',
                           10003, 'Resp',
                           10004, 'User',
                           10006, 'Org', '????') "Level",
       DECODE (a.level_id, 10002, e.application_name,
                           10003, c.responsibility_name,
                           10004, d.user_name,
                           10006, a.level_value, '-') "Location",a.*
FROM applsys.fnd_application_tl e,
     applsys.fnd_user d,
     applsys.fnd_responsibility_tl c,
     applsys.fnd_profile_option_values a,
     applsys.fnd_profile_options b,
     applsys.fnd_profile_options_tl pot
WHERE    b.profile_option_name like 'XX%D%B%LINK%'
      AND pot.profile_option_name = b.profile_option_name
      AND b.application_id = a.application_id(+)
      AND b.profile_option_id = a.profile_option_id(+)
      AND a.level_value = c.responsibility_id(+)
      AND a.level_value = d.user_id(+)
      AND a.level_value = e.application_id(+)
      AND c.language (+)= 'US'
      AND e.language (+)= 'US'
      AND pot.language (+)= 'US'           
ORDER BY "Profile", "Level", "Location", "Value",5

Query : Value Set Values with Qualifier Details (GL Account)

SELECT fv.flex_value_set_id
     , fv.flex_value_id
     , fv.flex_value
     , fv.compiled_value_attributes
     , SUBSTR( fv.compiled_value_attributes, 1, 1 ) allow_budgeting
     , SUBSTR( fv.compiled_value_attributes, 3, 1 ) allow_posting
     , SUBSTR( fv.compiled_value_attributes, 5, 1 ) account_type
     , SUBSTR( fv.compiled_value_attributes, 7, 1 ) third_party_ac_type
     , SUBSTR( fv.compiled_value_attributes, 9, 1 ) reconcile
  FROM fnd_flex_value_sets fvs, fnd_flex_values fv, fnd_flex_validation_qualifiers ffvq
 WHERE     fv.flex_value_set_id = fvs.flex_value_set_id
       AND ffvq.flex_value_set_id = fv.flex_value_set_id
       AND flex_value_set_name = 'XXGL_GBL_ACCOUNT'
       AND flex_value = '030099'
       AND fv.enabled_flag = 'Y';

Query : To extract Concurrent Program Execution Information

  SELECT fcr.request_id
       , fcr.parent_request_id parent_req_id
       , fcr.hold_flag
       , fcr.phase_code phase
       , fcr.status_code status
       , TRUNC( ( NVL( fcr.actual_completion_date, SYSDATE ) - fcr.actual_start_date ) * 24 * 60, 2 ) time_in_mins
       , TRUNC( fcr.actual_start_date - fcr.requested_start_date, 2 ) kick_off_time
       , fcr.requested_start_date req_start_date
       , TO_CHAR( fcr.actual_start_date, 'DD-MON-YYYY HH:MI AM' ) start_date
       , TO_CHAR( fcr.actual_completion_date, 'DD-MON-YYYY HH:MI AM' ) completion_date
       , fcrs.completion_text
       , fu.user_name
       , fcpl.user_concurrent_program_name conc_program_name
       , frl.responsibility_name
       , fcp.concurrent_program_name conc_short_name
       , fcp.executable_id
       , fe.execution_method_code
       , fe.execution_file_path
       , fe.executable_name
       , fe.execution_file_name
       , fl.meaning execution_type
       , fcr.argument_text
       , fcr.printer
       , fcp.concurrent_program_id
       , fcr.outfile_name
       , fcr.logfile_name
       , fcr.has_sub_request
       , fcr.resubmitted
       , fcr.resubmit_interval
       , fu.description
    FROM apps.fnd_executables fe
       , apps.fnd_concurrent_programs fcp
       , apps.fnd_concurrent_programs_tl fcpl
       , apps.fnd_concurrent_requests fcr
       , apps.fnd_lookups fl
       , apps.fnd_responsibility_tl frl
       , apps.fnd_user fu
       , apps.fnd_conc_req_summary_v fcrs
   WHERE     fe.executable_id = fcp.executable_id
         AND fcp.execution_method_code = fe.execution_method_code
         AND fcr.responsibility_application_id = frl.application_id
         AND fcp.concurrent_program_id = fcr.concurrent_program_id
         AND fcpl.concurrent_program_id = fcp.concurrent_program_id                                                             ----
         AND frl.responsibility_id = fcr.responsibility_id
         AND fu.user_id = fcr.requested_by
         AND fl.lookup_code = fe.execution_method_code
         AND fcrs.concurrent_program_id = fcr.concurrent_program_id
         AND fcrs.request_id = fcr.request_id
         AND fl.lookup_type = 'CP_EXECUTION_METHOD_CODE'
         AND fcpl.user_concurrent_program_name IN ('AR Reconciliation Report')
         AND frl.language = 'US'
         AND fcpl.language = 'US'
ORDER BY fcr.requested_start_date DESC, fcr.request_id DESC