Thursday, August 15, 2019

Assign Responsibility to USER using API



Overview:

    Using API, you assign particular Responsibility to existing user.
        API Name:
              FND_USER_PKG.ADDRESP

    For example: Below example assign responsibility to FND USER

        DECLARE
                  lc_user_name        VARCHAR2(90)    := 'XX007MN';
                  lc_resp_app           VARCHAR2(40)    := 'SYSADMIN';
                  lc_resp_key            VARCHAR2(40)   := 'SYSTEM_ADMINISTRATOR';
                  lc_security_group   VARCHAR2(40)   := 'STANDARD';
                  ld_start_date          DATE                  := TO_DATE('10-JUL-2017');
        BEGIN
             fnd_user_pkg.addresp(username       => lc_user_name,
                                  resp_app          => lc_resp_app,
                                  resp_key          => lc_resp_key,
                                  security_group => lc_security_group,
                                  description      => NULL,
                                  start_date        => ld_start_date,
                                  end_date          => NULL
                                );
             COMMIT;
                dbms_output.put_line('Successfully Responsibility: ' || lc_resp_key || ' assign to User: '||lc_user_name);
        EXCEPTION
               WHEN OTHERS THEN
                    dbms_output.put_line('Unable to assign responsibility to User due to' || SQLCODE || ' ' || SUBSTR(SQLERRM, 1, 100));
            ROLLBACK;
        END;
        /

    After script completed successfully, check data in base table of User:
   
    SELECT u.user_name, frt.responsibility_name, r.responsibility_key, fa.application_short_name, r.start_date
    FROM fnd_user u,
         fnd_user_resp_groups ur,
         fnd_responsibility r,
         fnd_application_tl a,
         fnd_application fa,
         fnd_responsibility_tl frt
   WHERE     u.user_id = ur.user_id
         AND u.user_name = 'XX007MN'
         AND ur.responsibility_id = r.responsibility_id
         AND r.responsibility_id = frt.responsibility_id
         AND fa.application_id = a.application_id
         AND r.application_id = a.application_id
         AND frt.language = 'US'
         AND a.language = 'US'
         AND (r.end_date IS NULL OR r.end_date >SYSDATE)
         AND r.responsibility_key = 'SYSTEM_ADMINISTRATOR'
ORDER BY 1;

No comments:

Post a Comment

Steps to get ZPL code output using Zebra viewer - Online

Introduction ZPL is a print language used by many label printers. A print language is a set of commands that can be used to draw elements li...