--
declare
--
l_mode varchar2(10) := 'CreateUser';
--
l_user_name fnd_user.user_name%type := 'AKTEST';
l_employee_id per_all_people_f.person_id%type := 12348;
l_email varchar2(40) := 'aktest@ak.com';
l_begin_date date := trunc(sysdate);
l_resp_app fnd_application.application_short_name%type := 'XXCUST';
l_resp_key fnd_responsibility.responsibility_key%type := 'XXAK_TEST_RESP';
l_security_group fnd_security_groups.security_group_key%type := 'STANDARD';
l_responsibility_id fnd_responsibility.responsibility_id%type := 12345;
l_app_id fnd_application.application_id%type := 67891;
l_security_group_id fnd_security_groups.security_group_id%type := 23456;
--
begin
--
if l_action = 'CreateUser' then
--
--Insert new user record into FND_USER table
fnd_user_pkg.createuser ( x_user_name => l_user_name
, x_employee_id => l_employee_id
, x_email_address => l_email
, x_start_date => l_begin_date
, x_unencrypted_password => 'Welcome1'
, x_owner => 'CUST'
, x_password_lifespan_days => 90 );
-- For a given user, attach a valid responsibility
fnd_user_pkg.addresp ( start_date => l_begin_date
, end_date => null
, username => l_user_name
, resp_app => l_resp_app
, resp_key => l_resp_key
, security_group => l_security_group
, description => null);
elsif l_action = 'UpdateUser' then
--Update any column for a particular user record.here I am just updating the Email Address
fnd_user_pkg.updateuser (x_user_name => l_user_name
,x_owner => 'CUST'
,x_email_address => l_email
);
--Update an existing user/resp/group assignment
fnd_user_resp_groups_api.Update_Assignment( user_id => l_user_id
,responsibility_id => l_responsibility_id
,responsibility_application_id => l_app_id
,security_group_id => l_security_group_id
,start_date => l_begin_date
,end_date => hr_general.end_of_time
,description => NULL);
elsif l_action = 'Delresp' then
-- Detach a responsibility which is currently attached to this given user
fnd_user_pkg.delresp(username => l_user_name
,resp_app => l_resp_app
,resp_key => l_resp_key
,security_group => l_security_group);
end if;
--
commit;
--
--
exception
when others then
dbms_output.put_line('Error :'||sqlerrm);
rollback;
end;
--
declare
--
l_mode varchar2(10) := 'CreateUser';
--
l_user_name fnd_user.user_name%type := 'AKTEST';
l_employee_id per_all_people_f.person_id%type := 12348;
l_email varchar2(40) := 'aktest@ak.com';
l_begin_date date := trunc(sysdate);
l_resp_app fnd_application.application_short_name%type := 'XXCUST';
l_resp_key fnd_responsibility.responsibility_key%type := 'XXAK_TEST_RESP';
l_security_group fnd_security_groups.security_group_key%type := 'STANDARD';
l_responsibility_id fnd_responsibility.responsibility_id%type := 12345;
l_app_id fnd_application.application_id%type := 67891;
l_security_group_id fnd_security_groups.security_group_id%type := 23456;
--
begin
--
if l_action = 'CreateUser' then
--
--Insert new user record into FND_USER table
fnd_user_pkg.createuser ( x_user_name => l_user_name
, x_employee_id => l_employee_id
, x_email_address => l_email
, x_start_date => l_begin_date
, x_unencrypted_password => 'Welcome1'
, x_owner => 'CUST'
, x_password_lifespan_days => 90 );
-- For a given user, attach a valid responsibility
fnd_user_pkg.addresp ( start_date => l_begin_date
, end_date => null
, username => l_user_name
, resp_app => l_resp_app
, resp_key => l_resp_key
, security_group => l_security_group
, description => null);
elsif l_action = 'UpdateUser' then
--Update any column for a particular user record.here I am just updating the Email Address
fnd_user_pkg.updateuser (x_user_name => l_user_name
,x_owner => 'CUST'
,x_email_address => l_email
);
--Update an existing user/resp/group assignment
fnd_user_resp_groups_api.Update_Assignment( user_id => l_user_id
,responsibility_id => l_responsibility_id
,responsibility_application_id => l_app_id
,security_group_id => l_security_group_id
,start_date => l_begin_date
,end_date => hr_general.end_of_time
,description => NULL);
elsif l_action = 'Delresp' then
-- Detach a responsibility which is currently attached to this given user
fnd_user_pkg.delresp(username => l_user_name
,resp_app => l_resp_app
,resp_key => l_resp_key
,security_group => l_security_group);
end if;
--
commit;
--
--
exception
when others then
dbms_output.put_line('Error :'||sqlerrm);
rollback;
end;
--
No comments:
Post a Comment