Tuesday, August 16, 2011

FND User - Programatically creating/updating/adding responsibilities

Following is the sample code to create a FND User 
begin
fnd_user_pkg.CreateUser(
  x_user_name                  => 'HVIRA',
  x_owner                      => 'SEED',
  x_unencrypted_password       => 'change123',
  x_start_date                 => sysdate,
  x_description                => 'Hiten Vira',
  x_email_address              => 'h@w.com');
commit;
end;
/
Following is the sample code to update a FND User 
(Useful when you want to change the password from backend) 
begin
fnd_user_pkg.UpdateUser (
  x_user_name                  => 'HVIRA',
  x_owner                      => 'SEED',
  x_unencrypted_password       => 'change123',
  x_start_date                 => sysdate,
  x_description                => 'Hiten Vira',
  x_email_address              => 'h@w.com');

commit;
end;
/
Following is the sample code to add responsibilities to a FND User
Add/Update the select statements in the FOR loop as per your needs
begin
    for r1 in (
        select 'AR_CM_KEY'                       resp_key,'AR' resp_app from dual union all
        select 'AR_CM_USER_KEY'                  resp_key,'AR' resp_app from dual union all
        select 'APPLICATION_DEVELOPER'           resp_key,'FND' resp_app from dual union all
        select 'IEX_COLLECTION_AGENT'            resp_key,'IEX' resp_app from dual union all
        select 'JTF_RESOURCE_MANAGER_AVIA'       resp_key,'JTF' resp_app from dual union all
        select 'US HR MANAGER'                   resp_key,'PER' resp_app from dual union all
        select 'FNDWF_ADMIN_WEB'                 resp_key,'FND' resp_app from dual union all
        select 'FND_FUNC_ADMIN'                  resp_key,'FND' resp_app from dual union all
        select 'SYSTEM_ADMINISTRATOR'            resp_key,'SYSADMIN' resp_app from dual union all
        select 'XDO_ADMINISTRATION'              resp_key,'XDO' resp_app from dual)
    LOOP
        fnd_user_pkg.AddResp( username => 'HVIRA',
                              resp_app => r1.resp_app,
                              resp_key => r1.resp_key,
                              security_group => 'STANDARD',
                              description    => 'Hiten Vira',
                              start_date     => SYSDATE ,
                              end_date       => NULL);
    end loop;
commit;
end;
/

No comments:

Post a Comment