SELECT
PHA.SEGMENT1 订单号,
pha.approved_flag 批准状态,
pha.closed_code 订单关闭状态,
PHA.COMMENTS 订单说明,
pvs.vendor_site_code 供应商地点,
PLA.LINE_NUM 订单行,
plla.need_by_date 承诺日期,
plla.promised_date 需求日期,
PLA.CLOSED_CODE 行状态,
MSI.SEGMENT1 物料编码,
MSI.DESCRIPTION 描述,
PLA.QUANTITY 订单行数量,
plla.shipment_num 发运行,
PLLA.CLOSED_CODE 发运状态,
PLLA.QUANTITY 发运行数量,
pda.distribution_num 分配行,
pda.quantity_ordered 分配行数量,
pda.quantity_billed 订单数量,
pda.quantity_delivered 接收数量,
plla.attribute1
FROM PO.PO_LINES_ALL PLA,
PO.PO_HEADERS_ALL PHA,
INV.MTL_SYSTEM_ITEMS_B MSI,
po.po_vendors pv,
po.po_vendor_sites_all pvs,
po.PO_DISTRIBUTIONS_ARCHIVE_ALL pda,
po.po_line_locations_all PLLA
WHERE PLA.PO_HEADER_ID=PHA.PO_HEADER_ID AND PLA.ITEM_ID=MSI.INVENTORY_ITEM_ID
AND MSI.ORGANIZATION_ID=x
AND PHA.ORG_ID=Y
AND PHA.ORG_ID=PLA.ORG_ID
AND PLLA.PO_HEADER_ID=PLA.PO_HEADER_ID
AND PLLA.PO_LINE_ID=PLA.PO_LINE_ID
--AND (PLLA.QUANTITY =0 or pla.quantity=0)
AND pha.vendor_id=pv.vendor_id
AND pv.vendor_id=pvs.vendor_id
AND pda.po_header_id(+)=plla.po_header_id
AND pda.po_line_id(+)=plla.po_line_id
AND pda.line_location_id(+)=plla.line_location_id
AND pda.org_id(+)=plla.org_id
AND plla.org_id=pla.org_id
--AND trunc(plla.promised_date) between to_date(‘20**-01-01‘,‘yyyy-mm-dd‘) and to_date(‘20**-01-31‘,‘yyyy-mm-dd‘)
Oracle EBS-SQL (PO-4):检查采购订单明细.sql,布布扣,bubuko.com
Oracle EBS-SQL (PO-4):检查采购订单明细.sql
原文:http://www.cnblogs.com/st-sun/p/3779303.html