Thursday, January 8, 2015

Query to get Menus & Functions attached to Responsibility.

  SELECT LEVEL,
                  LPAD (' ', (LEVEL-1)*3)||prompt,
                  Description
    FROM  fnd_menu_entries_vl fme
 WHERE  prompt IS NOT NULL
       AND grant_flag='Y'
      AND NOT EXISTS (SELECT 1
                     FROM fnd_resp_functions frf,
                          fnd_responsibility_vl frv
                    WHERE frv.responsibility_id = frf.responsibility_id
                      AND frf.application_id = frv.application_id
                      AND frf.rule_type='M'
                      AND frf.action_id = NVL(fme.sub_menu_id,-1)
                      AND frv.responsibility_name=:RESP_NAME)
   AND NOT EXISTS (SELECT 1
                     FROM fnd_resp_functions frf,
                          fnd_responsibility_vl frv
                    WHERE frv.responsibility_id = frf.responsibility_id
                      AND frf.application_id = frv.application_id
                      AND frf.rule_type='F'
                      AND frf.action_id = NVL(fme.function_id,-1)
                      AND frv.responsibility_name=:RESP_NAME)                    
 CONNECT BY PRIOR sub_menu_id = menu_id
   AND prompt IS NOT NULL
   AND NOT EXISTS (SELECT 1
                     FROM fnd_resp_functions frf,
                          fnd_responsibility_vl frv
                    WHERE frv.responsibility_id = frf.responsibility_id
                      AND frf.application_id = frv.application_id
                      AND frf.rule_type='M'
                      AND frf.action_id = NVL(fme.menu_id,-1)
                      AND frv.responsibility_name=:RESP_NAME)
 START WITH menu_id = (SELECT menu_id
                         FROM fnd_responsibility_vl
                        WHERE responsibility_name=:RESP_NAME)
ORDER SIBLINGS BY entry_sequence 

4 comments:

  1. This is very Nice it helped lot.

    ReplyDelete
  2. Hi,

    Found the Query very useful, I have one more request, is there any way in which we can find if the menu or function is view only also if the menu or function will affect any transactions.

    ReplyDelete
  3. Awesome.. Very useful!! Thank you!

    ReplyDelete