API to end date the User in Oracle Apps - FND_USER_PKG.UPDATEUSER
How to Change the END_DATE for Applications Users
--***************************************************************************************************--
--* Author: Danish Halim *--
--* *--
--* Date: 03 March 2023 *--
--* *--
--* Purpose: API to end date the User in Oracle Apps - FND_USER_PKG.UPDATEUSER *--
--* This can be useful to run after a clone of PROD *--
--* - you might want to prevent all users accessing the test instance, *--
--* except a few key users. *--
--* How to Change the END_DATE for Applications Users *-- *--
--***************************************************************************************************--
DECLARE
CURSOR usercur
IS
SELECT fu.user_name
FROM apps.fnd_user fu
WHERE NVL(fu.end_date, SYSDATE + 1) >= SYSDATE
AND fu.user_name IN('SURYA');
/*
AND fu.user_name NOT IN -- EXCLUDE SYSTEM ACCOUNTS ** THIS IS NOT A COMPREHENSIVE LIST **
(
'AME_INVALID_APPROVER',
'APPSMGR',
'ASGADM',
'ASGUEST',
'AUTOINSTALL',
'GUEST',
'IBE_ADMIN',
'IBE_GUEST',
'IBEGUEST',
'IEXADMIN',
'IRC_EMP_GUEST',
'IRC_EXT_GUEST',
'MOBADM',
'MOBDEV',
'MOBILEADM',
'OP_CUST_CARE_ADMIN',
'OP_SYSADMIN',
'PORTAL_PROD',
'PRODAPOID',
'PRODOIDAP',
'SYSADMIN',
'WIZARD'
) -- you can use this list to exclude users if required:
AND fu.user_name NOT IN('TESTUSER1',
'TESTUSER2',
'TESTUSER3');
*/
BEGIN
FOR myuser IN usercur
LOOP
BEGIN
fnd_user_pkg.updateuser ( x_user_name => myuser.user_name,
x_owner => 'ECONET',
x_end_date => TRUNC(SYSDATE-1)
);
DBMS_OUTPUT.PUT_LINE('User End Date : '||myuser.user_name ||' - ' || SQLERRM);
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
DBMS_OUTPUT.PUT_LINE('Exception : '||SQLERRM);
END;
END LOOP;
END;
/
COMMIT;
No comments:
Post a Comment