QUERY TO EXTRACT PO RECEIPT DATA
select mpv.ORGANIZATION_CODE
, pha.SEGMENT1 PO_NUM
, rvtv.RECEIPT_NUM
, rvtv.TRANSACTION_DATE
, msik.CONCATENATED_SEGMENTS ITEM_CODE
, rvtv.TRANSACT_UOM
, rvtv.TRANSACT_QTY
, pha.CURRENCY_CODE
, pda.RATE_DATE
, pda.RATE
, pla.UNIT_PRICE
, rvtv.TRANSACT_QTY * pla.UNIT_PRICE total_amount
, rvtv.TRANSACT_QTY * pla.UNIT_PRICE * pda.RATE Converted_Amount
, rvtv.SUBINVENTORY
, milk.SEGMENT1||'.'||ppa.segment1||'.'||ptv.TASK_NAME LOCATOR
, pla.LINE_NUM
, rvtv.DELIVER_TO_LOCATION
from rcv_shipment_headers rsh
,RCV_VRC_TXS_V rvtv
, MTL_PARAMETERS_VIEW mpv
, po_headers_all pha
, mtl_system_items_kfv msik
, po_lines_all pla
, MTL_ITEM_LOCATIONS_kfv milk
, PA_PROJECTS_ALL PPA
, pa_tasks_v PTV
, po_distributions_all pda
where
rvtv.ORGANIZATION_ID = mpv.ORGANIZATION_ID
and rsh.SHIP_TO_ORG_ID = rvtv.ORGANIZATION_ID
and rvtv.TRANSACTION_TYPE = 'DELIVER'
and rvtv.SHIPMENT_HEADER_ID = rsh.SHIPMENT_HEADER_ID
and rvtv.PO_HEADER_ID = pha.PO_HEADER_ID
and rvtv.ITEM_ID = msik.INVENTORY_ITEM_ID
and rvtv.ORGANIZATION_ID= msik.ORGANIZATION_ID
and rvtv.PO_LINE_ID = pla.PO_LINE_ID
and rvtv.LOCATOR_ID =milk.INVENTORY_LOCATION_ID (+)
--and rvtv.RECEIPT_NUM = 'ABC123'
and milk.SEGMENT19 = ppa.PROJECT_ID (+)
and milk.SEGMENT20 = ptv.TASK_ID (+)
--and mpv.ORGANIZATION_CODE='ABC'
and pla.PO_line_id = pda.PO_LINE_ID
, pha.SEGMENT1 PO_NUM
, rvtv.RECEIPT_NUM
, rvtv.TRANSACTION_DATE
, msik.CONCATENATED_SEGMENTS ITEM_CODE
, rvtv.TRANSACT_UOM
, rvtv.TRANSACT_QTY
, pha.CURRENCY_CODE
, pda.RATE_DATE
, pda.RATE
, pla.UNIT_PRICE
, rvtv.TRANSACT_QTY * pla.UNIT_PRICE total_amount
, rvtv.TRANSACT_QTY * pla.UNIT_PRICE * pda.RATE Converted_Amount
, rvtv.SUBINVENTORY
, milk.SEGMENT1||'.'||ppa.segment1||'.'||ptv.TASK_NAME LOCATOR
, pla.LINE_NUM
, rvtv.DELIVER_TO_LOCATION
from rcv_shipment_headers rsh
,RCV_VRC_TXS_V rvtv
, MTL_PARAMETERS_VIEW mpv
, po_headers_all pha
, mtl_system_items_kfv msik
, po_lines_all pla
, MTL_ITEM_LOCATIONS_kfv milk
, PA_PROJECTS_ALL PPA
, pa_tasks_v PTV
, po_distributions_all pda
where
rvtv.ORGANIZATION_ID = mpv.ORGANIZATION_ID
and rsh.SHIP_TO_ORG_ID = rvtv.ORGANIZATION_ID
and rvtv.TRANSACTION_TYPE = 'DELIVER'
and rvtv.SHIPMENT_HEADER_ID = rsh.SHIPMENT_HEADER_ID
and rvtv.PO_HEADER_ID = pha.PO_HEADER_ID
and rvtv.ITEM_ID = msik.INVENTORY_ITEM_ID
and rvtv.ORGANIZATION_ID= msik.ORGANIZATION_ID
and rvtv.PO_LINE_ID = pla.PO_LINE_ID
and rvtv.LOCATOR_ID =milk.INVENTORY_LOCATION_ID (+)
--and rvtv.RECEIPT_NUM = 'ABC123'
and milk.SEGMENT19 = ppa.PROJECT_ID (+)
and milk.SEGMENT20 = ptv.TASK_ID (+)
--and mpv.ORGANIZATION_CODE='ABC'
and pla.PO_line_id = pda.PO_LINE_ID
Comments
Post a Comment