Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.

Wednesday, September 9, 2015

Oracle Purchase Orders Hierarchy Query

SELECT DISTINCT hpx.business_group_id,
                hpx.entry_grade_id,
                hpx.job_id,
                hpx.location_id,
                hpx.organization_id,
                hpx.fte,
                hpx.max_persons,
                hpx.NAME POSITION,
                ppx.full_name,
                hier.lev
  FROM hr_positions_x hpx,
       per_assignments_x pax,
       per_people_x ppx,
       (    SELECT pse.parent_position_id, LEVEL lev
              FROM per_pos_structure_elements pse
             WHERE     1 = 1
                   AND pse.pos_structure_version_id =
                          (SELECT ppsv.pos_structure_version_id
                             FROM per_position_structures pps,
                                  per_pos_structure_versions ppsv
                            WHERE     pps.position_structure_id = ppsv.position_structure_id
                                  AND pps.NAME = 'PO Requisition Hierarchy' -- Change the hierarchy as per your need
                                  AND TRUNC (SYSDATE) BETWEEN ppsv.date_from AND NVL ( ppsv.date_to, TO_DATE ( '31-Dec-4712','DD-MON-YYYY')))
        START WITH pse.subordinate_position_id =
                      (SELECT position_id FROM hr_positions_x WHERE NAME = '0110.215.Executive Admin') -- Change the position to the one you need
        CONNECT BY PRIOR pse.parent_position_id = pse.subordinate_position_id
          ORDER BY LEVEL ASC) hier
 WHERE     hier.parent_position_id = hpx.position_id
       AND pax.position_id = hier.parent_position_id

       AND pax.person_id = ppx.person_id

No comments:

Post a Comment

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Best Blogger TipsGet Flower Effect