17 September, 2015

FND User Information

=>Connect as apps user to database and run below query to retrieve User information.
=>This query prompt for user name, Enter user name twice.(Must in Caps letters)

set lines 200
col USER_NAME for a15
col DESCRIPTION for a20
col EMAIL_ADDRESS for a25
col RESPONSIBILITY_NAME for a30
col END_DATE for a17

select  fu.user_name ,  fu.description ,
fu.EMAIL_ADDRESS ,
frt.RESPONSIBILITY_NAME , fu.end_date user_end_date, fur.end_date resp_end_date
 from fnd_user fu,
(select distinct u.user_id, u.user_name, WUR.ROLE_ORIG_SYSTEM_ID RESPONSIBILITY_ID ,
(select application_id
          from fnd_application
         where application_short_name =/* Val between 1st and 2nd separator */
                 replace(substr(WURA.ROLE_NAME,INSTR(WURA.ROLE_NAME, '|', 1, 1)+1,( INSTR(WURA.ROLE_NAME,
 '|', 1, 2)-INSTR(WURA.ROLE_NAME, '|', 1, 1)-1)),'%col', ':')) RESPONSIBILITY_APPLICATION_ID,
       (select security_group_id
          from fnd_security_groups
         where security_group_key =/* Val after 3rd separator */
                 replace(substr(WURA.ROLE_NAME,INSTR(WURA.ROLE_NAME, '|', 1, 3)+1),'%col', ':')
       ) SECURITY_GROUP_ID,
       WURA.START_DATE,
       WURA.END_DATE END_DATE,
wura.relationship_id,
wur.role_orig_system,
wura.role_name,
wura.ASSIGNING_ROLE
from fnd_user u, wf_user_role_assignments wura,
     wf_all_user_roles wur
where u.user_name = wura.user_name
  and wura.relationship_id = -1
  and wur.role_orig_system = 'FND_RESP'
  and not wura.role_name like 'FND_RESP|%|ANY'
  and wura.role_name = wur.role_name
  and wura.user_name = wur.user_name) fur,
fnd_responsibility_tl frt, fnd_responsibility fr
where (fu.end_date is null or fu.end_date>sysdate)
and fu.USER_ID=fur.USER_ID
and frt.language = USERENV('LANG')
and fur.RESPONSIBILITY_APPLICATION_ID=fr.APPLICATION_ID
and fur.RESPONSIBILITY_ID=fr.RESPONSIBILITY_ID
and fr.RESPONSIBILITY_ID=frt.RESPONSIBILITY_ID
and fr.APPLICATION_ID=frt.APPLICATION_ID
and fu.user_name = '&1'
UNION
select  fu.user_name , fu.description ,
fu.EMAIL_ADDRESS ,
NULL , fu.end_date user_end_date, fur.end_date resp_end_date
 from fnd_user fu,
(  select distinct u.user_id, u.user_name, WUR.ROLE_ORIG_SYSTEM_ID RESPONSIBILITY_ID ,
(select application_id
          from fnd_application
         where application_short_name =/* Val between 1st and 2nd separator */
                 replace(substr(WURA.ROLE_NAME,INSTR(WURA.ROLE_NAME, '|', 1, 1)+1,( INSTR(WURA.ROLE_NAME,
 '|', 1, 2)-INSTR(WURA.ROLE_NAME, '|', 1, 1)-1)),'%col', ':')) RESPONSIBILITY_APPLICATION_ID,
       (select security_group_id
          from fnd_security_groups
         where security_group_key =/* Val after 3rd separator */
                 replace(substr(WURA.ROLE_NAME,INSTR(WURA.ROLE_NAME, '|', 1, 3)+1),'%col', ':')
       ) SECURITY_GROUP_ID,
       WURA.START_DATE,
       WURA.END_DATE END_DATE,
wura.relationship_id,
wur.role_orig_system,
wura.role_name,
wura.ASSIGNING_ROLE
from fnd_user u, wf_user_role_assignments wura,
     wf_all_user_roles wur
where u.user_name = wura.user_name
  and wura.relationship_id <> -1
  and wur.role_orig_system = 'FND_RESP'
  and not wura.role_name like 'FND_RESP|%|ANY'
  and wura.role_name = wur.role_name
  and wura.user_name = wur.user_name) fur,
fnd_responsibility_tl frt, fnd_responsibility fr
where (fu.end_date is null or fu.end_date>sysdate)
and fu.USER_ID=fur.USER_ID
and frt.language = USERENV('LANG')
and fur.RESPONSIBILITY_APPLICATION_ID=fr.APPLICATION_ID
and fur.RESPONSIBILITY_ID=fr.RESPONSIBILITY_ID
and fr.RESPONSIBILITY_ID=frt.RESPONSIBILITY_ID
and fr.APPLICATION_ID=frt.APPLICATION_ID
and fu.user_name = '&1'
order by 1;

No comments:

Post a Comment

Useful Scripts

To Find session details using SID. set verify off col sid format 99999 col machine format a10 col program format a25 trunc col username form...