Some queries which will be helpful when querying on User / Responsibility / Menu in Oracle Apps (eBusiness Suite).
#1. Query to get the Menu/Submenu/Function list (prompts) for a responsibility as you see when you login.
#2. Query to get all the Responsibilities associated with a specific User / all the users which have a specific Responsibility
#1. Query to get the Menu/Submenu/Function list (prompts) for a responsibility as you see when you login.
SELECT(lpad(' ', (LEVEL-1) * 5,' ') ||LEVEL) lvl ,(lpad(' ', (LEVEL-1) * 5,' ') || x.entry_sequence) entry_sequence ,(lpad(' ', (LEVEL-1) * 5,' ') || x.prompt) prompt ,(SELECT(a.user_menu_name ||'['|| a.menu_name ||']')FROMfnd_menus_vl aWHEREa.menu_id = x.sub_menu_id) menu_name ,(SELECT(a.user_function_name ||'['|| a.function_name ||']')FROMfnd_form_functions_vl aWHEREa.function_id = x.function_id) function_name ,x.sub_menu_id ,x.function_id ,x.grant_flagFROMapps.fnd_menu_entries_vl x ,(SELECTa.menu_id ,a.responsibility_idFROMapps.fnd_responsibility_vl aWHEREUPPER(a.responsibility_name) =UPPER('System Administrator')) y-- Replace the responsibility based on your requirementSTARTWITHx.menu_id = y.menu_idANDx.promptIS NOT NULL-- Comment this if you want all the Functions/Menus--Menu/Function ExclusionsAND NVL(x.menu_id,-1)NOT IN(SELECTb.action_idFROMapps.fnd_resp_functions bWHEREb.responsibility_id = y.responsibility_idANDb.rule_type ='M')AND NVL(x.sub_menu_id,-1)NOT IN(SELECTb.action_idFROMapps.fnd_resp_functions bWHEREb.responsibility_id = y.responsibility_idANDb.rule_type ='M')AND NVL(x.function_id,-1)NOT IN(SELECTb.action_idFROMapps.fnd_resp_functions bWHEREb.responsibility_id = y.responsibility_idANDb.rule_type ='F')CONNECT BY PRIORx.sub_menu_id = x.menu_idANDx.promptIS NOT NULL-- Comment this if you want all the Functions/Menus--Menu/Function ExclusionsAND NVL(x.sub_menu_id,-1)NOT IN(SELECTb.action_idFROMapps.fnd_resp_functions bWHEREb.responsibility_id = y.responsibility_idANDb.rule_type ='M')AND NVL(x.function_id,-1)NOT IN(SELECTb.action_idFROMapps.fnd_resp_functions bWHEREb.responsibility_id = y.responsibility_idANDb.rule_type ='F')ORDER SIBLINGS BYx.entry_sequence;
#2. Query to get all the Responsibilities associated with a specific User / all the users which have a specific Responsibility
SELECTresp_type ,user_id ,user_name ,responsibility_id ,responsibility_name ,start_date ,end_date ,application_short_name ,application_nameFROM(SELECT'DIRECT'resp_type ,fu.user_id ,fu.user_name ,resp.responsibility_id ,resp.responsibility_name ,frd.start_date ,frd.end_date ,app.application_short_name ,app.application_nameFROMfnd_user fu ,fnd_user_resp_groups_direct frd ,fnd_responsibility_vl resp ,fnd_application_vl appWHEREfu.user_id = frd.user_idANDfrd.responsibility_id = resp.responsibility_idANDresp.application_id = app.application_idUNION ALL SELECT'INDIRECT'resp_type ,fu.user_id ,fu.user_name ,resp.responsibility_id ,resp.responsibility_name ,fri.start_date ,fri.end_date ,app.application_short_name ,app.application_nameFROMfnd_user fu ,fnd_user_resp_groups_indirect fri ,fnd_responsibility_vl resp ,fnd_application_vl appWHEREfu.user_id = fri.user_idANDfri.responsibility_id = resp.responsibility_idANDresp.application_id = app.application_id)WHERE1=1ANDuser_name ='AJTEST'-- Comment this if you need all user of a responsibilityANDresponsibility_name ='System Administrator';-- Comment this if you need all responsibilities of a user
Feel free to point out if anything is missing/wrong in this blog.
 
What an amazing SQL skills..
ReplyDeleteThank you..
Deletesql 1 was exactly what i needed for financial audit reporting. thank you
ReplyDeleteyou are welome. Glad that this helped.
DeleteHow do you run the first query but for all responsibilities?
ReplyDeleteFound a few queries online for #1, but yours is the only one that worked. THANK YOU!
ReplyDeleteYou are welcome.
Delete