Showing posts with label Query to get purchase order(PO) line detail in oracle fusion. Show all posts
Showing posts with label Query to get purchase order(PO) line detail in oracle fusion. Show all posts

Tuesday, 24 March 2026

Query to get purchase order(PO) line detail in oracle fusion

 select
hou.name Company_Code,
poh.segment1 PO_Number,
pol.LINE_NUM PO_Line_No,
pol.po_line_id  PO_Line_Id,
null Shipment_Id,
pol.LINE_STATUS PO_Line_Status,
plla.SCHEDULE_STATUS Schedule_Status,
plla.SHIPMENT_NUM Schedule_Number,
plla.QUANTITY_RECEIVED Shipment_Quantity_Received,
plla.QUANTITY_ACCEPTED Shipment_Quantity_Accepted,
plla.QUANTITY_BILLED Shipment_Quantity_Billed,
plla.QUANTITY_CANCELLED Shipment_Quantity_Cancelled,
plla.QUANTITY  Shipment_Quantity_Ordered,
plla.CANCEL_FLAG Shipment_Cancel_Flag,
replace(XX.SEGMENT1,'-',null) Release_Number,
poh.DOCUMENT_STATUS Authorization_Status, 
CASE
when plla.RECEIPT_REQUIRED_FLAG = 'N'
then '2-Way'
when  plla.RECEIPT_REQUIRED_FLAG = 'Y' AND plla.INSPECTION_REQUIRED_FLAG ='N'
THEN '3-Way'
when  plla.RECEIPT_REQUIRED_FLAG = 'Y' AND plla.INSPECTION_REQUIRED_FLAG ='Y'
THEN '4-Way'
end
Match_Approval_Level,
pol.QUANTITY PO_Line_Quantity,
pol.QUANTITY * pol.UNIT_PRICE PO_Line_Amount,
null Schedule_Qty, 
null Schedule_Amount, 
pol.QUANTITY - plla.QUANTITY_RECEIVED Shipment_Remaining_Qty,
(pol.QUANTITY - plla.QUANTITY_RECEIVED)*pol.UNIT_PRICE  Shipment_Remaining_Amount,
(select ITEM_NUMBER from egp_system_items_b where inventory_item_id= pol.item_id and rownum=1) Material_No ,
to_char(plla.NEED_BY_DATE ,'yyyy-MM-dd') Need_By_Date,
pol.ITEM_DESCRIPTION Product_Description, 
to_char(plla.PROMISED_DATE ,'yyyy-MM-dd') Promised_Date,
pol.UNIT_PRICE Unit_Price,
pol.LIST_PRICE_PER_UNIT Price_Unit,
pol.UOM_CODE UOM,
pol.tax_code_id Tax_Code_Unique_Key,
null UNSPSC_Code,
pol.last_update_Date,
pol.attribute1 Temp_1,
pol.attribute2 Temp_2,
pol.attribute3 Temp_3,
pol.attribute4 Temp_4,
pol.attribute5 Temp_5,
pol.attribute6 Temp_6,
pol.attribute7 Temp_7,
pol.attribute8 Temp_8,
pol.attribute9 Temp_9,
pol.attribute10 Temp_10   
from po_headers_all poh, 
po_lines_all pol, 
po_line_locations_All plla,
--PO_DISTRIBUTIONS_ALL pda,
HR_ORGANIZATION_UNITS_F_TL hou, 
hr_locations hl,
PO_LINE_TYPES_TL pltt,
(
select distinct '-'||poh.segment1 segment1, pol.from_header_id, pol.from_line_id
from PO_LINES_ALL POL,po_headers_All POH 
where pol.po_header_id=POH.PO_HEADER_ID
) xx
where poh.po_header_id=pol.po_header_id(+)
and pol.po_line_id=plla.po_line_id(+)
--and pol.po_header_id=pda.po_header_id(+)
--and pol.po_line_id=pda.po_line_id(+)
--and plla.line_location_id=pda.line_location_id(+)
and poh.PRC_BU_ID=hou.ORGANIZATION_id
and hou.LANGUAGE = USERENV('LANG')
and plla.SHIP_TO_LOCATION_ID= hl.location_id(+)
and pol.LINE_TYPE_ID =  pltt.LINE_TYPE_ID(+)
and hou.LANGUAGE=  pltt.LANGUAGE
--and poh.segment1='80306'
--and nvl(poh.LINE_STATUS,'XX')  not in ('CANCELED','CLOSED', 'REJECTED','CLOSED FOR INVOICING','FINALLY CLOSED','CLOSED FOR RECEIVING')
and poh.DOCUMENT_STATUS not in ('CANCELED','INCOMPLETE','REJECTED','FINALLY CLOSED','CLOSED','CLOSED FOR INVOICING')
and poh.po_header_id= xx.from_header_id(+)
and pol.PO_Line_Id=xx.from_line_id(+)
and hou.name= nvl(:P_bu_name,hou.name)
and trunc(pol.last_update_Date) between nvl(:P_FROM_DATE,trunc(pol.Last_update_Date)) and nvl(:P_END_DATE,trunc(pol.Last_update_Date))

Interview Question in Oracle OTBI Report

What is Subject Area In OTBI, a Subject Area is a logical view of business data. Under a Subject Area, we have multiple folders , which are...