SELECT pha.segment1 PO_NUMBER,
PHA.START_DATE,
pha.creation_date po_creation_date,
pha.end_date,
pha.APPROVED_FLAG,
PersonName.FULL_NAME buyer_name,
ps.vendor_name,
pss.vendor_site_code site_name,
PLA.line_num,
pla.UNIT_PRICE,
pla.QUANTITY,
pla.UOM_CODE po_line_uom,
pla.UNIT_PRICE* pla.QUANTITY lineValue,
'Receipt details Start' receipt_details,
RSH.RECEIPT_NUM,
rsl.LINE_NUM receipt_line_number,
rsh.RECEIPT_SOURCE_CODE,
rsh.SHIPPED_DATE,
rsh.EXPECTED_RECEIPT_DATE,
rsl.QUANTITY_SHIPPED,
rsl.QUANTITY_RECEIVED,
rsl.QUANTITY_DELIVERED,
rsl.QUANTITY_RETURNED,
rsl.QUANTITY_ACCEPTED,
rsl.QUANTITY_REJECTED,
rsl.UOM_CODE,
rsl.ITEM_DESCRIPTION,
rsl.SHIPMENT_LINE_STATUS_CODE,
rsl.COMMENTS,
rct.TRANSACTION_TYPE,
(SELECT meaning
FROM FND_LOOKUP_VALUES_TL
WHERE LOOKUP_CODE =rct.TRANSACTION_TYPE
AND lookup_type = 'RCV_TRANSACTION_TYPE'
and language='US'
) TRANSACTION_TYPE_meaning,
rct.TRANSACTION_DATE
FROM RCV_SHIPMENT_HEADERS RSH,
RCV_SHIPMENT_LINES RSL,
PO_HEADERS_ALL PHA,
PER_PERSON_NAMES_F_V PersonName,
PO_LINES_ALL pla,
PO_LINE_TYPES_B,
POZ_SUPPLIERS_V ps,
POZ_SUPPLIER_SITES_V pss,
RCV_TRANSACTIONS rct
WHERE RSH.SHIPMENT_HEADER_ID =RSL.SHIPMENT_HEADER_ID
AND RSL.po_header_id =PHA.po_header_id
AND PersonName.PERSON_ID =PhA.agent_id
AND pla.po_header_id =PHA.po_header_id
AND PO_LINE_TYPES_B.line_type_id=pla.LINE_TYPE_ID
AND pla.PO_LINE_ID =rsl.PO_LINE_ID
AND pha.VENDOR_ID =ps.vendor_id
AND pss.VENDOR_ID =ps.vendor_id
AND rct.SHIPMENT_HEADER_ID = RSH.SHIPMENT_HEADER_ID
AND rsl.SHIPMENT_LINE_ID =rct.SHIPMENT_LINE_ID
PHA.START_DATE,
pha.creation_date po_creation_date,
pha.end_date,
pha.APPROVED_FLAG,
PersonName.FULL_NAME buyer_name,
ps.vendor_name,
pss.vendor_site_code site_name,
PLA.line_num,
pla.UNIT_PRICE,
pla.QUANTITY,
pla.UOM_CODE po_line_uom,
pla.UNIT_PRICE* pla.QUANTITY lineValue,
'Receipt details Start' receipt_details,
RSH.RECEIPT_NUM,
rsl.LINE_NUM receipt_line_number,
rsh.RECEIPT_SOURCE_CODE,
rsh.SHIPPED_DATE,
rsh.EXPECTED_RECEIPT_DATE,
rsl.QUANTITY_SHIPPED,
rsl.QUANTITY_RECEIVED,
rsl.QUANTITY_DELIVERED,
rsl.QUANTITY_RETURNED,
rsl.QUANTITY_ACCEPTED,
rsl.QUANTITY_REJECTED,
rsl.UOM_CODE,
rsl.ITEM_DESCRIPTION,
rsl.SHIPMENT_LINE_STATUS_CODE,
rsl.COMMENTS,
rct.TRANSACTION_TYPE,
(SELECT meaning
FROM FND_LOOKUP_VALUES_TL
WHERE LOOKUP_CODE =rct.TRANSACTION_TYPE
AND lookup_type = 'RCV_TRANSACTION_TYPE'
and language='US'
) TRANSACTION_TYPE_meaning,
rct.TRANSACTION_DATE
FROM RCV_SHIPMENT_HEADERS RSH,
RCV_SHIPMENT_LINES RSL,
PO_HEADERS_ALL PHA,
PER_PERSON_NAMES_F_V PersonName,
PO_LINES_ALL pla,
PO_LINE_TYPES_B,
POZ_SUPPLIERS_V ps,
POZ_SUPPLIER_SITES_V pss,
RCV_TRANSACTIONS rct
WHERE RSH.SHIPMENT_HEADER_ID =RSL.SHIPMENT_HEADER_ID
AND RSL.po_header_id =PHA.po_header_id
AND PersonName.PERSON_ID =PhA.agent_id
AND pla.po_header_id =PHA.po_header_id
AND PO_LINE_TYPES_B.line_type_id=pla.LINE_TYPE_ID
AND pla.PO_LINE_ID =rsl.PO_LINE_ID
AND pha.VENDOR_ID =ps.vendor_id
AND pss.VENDOR_ID =ps.vendor_id
AND rct.SHIPMENT_HEADER_ID = RSH.SHIPMENT_HEADER_ID
AND rsl.SHIPMENT_LINE_ID =rct.SHIPMENT_LINE_ID
Query is wrong. Getting duplicate records.
ReplyDelete