Way to success...

--"Running Away From Any PROBLEM Only Increases The DISTANCE From The SOLUTION"--.....--"Your Thoughts Create Your FUTURE"--.....--"EXCELLENCE is not ACT but a HABIT"--.....--"EXPECT nothing and APPRECIATE everything"--.....

Wednesday, December 23, 2015

Query to get Responsibility List For Specific Function (Enter Function ID)



SELECT DISTINCT responsibility_name
           FROM fnd_responsibility_vl
          WHERE 1 = 1
            AND menu_id IN (
                   SELECT a.menu_id
                     FROM fnd_menus_vl a, fnd_menu_entries_vl b
                    WHERE a.menu_id = b.menu_id AND b.function_id = 1521 --Enter function id
                   UNION
                   SELECT menu_id
                     FROM fnd_menu_entries
                    WHERE sub_menu_id IN (
                             SELECT menu_id
                               FROM fnd_menu_entries_vl
                              WHERE sub_menu_id IN (
                                       SELECT a.menu_id
                                         FROM fnd_menus_vl a,
                                              fnd_menu_entries_vl b
                                        WHERE a.menu_id = b.menu_id
                                          AND b.function_id = 1521)) -- Enter function id
                   UNION
                   SELECT menu_id
                     FROM fnd_menu_entries_vl
                    WHERE sub_menu_id IN (
                             SELECT a.menu_id
                               FROM fnd_menus_vl a, fnd_menu_entries_vl b
                              WHERE a.menu_id = b.menu_id
                                AND b.function_id = 1521)) -- Enter function id
            AND end_date IS NULL
MINUS
(SELECT c.responsibility_name
   FROM fnd_resp_functions a, fnd_responsibility b, fnd_responsibility_vl c
  WHERE a.action_id = 1521 --Enter function id
    AND b.responsibility_id = a.responsibility_id
    AND b.responsibility_id = c.responsibility_id
    AND c.end_date IS NULL)
       ORDER BY responsibility_name;



No comments:

Post a Comment