SELECT fu.user_name,
fu.user_id,
fu.EMAIL_ADDRESS,
(select hr.FULL_NAME from PER_PEOPLE_F hr
where fu.employee_id = hr.person_id
and nvl(hr.effective_start_date, sysdate-1) < sysdate
and nvl(hr.effective_END_date, sysdate+1) > sysdate) PERSON_NAME,
fu.FAX,
fu.start_date,
fu.end_date,
fu.description,
ftl.application_name,
frv.responsibility_name,
a.start_date responsibility_start_date,
a.end_date responsibility_end_date
FROM
fnd_user fu,
fnd_responsibility_vl frv,
fnd_user_resp_groups_direct a,
fnd_application fa,
fnd_application_tl ftl
WHERE a.user_id = fu.user_id
AND a.responsibility_id = frv.responsibility_id
AND fa.application_id = a.responsibility_application_id
AND fa.application_id = ftl.application_id
AND ftl.language = USERENV('LANG')
AND SYSDATE BETWEEN a.start_date AND NVL(a.end_date,SYSDATE + 1)
AND SYSDATE BETWEEN fu.start_date AND NVL(fu.end_date,SYSDATE + 1)
AND SYSDATE BETWEEN frv.start_date AND NVL(frv.end_date,SYSDATE + 1)
AND fu.user_id > 1100 -- Excludes standard users like SYSADMIN,GUEST etc
UNION ALL
SELECT DISTINCT fu.user_name,
fu.user_id,
fu.EMAIL_ADDRESS,
(select hr.FULL_NAME from PER_PEOPLE_F hr
where fu.employee_id = hr.person_id
and nvl(hr.effective_start_date, sysdate-1) < sysdate
and nvl(hr.effective_END_date, sysdate+1) > sysdate) PERSON_NAME,
fu.FAX,
fu.start_date,
fu.end_date,
fu.description,
ftl.application_name,
frv.responsibility_name,
a.start_date responsibility_start_date,
a.end_date responsibility_end_date
FROM
fnd_user fu,
fnd_responsibility_vl frv,
fnd_user_resp_groups_indirect a,
fnd_application fa,
fnd_application_tl ftl
WHERE a.user_id = fu.user_id
AND a.responsibility_id = frv.responsibility_id
AND fa.application_id = a.responsibility_application_id
AND fa.application_id = ftl.application_id
AND ftl.language = USERENV('LANG')
AND SYSDATE BETWEEN a.start_date AND NVL(a.end_date,SYSDATE + 1)
AND SYSDATE BETWEEN fu.start_date AND NVL(fu.end_date,SYSDATE + 1)
AND SYSDATE BETWEEN frv.start_date AND NVL(frv.end_date,SYSDATE + 1)
AND fu.user_id > 1100 -- Excludes standard users like SYSADMIN,GUEST etc
ORDER BY user_name