Monday, 7 April 2014

Query to get the responsibility corresponding to a form

Sometimes we might have to test the functionality of a form but we might not have the responsibility which has to be used to access the form. We can use the following SQL to find out which responsibility should be used by passing the form name into it. In this case we are executing the query to get all the responsibilities where the ‘Transactions’ form is attached. To use the same query for another form change the line,
#=======================================================================
# Writer          : Lokanadham Thandlam
#=======================================================================
SELECT DISTINCT u.user_name, rtl.responsibility_name, ff.function_name, ffl.user_function_name
           FROM fnd_compiled_menu_functions cmf,
                fnd_form_functions ff,
                fnd_form_functions_tl ffl,
                fnd_responsibility r,
                fnd_responsibility_tl rtl,
                fnd_user_resp_groups urg,
                fnd_user u
          WHERE cmf.function_id = ff.function_id
            AND r.menu_id = cmf.menu_id
            AND urg.responsibility_id = r.responsibility_id
            AND rtl.responsibility_id = r.responsibility_id
            AND cmf.grant_flag = 'Y'
            AND r.application_id = urg.responsibility_application_id
            AND u.user_id = urg.user_id
            AND UPPER (ffl.user_function_name) = UPPER ('transactions')----= UPPER ('<<form name>>')
            AND ff.function_id = ffl.function_id
       ORDER BY u.user_name

The result for the above query is as below: It is actually a portion of the all data returned. So Now the responsibilities are shown where you can get the form attached.