Wednesday, July 2, 2014

Assign System Administrator responsibility from backend (using API)

DECLARE
    lc_user_name              VARCHAR2(100)    := '&USER_NAME';
    lc_resp_appl_short_name   VARCHAR2(100)    := 'SYSADMIN';
    lc_responsibility_key     VARCHAR2(100)    := 'SYSTEM_ADMINISTRATOR';
    lc_security_group_key     VARCHAR2(100)    := 'STANDARD';
    ld_resp_start_date        DATE             := TO_DATE('01-JAN-2014');
    ld_resp_end_date          DATE         := NULL;

BEGIN
     fnd_user_pkg.addresp
     (   username            => lc_user_name,
        resp_app             => lc_resp_appl_short_name,
        resp_key             => lc_responsibility_key,
        security_group       => lc_security_group_key,
        description          => NULL,
        start_date           => ld_resp_start_date,
        end_date             => ld_resp_end_date
    );
 COMMIT;

EXCEPTION
    WHEN OTHERS THEN
      ROLLBACK;
      DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
/