Friday, May 16, 2008

Creating users in oracle using PL/SQL.

We can use the 'hr_user_acct_internal.create_fnd_user' API to create the users. The sample code is as follows:

BEGIN
apps.hr_user_acct_internal.create_fnd_user
(p_user_name => 'XXX',
p_password => 'XXX',
p_employee_id => 1234(This is the person id from per_all_people_f),
p_user_id => x_user_id,
p_user_start_date => SYSDATE,
p_email_address => 'XXX',
p_description => 'XXX',
p_password_date => NULL
);
COMMIT;
END;

and to add the responsibility to the user, we can use the following code.

BEGIN
fnd_user_pkg.addresp
(username => 'XXX',
resp_app => user_res_rec.application_short_name,
resp_key => user_res_rec.responsibility_key,
security_group => 'STANDARD',
description => 'DESCRIPTION',
start_date => SYSDATE,
end_date => NULL
);
Commit;
END

No comments: