Monday 31 October 2011

Receipt_Header_v1_0

/* Formatted on 12-08-2011 19:17:51 (QP5 v5.115.810.9015) */
  SELECT   DISTINCT
           hou.name Operating_unit,
           pov.vendor_id,
           rt.SHIPMENT_HEADER_ID,
           rt.SHIPMENT_LINE_ID,
           pov.segment1 vendor_code,
           TO_NUMBER (rsh.RECEIPT_NUM) H_REFERENCE,
           RSH.SHIPMENT_NUM,
           pov.VENDOR_NAME H_VENDOR_NAME,
           RT.TRANSACTION_TYPE H_AUTO_TRX_CODE,
           rsh.RECEIPT_SOURCE_CODE H_RECEIPT_SOURCE,
           (SELECT   ORGANIZATION_NAME
              FROM   APPS.org_organization_Definitions
             WHERE   organization_id = rsl.TO_ORGANIZATION_ID
                     AND set_of_books_id = 5)
              H_SHIP_TO_ORGANIZATION,
           rsh.EXPECTED_RECEIPT_DATE H_EXPECTED_RECEIPT_DATE,
           rsh.WAYBILL_AIRBILL_NUM H_WAYBILL_AIRBILL,
           rsh.BILL_OF_LADING H_BILL_OF_LADING
    FROM   APPS.rcv_transactions rt,
           APPS.po_vendors pov,
           APPS.rcv_shipment_lines rsl,
           APPS.rcv_shipment_headers rsh,
           APPS.po_headers_all poh,
           hr_operating_units hou
   WHERE   rt.organization_id IN (SELECT   organization_id
                                    FROM   APPS.org_organization_Definitions
                                   WHERE   set_of_books_id = 5)
           AND TRUNC (rt.TRANSACTION_DATE) BETWEEN '01-APR-2011' AND  '10-APR-2011'
                                               --1AND  '30-JUN-2011'
           AND rt.vendor_id = pov.vendor_id
           AND rt.shipment_line_id = rsl.shipment_line_id
           AND rsl.shipment_header_id = rsh.shipment_header_id
           AND poh.po_header_id = rsl.po_header_id
           AND poh.po_header_id = rt.po_header_id
           AND hou.organization_id = poh.org_id
--and rt.TRANSACTION_TYPE NOT IN ('REJECT')
ORDER BY   rt.SHIPMENT_HEADER_ID,
           rt.SHIPMENT_LINE_ID,
           TO_NUMBER (rsh.RECEIPT_NUM)

No comments:

Post a Comment