Showing posts with label Useful Queries. Show all posts
Showing posts with label Useful Queries. Show all posts

Tuesday, July 15, 2014

Responsibilites and their associated Menus

SELECT DISTINCT frt.responsibility_name, fmt.user_menu_name
  FROM apps.fnd_responsibility_tl frt,
       apps.fnd_responsibility fr,
       apps.fnd_menus_tl fmt,
       apps.fnd_menus fm,
       apps.fnd_application_tl fat,
       apps.fnd_application fa
 WHERE     frt.responsibility_id(+) = fr.responsibility_id
       AND fr.menu_id = fmt.menu_id
       AND fr.menu_id = fm.menu_id
       AND fat.application_id = fa.application_id
       AND fa.application_id = fr.application_id
       AND frt.LANGUAGE = 'US';

Request Group assigned to Responsibilty

SELECT    responsibility_name responsibility,request_group_name,frg.description 
FROM       fnd_request_groups frg, fnd_responsibility_vl frv 
WHERE     frv.request_group_id = frg.request_group_id 
ORDER BY responsibility_name; 

Responsibility Assigned to Users

SELECT  DISTINCT 
            u.user_id ,SUBSTR (u.user_name, 1, 30)  user_name 
           ,SUBSTR (r.responsibility_name, 1, 60)     responsibility 
           ,SUBSTR (a.application_name, 1, 50)       application 
FROM    fnd_user u, 
           fnd_user_resp_groups g, 
           fnd_application_tl a, 
           fnd_responsibility_tl r 
WHERE  g.user_id(+)                         =   u.user_id 
AND      g.responsibility_application_id  =   a.application_id 
AND      a.application_id                     =   r.application_id 
AND      g.responsibility_id                  =   r.responsibility_id 
ORDER BY SUBSTR (user_name, 1, 30), 
SUBSTR (a.application_name, 1, 50), 
SUBSTR (r.responsibility_name, 1, 60); 

List of Responsibilities in an Instance

SELECT (SELECT application_short_name
FROM   fnd_application fa
WHERE fa.application_id = frt.application_id) application,
          frt.responsibility_id, frt.responsibility_name
FROM  apps.fnd_responsibility_tl frt;

Tuesday, July 1, 2014

SQL query to find out Drop Ship Sales Order, Line, Requisition and Purchase order

select h.order_number,l.line_number SO_Line_number,  ph.segment1
PO_Number,pl.line_num PO_Line_Number,
ph.authorization_status,ph.closed_date,ph.closed_code,
prh.interface_source_code,
prh.segment1 Requisition_number, prl.line_num Requisition_line_number
from
OE_DROP_SHIP_SOURCES ods,
oe_order_headers_all h,
oe_order_lines_all l,
po_line_locations_all pll,
po_lines_all pl,
po_headers_all ph,
po_requisition_headers_all prh,
po_requisition_lines_all prl
where h.header_id = l.header_id
and h.header_id = ods.header_id
and ods.line_location_id = pll.line_location_id
and ods.po_header_id = ph.po_header_id
and ods.po_line_id = pl.po_line_id
and ph.po_header_id = pl.po_header_id
and prh.requisition_header_id = ods.requisition_header_id
and prl.requisition_line_id = ods.requisition_line_id
and prh.requisition_header_id = prl.requisition_header_id
and h.order_number = &sales_order_number;

SQL Query to find sales order lines whose workflow is Purged

Select Line_Id, flow_status_code,ordered_quantity,shipped_quantity, fulfilled_flag, invoice_interface_status_code
From Oe_Order_Lines_All l
where open_flag = 'Y'
And not Exists
(Select 1 From Wf_Items W
Where W.Item_Type='OEOL'
and w.item_key = to_char(l.line_id));

Monday, June 9, 2014

Query to find responsibilities to which a Concurrent program is assigned

SELECT DISTINCT *
FROM apps.fnd_responsibility_tl
WHERE responsibility_id IN
  (SELECT responsibility_id
  FROM apps.fnd_responsibility_vl
  WHERE request_group_id IN
    (SELECT request_group_id
    FROM apps.fnd_request_group_units
    WHERE request_unit_id =
      (SELECT DISTINCT concurrent_program_id
      FROM Apps.fnd_concurrent_programs_tl
      WHERE user_concurrent_program_name = :Concurrent_Program_name
      )
    )
  AND end_date IS NULL
  )
AND "LANGUAGE" LIKE 'US'
ORDER BY responsibility_name;

Query to find out Responsibilities assigned to a user

SELECT UNIQUE u.user_id, SUBSTR (u.user_name, 1, 30) user_name, u.DESCRIPTION,
SUBSTR (r.responsibility_name, 1, 60) responsiblity,
SUBSTR (a.application_name, 1, 50) application
FROM fnd_user u,
fnd_user_resp_groups g,
fnd_application_tl a,
fnd_responsibility_tl r
WHERE g.user_id(+) = u.user_id
and u.user_name='AT640'
--and r.RESPONSIBILITY_NAME like '%'
AND g.responsibility_application_id = a.application_id
AND a.application_id = r.application_id
AND g.responsibility_id = r.responsibility_id
ORDER BY SUBSTR (user_name, 1, 30),
SUBSTR (a.application_name, 1, 50),
SUBSTR (r.responsibility_name, 1, 60)

Script To List The Values Of A Profile Option At All Levels

--Script To List The Values Of A Profile Option At All Levels (Doc ID 803587.1)
SELECT fpo.profile_option_id, fpot.profile_option_name profile_short_name
, substr(fpot.user_profile_option_name,1,60) profile_name
, DECODE(fpov.level_id,10001,'site',10002,'Appl',10003,'Resp',10004,'User') profile_level
, substr(DECODE(fpov.level_id,10001,null, 10002,fa.application_short_name
,10003,fr.responsibility_name, 10004,fu.user_name),1,30) level_value
, fpov.profile_option_value profile_value
FROM fnd_profile_option_values fpov
, fnd_profile_options fpo
, fnd_profile_options_tl fpot
, fnd_application fa
, fnd_responsibility_tl fr
, fnd_user fu
WHERE (fpo.profile_option_name like nvl('X',fpo.profile_option_name) -- Replace X with the profile short name, ie 'ORG_ID'
or fpot.user_profile_option_name like nvl('Y',fpot.user_profile_option_name)) -- Replace Y with profile user name, ie 'MO: Op%'
and fpo.profile_option_name=fpot.profile_option_name
and fpo.profile_option_id = fpov.profile_option_id
and fa.application_id(+)=fpov.level_value
and fr.responsibility_id(+)=fpov.level_value
and fu.user_id(+)=fpov.level_value;

SQL Query To find out File Version

select sub.filename, sub.version
from (
   select adf.filename filename,
   afv.version version,
   rank()over(partition by adf.filename
     order by afv.version_segment1 desc,
     afv.version_segment2 desc,afv.version_segment3 desc,
     afv.version_segment4 desc,afv.version_segment5 desc,
     afv.version_segment6 desc,afv.version_segment7 desc,
     afv.version_segment8 desc,afv.version_segment9 desc,
     afv.version_segment10 desc,
     afv.translation_level desc) as rank1
   from ad_file_versions afv,
     (
     select filename, app_short_name, subdir, file_id
     from ad_files
     where upper(filename) like upper('%&filename%')
     ) adf
   where adf.file_id = afv.file_id
) sub
where rank1 = 1
order by 1

Disclaimer

All content provided on this blog is for informational purposes only. The owners of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. All trademarks, trade names, service marks, copyrighted work and logos referenced here - belong to their respective owners.If you want to report any content that is violating copyright law and you want us to remove it, please contact us.

Featured Post

Complete Oracle P2P cycle