Friday, 28 November 2014

Script to add responsibility to a FND USER

DECLARE
  v_user_name  VARCHAR2(30) := upper('GK0714');
  CURSOR ABC
  IS
  select application_short_name,responsibility_key,responsibility_id
  from
   fnd_responsibility_vl a,
   fnd_application_vl b
  where a.application_id = b.application_id
  and responsibility_name in ('CRM Administrator'
                              'Customer Support',
                              'Alert Manager',
                              'General Ledger Super User');
  CURSOR CDE
  IS
  select responsibility_id
  from fnd_user_resp_groups a,
   fnd_user b
  where a.user_id  = b.user_id
  and b.user_name = v_user_name;
 
BEGIN

FOR CBA IN ABC LOOP
 FOR EDC IN CDE LOOP
   IF (EDC.responsibility_id <> CBA.responsibility_id) THEN
    fnd_user_pkg.addresp (username         => v_user_name,
                         resp_app         => cba.application_short_name,
                         resp_key         => cba.responsibility_key,
                         security_group   => 'STANDARD',
                         description      => NULL,
                         start_date       => SYSDATE-1,
                         end_date         => NULL);
  END IF;
 END LOOP;
END LOOP;
COMMIT;
END;

No comments:

Post a Comment