To add and delete a responsibilities to user from DataBase(Backend)
--API to add responsibilities to a user
BEGIN
fnd_user_pkg.addresp(username =>'XXTEST',
resp_app =>'SYSADMIN',
resp_key =>'SYSTEM_ADMINISTRATOR',
security_group =>'STANDARD',
description => NULL,
start_date =>TO_DATE('01-JAN-2000'),
end_date =>NULL );
COMMIT;
END;
/
(or)
/
declare
l_user_name VARCHAR2(100) := UPPER('XXTEST');
l_resp_key VARCHAR2(100) := 'SYSTEM_ADMINISTRATOR';
l_app_short_name VARCHAR2(100);
BEGIN
SELECT application_short_name
INTO l_app_short_name
FROM fnd_application fa,
fnd_responsibility fr
WHERE fa.application_id = fr.application_id
AND TRUNC(sysdate) BETWEEN start_date AND NVL(end_date, '31-dec-4712')
AND fr.responsibility_key = l_resp_key;
fnd_user_resp_groups_api.load_row
(x_user_name => l_user_name,
x_resp_key => l_resp_key,
x_app_short_name => l_app_short_name ,
x_security_group => 'STANDARD',
x_owner => 'CUST',
x_start_date => TO_CHAR ( SYSDATE, 'YYYY/MM/DD'),
x_end_date => NULL,
x_description => NULL
);
commit;
end;
/
--API to remove responsibilities from that user
BEGIN
fnd_user_pkg.delresp(username =>'XXTEST',
resp_app =>'SYSADMIN',
resp_key =>'SYSTEM_ADMINISTRATOR',
security_group =>'STANDARD' );
COMMIT;
END;
BEGIN
fnd_user_pkg.addresp(username =>'XXTEST',
resp_app =>'SYSADMIN',
resp_key =>'SYSTEM_ADMINISTRATOR',
security_group =>'STANDARD',
description => NULL,
start_date =>TO_DATE('01-JAN-2000'),
end_date =>NULL );
COMMIT;
END;
/
(or)
/
declare
l_user_name VARCHAR2(100) := UPPER('XXTEST');
l_resp_key VARCHAR2(100) := 'SYSTEM_ADMINISTRATOR';
l_app_short_name VARCHAR2(100);
BEGIN
SELECT application_short_name
INTO l_app_short_name
FROM fnd_application fa,
fnd_responsibility fr
WHERE fa.application_id = fr.application_id
AND TRUNC(sysdate) BETWEEN start_date AND NVL(end_date, '31-dec-4712')
AND fr.responsibility_key = l_resp_key;
fnd_user_resp_groups_api.load_row
(x_user_name => l_user_name,
x_resp_key => l_resp_key,
x_app_short_name => l_app_short_name ,
x_security_group => 'STANDARD',
x_owner => 'CUST',
x_start_date => TO_CHAR ( SYSDATE, 'YYYY/MM/DD'),
x_end_date => NULL,
x_description => NULL
);
commit;
end;
/
--API to remove responsibilities from that user
BEGIN
fnd_user_pkg.delresp(username =>'XXTEST',
resp_app =>'SYSADMIN',
resp_key =>'SYSTEM_ADMINISTRATOR',
security_group =>'STANDARD' );
COMMIT;
END;
No comments:
Post a Comment