Attach Responsibility to User through API
DECLARE
CURSOR c1
IS
SELECT fa.application_short_name, fr.responsibility_key
FROM fnd_responsibility fr, fnd_application fa
WHERE fr.application_id = fa.application_id
AND fr.responsibility_key LIKE '%INV%';
num_total_rows NUMBER;
BEGIN
num_total_rows := 0;
FOR i IN c1
LOOP
BEGIN
fnd_user_pkg.addresp
(&USER_NAME, /*Application User Name */
i.application_short_name, /*get from Query Below */
i.responsibility_key, /*get from Query Below */
'STANDARD',
/* Most of cases it is ‘STANDARD’ so you can hard code it */
'STANDARD', /* Any comments you want */
SYSDATE, /* Sysdate From Today */
NULL
); /* Sysdate + 365 Rights for Next One Year*/
COMMIT;
num_total_rows := c1%ROWCOUNT;
DBMS_OUTPUT.put_line ('Responsibility Added Successfully');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line
( 'ERROR WHILE ATTACHING RESPONSIBILITIES ==> '
|| SQLCODE
);
ROLLBACK;
END;
END LOOP;
IF num_total_rows > 0
THEN
--DBMS_OUTPUT.new_line;
DBMS_OUTPUT.put_line ('Total Rows Updated = '
|| TO_CHAR (num_total_rows)
);
fnd_file.put_line (fnd_file.LOG, 'Rows Updated:' || num_total_rows);
ELSE
fnd_file.put_line (fnd_file.LOG,
'There is no records available to update'
);
DBMS_OUTPUT.put_line ('There is no records available to update');
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ( ' Responsibility is not added due to '
|| SQLCODE
|| SUBSTR (SQLERRM, 1, 100)
);
ROLLBACK;
END;
DECLARE
CURSOR c1
IS
SELECT fa.application_short_name, fr.responsibility_key
FROM fnd_responsibility fr, fnd_application fa
WHERE fr.application_id = fa.application_id
AND fr.responsibility_key LIKE '%INV%';
num_total_rows NUMBER;
BEGIN
num_total_rows := 0;
FOR i IN c1
LOOP
BEGIN
fnd_user_pkg.addresp
(&USER_NAME, /*Application User Name */
i.application_short_name, /*get from Query Below */
i.responsibility_key, /*get from Query Below */
'STANDARD',
/* Most of cases it is ‘STANDARD’ so you can hard code it */
'STANDARD', /* Any comments you want */
SYSDATE, /* Sysdate From Today */
NULL
); /* Sysdate + 365 Rights for Next One Year*/
COMMIT;
num_total_rows := c1%ROWCOUNT;
DBMS_OUTPUT.put_line ('Responsibility Added Successfully');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line
( 'ERROR WHILE ATTACHING RESPONSIBILITIES ==> '
|| SQLCODE
);
ROLLBACK;
END;
END LOOP;
IF num_total_rows > 0
THEN
--DBMS_OUTPUT.new_line;
DBMS_OUTPUT.put_line ('Total Rows Updated = '
|| TO_CHAR (num_total_rows)
);
fnd_file.put_line (fnd_file.LOG, 'Rows Updated:' || num_total_rows);
ELSE
fnd_file.put_line (fnd_file.LOG,
'There is no records available to update'
);
DBMS_OUTPUT.put_line ('There is no records available to update');
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ( ' Responsibility is not added due to '
|| SQLCODE
|| SUBSTR (SQLERRM, 1, 100)
);
ROLLBACK;
END;
No comments:
Post a Comment