API

Enable/Disable Oracle Application Login User by API

How to Disable(end date) large number of Users in Oracle Apps
How to end date large number of Users – fnd_users in Oracle Apps

To Disable/Enable bulk number of users in oracle Applications, we have a API

apps.fnd_user_pkg.EnableUser =>To Enable Users
apps.fnd_user_pkg.DisableUser =>To Disable Users,

Below is the syntax which can used to Huge number of Users in one GO !!
————————————————————————————-

declare cursor cur1 is
select user_name from apps.fnd_user where LOWER(user_name) Not IN (‘username’,’username’, …….);
begin
for all_user in cur1 loop
apps.fnd_user_pkg.EnableUser(all_user.user_name);
commit;
end loop;
End;

——————————————————————————————-

declare cursor cur1 is
select user_name from apps.fnd_user where LOWER(user_name) Not IN (‘username’,’username’, …….);
begin
for all_user in cur1 loop
apps.fnd_user_pkg.DisableUser(all_user.user_name);
commit;
end loop;
End;

Advertisements

Delete Responsibility From Backend in Oracle Apps

/* Formatted on 2017/04/20 12:15 (Formatter Plus v4.8.8) */
DECLARE
v_user_name VARCHAR2 (100) := ‘SAJAL’;
v_responsibility_name VARCHAR2 (100) := ‘Application Developer’;
v_application_name VARCHAR2 (100) := NULL;
v_responsibility_key VARCHAR2 (100) := NULL;
v_security_group VARCHAR2 (100) := NULL;
BEGIN
SELECT fa.application_short_name, fr.responsibility_key,
frg.security_group_key
INTO v_application_name, v_responsibility_key,
v_security_group
FROM fnd_responsibility fr,
fnd_application fa,
fnd_security_groups frg,
fnd_responsibility_tl frt
WHERE fr.application_id = fa.application_id
AND fr.data_group_id = frg.security_group_id
AND fr.responsibility_id = frt.responsibility_id
AND frt.LANGUAGE = USERENV (‘LANG’)
AND frt.responsibility_name = v_responsibility_name;

fnd_user_pkg.delresp (username => v_user_name,
resp_app => v_application_name,
resp_key => v_responsibility_key,
security_group => v_security_group
);
COMMIT;
DBMS_OUTPUT.put_line ( ‘Responsiblity ‘
|| v_responsibility_name
|| ‘ is removed from the user ‘
|| v_user_name
|| ‘ Successfully’
);
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line
( ‘Error encountered while deleting responsibilty from the user and the error is ‘
|| SQLERRM
);
END;
/

Delete Concurrent Program and Executable from Backend in Oracle Apps

DECLARE
l_prog_short_name VARCHAR2 (240);
l_exec_short_name VARCHAR2 (240);
l_appl_full_name VARCHAR2 (240);
l_appl_short_name VARCHAR2 (240);
l_del_prog_flag VARCHAR2 (1) := ‘Y’; –Set flag whether to delete Concurrent program or not
l_del_exec_flag VARCHAR2 (1) := ‘Y’; –Set flag whether to delete executable or not
BEGIN

— set concurrent program and executable short name

l_prog_short_name := ‘XX_TEST_CP’; — Concurrent program short name
l_exec_short_name := ‘XX_TEST_EXEC’; — Executable short name
l_appl_full_name := ‘XX Custom Application’; — Application full name
l_appl_short_name := ‘XXCUST’; — Application Short name


— Check if the program exists. if found, delete the program

IF fnd_program.program_exists (l_prog_short_name, l_appl_short_name)
AND fnd_program.executable_exists (l_exec_short_name, l_appl_short_name)
THEN

IF l_del_prog_flag = ‘Y’
THEN

–API call to delete Concurrent Program

fnd_program.delete_program (l_prog_short_name, l_appl_full_name);

END IF;

IF l_del_exec_flag = ‘Y’
THEN

–API call to delete Executable

fnd_program.delete_executable (l_exec_short_name, l_appl_full_name);

END IF;
COMMIT;

DBMS_OUTPUT.put_line (‘Concurrent Program ‘||l_prog_short_name || ‘ deleted successfully’);
DBMS_OUTPUT.put_line (‘Executable ‘||l_exec_short_name || ‘ deleted successfully’);

— if the program does not exist in the system

ELSE
DBMS_OUTPUT.put_line (l_prog_short_name ||’ or ‘||l_exec_short_name|| ‘ not found’);
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (‘Error while deleting: ‘ || SQLERRM);
END;