Query to get last purchase price from Oracle Ebusiness Suite Purchasing and Inventory module:
=select 'Last Purchase Price'||' = '||to_char(max (pla.UNIT_PRICE))||' '||to_char(max(pha.currency_code))
from po_lines_all pla , po_headers_all pha
where pla.CANCEL_FLAG = 'N'
and pla.PO_HEADER_ID = pha.PO_HEADER_ID
and pha.APPROVED_FLAG = 'Y'
and pla.ITEM_id = :PO_LINES.ITEM_ID
and pha.PO_HEADER_ID =
(
select max (pla.PO_HEADER_ID ) from po_lines_all pla , po_headers_all pha
where pla.CANCEL_FLAG = 'N'
and pla.PO_HEADER_ID = pha.PO_HEADER_ID
and pla.org_id = fnd_profile.value('org_id')
and pha.APPROVED_FLAG = 'Y'
and pla.ITEM_id = :PO_LINES.ITEM_ID
)
=select 'Last Purchase Price'||' = '||to_char(max (pla.UNIT_PRICE))||' '||to_char(max(pha.currency_code))
from po_lines_all pla , po_headers_all pha
where pla.CANCEL_FLAG = 'N'
and pla.PO_HEADER_ID = pha.PO_HEADER_ID
and pha.APPROVED_FLAG = 'Y'
and pla.ITEM_id = :PO_LINES.ITEM_ID
and pha.PO_HEADER_ID =
(
select max (pla.PO_HEADER_ID ) from po_lines_all pla , po_headers_all pha
where pla.CANCEL_FLAG = 'N'
and pla.PO_HEADER_ID = pha.PO_HEADER_ID
and pla.org_id = fnd_profile.value('org_id')
and pha.APPROVED_FLAG = 'Y'
and pla.ITEM_id = :PO_LINES.ITEM_ID
)
No comments:
Post a Comment