Users attached to Responsibilities and having Approval limits Null 

select hou.name "Org name",

       u.user_name "User Name",

       u.description  "User Description",

       u.start_date "User Start Date",

       u.end_date "User End Date",

       pe.full_name "Employee Name",

   pe.person_id "Employee id",

       pe.effective_start_date "Employee Start Date",

       pe.effective_end_date "Employee End Date",

       (SELECT name

          FROM apps.per_all_positions pap

         WHERE pap.position_id = pas.position_id) "Employee Position",

         amount_limit "PR Approval Amount"

  from apps.fnd_user u,

       apps.fnd_user_resp_groups_direct furg,

       apps.fnd_responsibility_tl frt,

       apps.fnd_responsibility  fr,

       apps.fnd_application_tl  fat,

       apps.fnd_application     fa,

       apps.per_all_people_f pe,

       apps.per_all_assignments_f pas,

       apps.hr_operating_units hou,

        (SELECT paf.person_id,

  paf.assignment_type,

      pcr.amount_limit,

              paf.position_id,

              f.org_id

     FROM apps.per_all_assignments_f paf,

      apps.per_jobs pj,

              apps.po_position_controls_all f,

      apps.po_control_groups_all g,

      apps.po_control_rules pcr

    WHERE TRUNC(SYSDATE) BETWEEN TRUNC(paf.effective_start_date) AND TRUNC(paf.effective_end_date)

      AND paf.primary_flag     = 'Y'

      AND NVL(paf.job_id, -99) = pj.job_id

          AND pj.job_id    = f.job_id

          AND paf.position_id    = f.position_id

          AND f.control_group_id   = g.control_group_id

          AND f.control_function_id = 8 --'Approve Purchase Requisitions'

  AND nvl(trunc(f.end_date),trunc(SYSDATE)) >= trunc(SYSDATE)

      AND g.enabled_flag       = 'Y'

      AND pcr.control_group_id = g.control_group_id

          AND nvl(pcr.inactive_date, sysdate + 1) > sysdate

  AND pcr.object_code      = 'DOCUMENT_TOTAL') PRD

 WHERE SYSDATE BETWEEN TRUNC(u.start_date) AND TRUNC(NVL(u.end_date , SYSDATE+1))

   AND furg.user_id = u.user_id

   AND furg.responsibility_id = frt.responsibility_id

   AND fr.responsibility_id   = frt.responsibility_id

   AND fa.application_id      = fat.application_id

   AND fr.application_id      = fat.application_id

   AND sysdate between furg.start_date and nvl(furg.end_date,sysdate)

   AND frt.language           = USERENV ('LANG')

   AND frt.responsibility_name in  ('Res p Name')

   AND pe.effective_start_date  BETWEEN TRUNC(pe.effective_start_date) AND NVL(TRUNC(pe.effective_end_date),SYSDATE)

   AND NVL(pe.effective_end_date,SYSDATE) >= TRUNC(SYSDATE)

   AND u.employee_id = pe.person_id 

   AND pas.person_id = pe.person_id

   AND TRUNC(SYSDATE) BETWEEN TRUNC(pas.effective_start_date) AND TRUNC(pas.effective_end_date) 

   AND pe.person_id = prd.person_id(+)

   AND NVL(prd.assignment_type,'-99') IN ('C',DECODE(DECODE(pe.current_employee_flag,'Y','Y',DECODE(pe.current_npw_flag,'Y','Y','N')),'Y','E', 'B'),'E', '-99')

   AND hou.organization_id = prd.org_id(+)

   AND hou.organization_id in (123)

   AND amount_limit is null

    order by hou.name,user_name

Comments

Popular posts from this blog

Deleting the Sourcing Rule Assignments API

BarCode with XML Publisher