Monday, 31 October 2011

R12_PO_Query_v1.0

/* Formatted on 27-08-2011 12:44:36 (QP5 v5.115.810.9015) */
  SELECT   DISTINCT PHA.SEGMENT1 PO_NO,
                    TRUNC(PHA.CREATION_DATE)PO_DATE,
                    HOU.NAME OPERATING_UNI,
                    OOD.ORGANIZATION_CODE,
                    OOD.ORGANIZATION_NAME
    FROM   po_headers_all PHA,
           po_lines_all PLA,
           po_line_locations_all PLLA,
           ORG_ORGANIZATION_DEFINITIONS OOD,
           HR_OPERATING_UNITS HOU
   WHERE       PHA.PO_HEADER_ID = PLA.PO_HEADER_ID
           AND PHA.PO_HEADER_ID = PLLA.PO_HEADER_ID
           AND PLA.PO_LINE_ID = PLLA.PO_LINE_ID
           AND PHA.ORG_ID = PLA.ORG_ID
           AND OOD.ORGANIZATION_ID = PLLA.SHIP_TO_ORGANIZATION_ID
           AND HOU.ORGANIZATION_ID = OOD.OPERATING_UNIT
           AND TRUNC (PHA.creation_date) BETWEEN '01-Apr-2011'
                                             AND  '13-Aug-2011'
ORDER BY   TO_NUMBER (PHA.segment1), TRUNC (PHA.creation_date)

No comments:

Post a Comment