DECLARE
lv_user_name VARCHAR2 (20) := 'XXUSER';
--lv_req_resp_key VARCHAR2 (50) := 'APPLICATION_DEVELOPER';
lv_description VARCHAR2 (100) := 'Adding Responsibility to user for report testing';
lv_req_resp_name VARCHAR2 (200);
lv_appl_shrt_name VARCHAR2 (20);
lv_appl_name VARCHAR2 (50);
lv_resp_key VARCHAR2 (50);
BEGIN
lv_user_name VARCHAR2 (20) := 'XXUSER';
--lv_req_resp_key VARCHAR2 (50) := 'APPLICATION_DEVELOPER';
lv_description VARCHAR2 (100) := 'Adding Responsibility to user for report testing';
lv_req_resp_name VARCHAR2 (200);
lv_appl_shrt_name VARCHAR2 (20);
lv_appl_name VARCHAR2 (50);
lv_resp_key VARCHAR2 (50);
BEGIN
for c_cur in (
Select RESPONSIBILITY_KEY lv_req_resp_key,
(select application_short_name from fnd_application_vl fav where fr.application_id = fav.application_id) lv_appl_shrt_name
From apps.fnd_Responsibility fr,
apps.fnd_responsibility_tl frt,
apps.fnd_request_groups frg,
apps.fnd_request_group_units frgu,
apps.fnd_concurrent_programs_tl fcpt
Where upper(fcpt.user_concurrent_program_name) like upper('%Aged Trial Balance with Payments%')
and request_group_name = 'XX_AR_INQ_REPORTS'
and fcpt.concurrent_program_id = frgu.request_unit_id
and frgu.request_group_id = frg.request_group_id
and frg.request_group_id = fr.request_group_id
and fr.responsibility_id = frt.responsibility_id
Order By 2
)
(select application_short_name from fnd_application_vl fav where fr.application_id = fav.application_id) lv_appl_shrt_name
From apps.fnd_Responsibility fr,
apps.fnd_responsibility_tl frt,
apps.fnd_request_groups frg,
apps.fnd_request_group_units frgu,
apps.fnd_concurrent_programs_tl fcpt
Where upper(fcpt.user_concurrent_program_name) like upper('%Aged Trial Balance with Payments%')
and request_group_name = 'XX_AR_INQ_REPORTS'
and fcpt.concurrent_program_id = frgu.request_unit_id
and frgu.request_group_id = frg.request_group_id
and frg.request_group_id = fr.request_group_id
and fr.responsibility_id = frt.responsibility_id
Order By 2
)
loop
fnd_user_pkg.addresp (username => lv_user_name,
resp_app => c_cur.lv_appl_shrt_name,
resp_key => c_cur.lv_req_resp_key,
security_group => 'STANDARD',
description => lv_description,
start_date => SYSDATE,
end_date => NULL
);
COMMIT;
end loop;
DBMS_OUTPUT.put_line ('The responsibility ' || lv_req_resp_name || ' is added to the user ' || lv_user_name);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line ('Responsibility IS NOT added due to ' || SQLCODE || '; ' || SUBSTR (SQLERRM, 1, 250));
ROLLBACK;
END;
No comments:
Post a Comment