Monday, September 24, 2018

Responsibility Assign Script


DECLARE
   v_resp             VARCHAR2 (30) := 'TJPS - MIR System';
   v_resp_key         VARCHAR2 (30);
   v_app_short_name   VARCHAR2 (50);
BEGIN
   SELECT r.responsibility_key, a.application_short_name
     INTO v_resp_key, v_app_short_name
     FROM fnd_responsibility_vl r, fnd_application_vl a
    WHERE r.application_id = a.application_id
      AND UPPER (r.responsibility_name) = UPPER (v_resp);
   FOR i IN (SELECT DISTINCT emp_num
                        FROM xxtj_mir_user where 1=2)
   LOOP
      BEGIN
         fnd_user_pkg.addresp (username            => i.emp_num,
                               resp_app            => v_app_short_name,
                               resp_key            => v_resp_key,
                               security_group      => 'STANDARD',
                               description         => NULL,
                               start_date          => SYSDATE,
                               end_date            => NULL
                              );
         DBMS_OUTPUT.put_line (   'Responsibility:'
                               || v_resp
                               || ' '
                               || 'is added to the User:'
                               || i.emp_num
                              );
      EXCEPTION
         WHEN OTHERS
         THEN
            DBMS_OUTPUT.put_line
                                (   'Unable to add the responsibility due to'
                                 || SQLCODE
                                 || ' '
                                 || SUBSTR (SQLERRM, 1, 100)
                                 || '-'
                                 || i.emp_num
                                );
      END;
   END LOOP;
   COMMIT;
END;

No comments:

Post a Comment

[ERROR]: The value of s_patch_service_name is not set correctly in atleast one of the context files.

[ERROR]: The value of s_patch_service_name is not set correctly in atleast one of the context files. I got the issue below wh...