/* Formatted on 10-08-2011 16:08:09 (QP5 v5.115.810.9015) */
SELECT (SELECT name
FROM hr_operating_units
WHERE organization_id = poh.org_id)
Operating_unit,
poh.vendor_id,
rt.SHIPMENT_HEADER_ID,
rt.SHIPMENT_LINE_ID,
rsh.RECEIPT_NUM L_REFERENCE,
rsh.SHIPMENT_NUM L_SHIPMENT_NUM,
rt.TRANSACTION_TYPE L_TRANSACTION_TYPE,
rt.TRANSACTION_DATE L_TRANSACTION_DATE,
poh.SEGMENT1 L_PO_NUMBER,
pol.LINE_NUM L_PO_LINE_NUM,
rt.QUANTITY L_QUANTITY,
rt.UNIT_OF_MEASURE L_UOM,
msi.segment1 L_ITEM_NUM,
rt.SUBINVENTORY L_SUBINVENTORY,
rt.DESTINATION_TYPE_CODE L_DESTINATION_TYPE,
pol.ITEM_DESCRIPTION L_ITEM_DESCRIPTION,
(SELECT ORGANIZATION_NAME
FROM org_organization_Definitions
WHERE organization_id = rsl.TO_ORGANIZATION_ID
AND set_of_books_id = 5)
L_TO_ORGANIZATION,
loc.LOCATION_CODE L_SHIP_TO_LOCATION,
rsh.SHIPMENT_NUM L_SHIPMENT_NUM
FROM rcv_transactions rt,
po_headers_all poh,
po_lines_all pol,
mtl_system_items_b msi,
rcv_shipment_headers rsh,
rcv_shipment_lines rsl,
HR_LOCATIONS_ALL_TL loc,
po_line_locations_all poll
--, mtl_secondary_inventories inv
WHERE rt.organization_id IN (SELECT organization_id
FROM org_organization_Definitions
WHERE set_of_books_id = 5)
AND TRUNC (rt.TRANSACTION_DATE) BETWEEN '01-APR-2011' AND '10-APR-2011'
-- AND TRUNC (rt.Creation_Date) BETWEEN '01-apr-2011' AND '30-jun-2011'
AND rt.po_header_id = poh.po_header_id
AND poh.po_header_id = pol.po_header_id
AND pol.po_line_id = rt.PO_LINE_ID
AND msi.INVENTORY_ITEM_ID = pol.item_id
AND rt.organization_id = msi.organization_id
AND rt.shipment_line_id = rsl.shipment_line_id
AND rsl.shipment_header_id = rsh.shipment_header_id
AND poll.SHIP_TO_LOCATION_ID = loc.LOCATION_ID
AND rt.LOCATION_ID = poll.LINE_LOCATION_ID
ORDER BY TO_NUMBER (poh.segment1), rt.TRANSACTION_DATE
SELECT (SELECT name
FROM hr_operating_units
WHERE organization_id = poh.org_id)
Operating_unit,
poh.vendor_id,
rt.SHIPMENT_HEADER_ID,
rt.SHIPMENT_LINE_ID,
rsh.RECEIPT_NUM L_REFERENCE,
rsh.SHIPMENT_NUM L_SHIPMENT_NUM,
rt.TRANSACTION_TYPE L_TRANSACTION_TYPE,
rt.TRANSACTION_DATE L_TRANSACTION_DATE,
poh.SEGMENT1 L_PO_NUMBER,
pol.LINE_NUM L_PO_LINE_NUM,
rt.QUANTITY L_QUANTITY,
rt.UNIT_OF_MEASURE L_UOM,
msi.segment1 L_ITEM_NUM,
rt.SUBINVENTORY L_SUBINVENTORY,
rt.DESTINATION_TYPE_CODE L_DESTINATION_TYPE,
pol.ITEM_DESCRIPTION L_ITEM_DESCRIPTION,
(SELECT ORGANIZATION_NAME
FROM org_organization_Definitions
WHERE organization_id = rsl.TO_ORGANIZATION_ID
AND set_of_books_id = 5)
L_TO_ORGANIZATION,
loc.LOCATION_CODE L_SHIP_TO_LOCATION,
rsh.SHIPMENT_NUM L_SHIPMENT_NUM
FROM rcv_transactions rt,
po_headers_all poh,
po_lines_all pol,
mtl_system_items_b msi,
rcv_shipment_headers rsh,
rcv_shipment_lines rsl,
HR_LOCATIONS_ALL_TL loc,
po_line_locations_all poll
--, mtl_secondary_inventories inv
WHERE rt.organization_id IN (SELECT organization_id
FROM org_organization_Definitions
WHERE set_of_books_id = 5)
AND TRUNC (rt.TRANSACTION_DATE) BETWEEN '01-APR-2011' AND '10-APR-2011'
-- AND TRUNC (rt.Creation_Date) BETWEEN '01-apr-2011' AND '30-jun-2011'
AND rt.po_header_id = poh.po_header_id
AND poh.po_header_id = pol.po_header_id
AND pol.po_line_id = rt.PO_LINE_ID
AND msi.INVENTORY_ITEM_ID = pol.item_id
AND rt.organization_id = msi.organization_id
AND rt.shipment_line_id = rsl.shipment_line_id
AND rsl.shipment_header_id = rsh.shipment_header_id
AND poll.SHIP_TO_LOCATION_ID = loc.LOCATION_ID
AND rt.LOCATION_ID = poll.LINE_LOCATION_ID
ORDER BY TO_NUMBER (poh.segment1), rt.TRANSACTION_DATE
No comments:
Post a Comment