/* Formatted on 8/12/2011 10:38:36 PM (QP5 v5.115.810.9015) */
SELECT hou.name Operating_unit,
pov.vendor_id,
rt.SHIPMENT_HEADER_ID,
rt.SHIPMENT_LINE_ID,
pov.segment1 vendor_code,
pov.vendor_name,
poh.po_header_id,
TO_NUMBER (rsh.RECEIPT_NUM) H_REFERENCE,
RSH.SHIPMENT_NUM,
pov.VENDOR_NAME H_VENDOR_NAME,
poh.SEGMENT1 L_PO_NUMBER,
RT.TRANSACTION_TYPE H_AUTO_TRX_CODE,
rsh.RECEIPT_SOURCE_CODE H_RECEIPT_SOURCE,
ood.organization_name 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 rcv_transactions rt,
org_organization_definitions ood,
RCV_SHIPMENT_HEADERS RSH,
po_headers_all poh,
po_lines_all pol,
po_vendors pov,
HR_LOCATIONS_ALL_TL loc,
po_line_locations_all poll,
hr_operating_units hou,
rcv_shipment_lines rsl
WHERE rt.ORGANIZATION_ID = ood.ORGANIZATION_ID
AND RT.SHIPMENT_HEADER_ID = RSH.SHIPMENT_HEADER_ID
AND rt.PO_HEADER_ID = poh.PO_HEADER_ID
AND poh.po_header_id = pol.po_header_id
AND rt.po_line_id = pol.po_line_id
AND poll.PO_HEADER_ID = poh.PO_HEADER_ID
AND poll.po_line_id = pol.po_line_id
AND poll.SHIP_TO_LOCATION_ID = loc.LOCATION_ID
AND hou.organization_id = ood.operating_unit
AND rsh.shipment_header_id = rsl.shipment_header_id
AND rsl.shipment_line_id = rt.shipment_line_id
AND ood.organization_id = rsl.TO_ORGANIZATION_ID
AND pov.vendor_id = poh.vendor_id
AND ood.set_of_books_id = 5
AND TRUNC (rt.transaction_date) BETWEEN '01-JUL-2011'
AND '31-JUL-2011'
/*AND RT.TRANSACTION_ID IN ( SELECT MAX (TRANSACTION_ID)
FROM RCV_TRANSACTIONS
GROUP BY SHIPMENT_LINE_ID) */
ORDER BY TO_NUMBER (rsh.RECEIPT_NUM)
SELECT hou.name Operating_unit,
pov.vendor_id,
rt.SHIPMENT_HEADER_ID,
rt.SHIPMENT_LINE_ID,
pov.segment1 vendor_code,
pov.vendor_name,
poh.po_header_id,
TO_NUMBER (rsh.RECEIPT_NUM) H_REFERENCE,
RSH.SHIPMENT_NUM,
pov.VENDOR_NAME H_VENDOR_NAME,
poh.SEGMENT1 L_PO_NUMBER,
RT.TRANSACTION_TYPE H_AUTO_TRX_CODE,
rsh.RECEIPT_SOURCE_CODE H_RECEIPT_SOURCE,
ood.organization_name 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 rcv_transactions rt,
org_organization_definitions ood,
RCV_SHIPMENT_HEADERS RSH,
po_headers_all poh,
po_lines_all pol,
po_vendors pov,
HR_LOCATIONS_ALL_TL loc,
po_line_locations_all poll,
hr_operating_units hou,
rcv_shipment_lines rsl
WHERE rt.ORGANIZATION_ID = ood.ORGANIZATION_ID
AND RT.SHIPMENT_HEADER_ID = RSH.SHIPMENT_HEADER_ID
AND rt.PO_HEADER_ID = poh.PO_HEADER_ID
AND poh.po_header_id = pol.po_header_id
AND rt.po_line_id = pol.po_line_id
AND poll.PO_HEADER_ID = poh.PO_HEADER_ID
AND poll.po_line_id = pol.po_line_id
AND poll.SHIP_TO_LOCATION_ID = loc.LOCATION_ID
AND hou.organization_id = ood.operating_unit
AND rsh.shipment_header_id = rsl.shipment_header_id
AND rsl.shipment_line_id = rt.shipment_line_id
AND ood.organization_id = rsl.TO_ORGANIZATION_ID
AND pov.vendor_id = poh.vendor_id
AND ood.set_of_books_id = 5
AND TRUNC (rt.transaction_date) BETWEEN '01-JUL-2011'
AND '31-JUL-2011'
/*AND RT.TRANSACTION_ID IN ( SELECT MAX (TRANSACTION_ID)
FROM RCV_TRANSACTIONS
GROUP BY SHIPMENT_LINE_ID) */
ORDER BY TO_NUMBER (rsh.RECEIPT_NUM)
No comments:
Post a Comment