Sie sind auf Seite 1von 51

1) Open POs/PO Lines/PO Shipment (release number also in case of blanket)

SELECT pha.po_header_id, pla.po_line_id, plla.line_location_id, pha.closed_code, pha.type_lookup_code, pha.segment1, pha.revision_num, pra.release_num,pla.line_num, plla.shipment_num, pla.quantity, plla.quantity_received, plla.quantity_accepted, plla.quantity_rejected, plla.quantity_billed, plla.quantity_cancelled, need_by_date, promised_date FROM po_headers_all pha, po_lines_all pla, po_line_locations_all plla, po_releases_all pra, WHERE 1=1

AND pha.po_header_id = pla.po_header_id AND pla.po_line_id = plla.po_line_id AND pha.po_header_id = plla.po_header_id AND pha.po_header_id = pra.po_header_id(+) AND pha.closed_code='OPEN' AND pla.closed_code='OPEN' AND plla.closed_code ='OPEN' AND pha.type_lookup_code='BLANKET' ORDER BY po_header_id

2) Closed POs/PO Lines/PO Shipments (release number also in case of blanket)


SELECT pha.po_header_id, pla.po_line_id, plla.line_location_id, pha.closed_code, pha.type_lookup_code, pha.segment1, pha.revision_num, pra.release_num,pla.line_num, plla.shipment_num, pla.quantity, plla.quantity_received, plla.quantity_accepted, plla.quantity_rejected, plla.quantity_billed,plla.quantity_cancelled, need_by_date, promised_date FROM apps.po_headers_all pha, apps.po_lines_all pla, apps.po_line_locations_all plla, apps.po_releases_all pra, WHERE 1=1 AND pha.po_header_id = pla.po_header_id AND pla.po_line_id = plla.po_line_id AND pha.po_header_id = plla.po_header_id AND pha.po_header_id = pra.po_header_id(+)

AND pha.closed_code='CLOSED' AND pla.closed_code='CLOSED' AND plla.closed_code ='CLOSED' AND pha.type_lookup_code='BLANKET' ORDER BY po_header_id

3) Cancelled POs/PO Lines/PO Shipments (release number also in case of blanket)


SELECT pha.po_header_id, pla.po_line_id, plla.line_location_id, pha.closed_code, pha.type_lookup_code, pha.segment1, pha.revision_num, pra.release_num,pla.line_num, plla.shipment_num, pla.quantity, plla.quantity_received, plla.quantity_accepted, plla.quantity_rejected, plla.quantity_billed,plla.quantity_cancelled, need_by_date, promised_date FROM apps.po_headers_all pha, apps.po_lines_all pla, apps.po_line_locations_all plla, apps.po_releases_all pra, WHERE 1=1

AND pha.po_header_id = pla.po_header_id AND pla.po_line_id = plla.po_line_id AND pha.po_header_id = plla.po_header_id AND pha.po_header_id = pra.po_header_id(+) AND pha.CANCEL_FLAG='Y' AND pla.cancel_flag='Y' AND plla.cancel_flag='Y' AND pha.type_lookup_code='BLANKET' ORDER BY po_header_id

4) Open requisition/lines
SELECT prh.REQUISITION_HEADER_ID, prh.PREPARER_ID , prl.line_location_id, prh.SEGMENT1 "REQ NUM", trunc(prh.CREATION_DATE) CREATION_DATE,

prh.DESCRIPTION, prh.authorization_status, prh.type_lookup_code, pdta.document_type_code FROM apps.Po_Requisition_headers_all prh, apps.po_document_types_all pdta , apps.po_requisition_lines_all prl WHERE 1=1 AND prh.authorization_status='APPROVED' AND pdta.DOCUMENT_TYPE_CODE='REQUISITION' AND prh.org_id=pdta.org_id AND prh.closed_code='OPEN' AND prl.closed_code='OPEN' AND prl.line_location_id is null AND pdta.DOCUMENT_SUBTYPE=prh.type_lookup_code AND prl.REQUISITION_HEADER_ID=prh.REQUISITION_HEADER_ID Order by prl.line_location_id

5) Cancelled requisition/lines
SELECT prh.REQUISITION_HEADER_ID, prh.PREPARER_ID , prl.line_location_id, prh.SEGMENT1 "REQ NUM", trunc(prh.CREATION_DATE) CREATION_DATE, prh.DESCRIPTION, prh.authorization_status, prh.type_lookup_code, pdta.document_type_code FROM apps.Po_Requisition_headers_all prh, apps.po_document_types_all pdta , apps.po_requisition_lines_all prl WHERE 1=1 AND prh.authorization_status=CANCELLED

AND pdta.DOCUMENT_TYPE_CODE='REQUISITION' AND prh.org_id=pdta.org_id AND prh.cancel_flag='Y' AND prl.cancel_flag='Y' AND prl.line_location_id is null AND pdta.DOCUMENT_SUBTYPE=prh.type_lookup_code AND prl.REQUISITION_HEADER_ID=prh.REQUISITION_HEADER_ID Order by prl.line_location_id

6) Requisition lines converted to POs


SELECT distinct u.description "Requestor", porh.segment1 as "Req Number", trunc(porh.Creation_Date) "Created On", pord.LAST_UPDATED_BY, porh.Authorization_Status "Status", porh.Description "Description", poh.segment1 "PO Number", trunc(poh.Creation_date) "PO Creation Date", poh.AUTHORIZATION_STATUS "PO Status", trunc(poh.Approved_Date) "Approved Date" FROM apps.po_headers_all poh, apps.po_distributions_all pod, apps.po_req_distributions_all pord, apps.po_requisition_lines_all porl, apps.po_requisition_headers_all porh, apps.fnd_user u WHERE porh.requisition_header_id = porl.requisition_header_id and porl.requisition_line_id = pord.requisition_line_id and pord.distribution_id = pod.req_distribution_id(+) and pod.po_header_id = poh.po_header_id(+) and porh.created_by = u.user_id

AND porh.type_lookup_code='PURCHASE'

7) Receipts performed
SELECT prha.segment1 "REQ NO", prha.creation_date "REQ DATE", prla.quantity "REQ QTY", pha.segment1 "PO NO", pha.creation_date "PO DATE", sum(pla.quantity) "PO QTY", pla.unit_price "PRICE", rsh.receipt_num , rt.transaction_date "RECEIPT DATE", rt.quantity "RECEIPT QTY", rt.po_unit_price "PRICE", aia.invoice_num, aia.invoice_date, apc.check_date, apc.check_number FROM po_requisition_headers_all prha, po_requisition_lines_all prla, po_req_distributions_all prda, po_headers_all pha, po_lines_all pla, po_distributions_all pda, rcv_transactions rt, rcv_shipment_lines rsl, rcv_shipment_headers rsh, ap_invoices_all aia, ap_invoice_lines_all aila, ap_invoice_distributions_all aid, ap_invoice_payments_all aip,

ap_payment_schedules_all apsa, ap_checks_all apc WHERE prha.requisition_header_id=prla.requisition_header_id AND AND AND AND AND AND AND AND AND AND AND AND --AND prla.requisition_line_id=prda.requisition_line_id pda.req_distribution_id=prda.distribution_id pla.po_line_id=pda.po_line_id pha.po_header_id=pla.po_header_id pda.po_distribution_id=rt.po_distribution_id rsh.shipment_header_id=rt.shipment_header_id rt.transaction_id=aid.rcv_transaction_id aila.invoice_id=aid.invoice_id aia.invoice_id=aila.invoice_id aia.invoice_id=aip.invoice_id aia.invoice_id=apsa.invoice_id apc.check_id=aip.check_id prha.segment1=:p_segment1

GROUP BY prha.segment1, prha.creation_date, prla.quantity, pha.segment1, pha.creation_date, pla.quantity, pla.unit_price, rsh.receipt_num , rt.transaction_date, rt.quantity, rt.po_unit_price, aia.invoice_num, aia.invoice_date, apc.check_date,

apc.check_number

8) Corrections performed
SELECT pol.po_header_id, pol.po_line_id, rct.po_line_location_id line_location_id, SUM (NVL (rct1.source_doc_quantity, 0)) qty_corrected FROM rcv_transactions rct, rcv_transactions rct1, po_lines pol, po_line_locations pll WHERE rct.transaction_type IN ('RECEIVE', 'MATCH') AND rct.po_line_location_id = pll.line_location_id AND rct1.transaction_type = 'CORRECT' AND rct1.parent_transaction_id = rct.transaction_id AND rct.po_line_id = pol.po_line_id GROUP BY pol.po_header_id, pol.po_line_id, rct.po_line_location_id

9) Vendor-vendor site information


Select asp.vendor_id , asp.segment1 "Vendor Number" ,asp.vendor_name "Vendor Name" ,asp.vendor_type_lookup_code "vendor type" ,asp.CREATION_DATE "CREATED DATE" ,aps.vendor_site_code "Site Name" ,aps.vendor_site_code_alt "Alternate Vendor Site Name" , aps.address_line1, aps.address_line2, aps.address_line3 ,aps.city ,aps.state From AP_SUPPLIERS asp , AP_SUPPLIER_SITES_ALL aps , AP_SUPPLIER_CONTACTS asct Where asp.vendor_id = aps.vendor_id(+)

And aps.vendor_site_id = asct.vendor_site_id(+)

10) Requisition import errors


SELECT pria.req_number_segment1, msi.segment1, pria.item_description, msi.inventory_item_id, pie.interface_transaction_id,pie.interface_type, pie.column_name,pie.error_message,pie.PROCESSING_DATE, pie.table_name,pie.error_message_name,pie.app_name FROM apps.po_interface_errors pie, apps.mtl_system_items_b msi, apps.po_requisitions_interface_all pria WHERE msi.inventory_item_id = pria.item_id AND pie.interface_transaction_id = pria.transaction_id AND pria.process_flag = 'ERROR';

11) Open Pos


SELECT pha.po_header_id, pla.po_line_id, plla.line_location_id, pha.closed_code, pha.type_lookup_code, pha.segment1, pha.revision_num, pla.line_num, plla.shipment_num, plla.quantity,

plla.quantity_received, plla.quantity_accepted, plla.quantity_rejected, plla.quantity_billed, plla.quantity_cancelled, need_by_date, promised_date, plla.ship_to_organization_id, to_char(plla.creation_date,'DD-MON-YYYY HH24:MI:SS'), plla.* FROM apps.po_headers_all pha, apps.po_lines_all pla, apps.po_line_locations_all plla WHERE 1=1 AND pha.po_header_id = pla.po_header_id AND pla.po_line_id = plla.po_line_id AND pha.po_header_id = plla.po_header_id AND NVL(pha.closed_code,'OPEN')='OPEN' AND nvl(pla.closed_code,'OPEN')='OPEN' AND nvl(plla.closed_code,'OPEN') ='OPEN' and pla.item_id=420150;

1. On time receipts = (No of POs where supply was received on or before need by date / Total no of purchase orders) for a given period

select organization_code, SUM(po_nos),SUM(po_receipt_nos) from ( select organization_code,SUM(po_no) po_nos, SUM(po_receipt_no) po_receipt_nos, need_by_date from ( select organization_code,trunc(need_by_date) need_by_date, 1 po_no, NVL((select 1 from rcv_transactions rt where transaction_type='DELIVER' and trunc(transaction_date)<=trunc(need_by_date) and pll.line_location_id=rt.po_line_location_id and rownum=1),0) po_receipt_no from po_line_locations_all pll, mtl_parameters mp where ship_to_organization_id=organization_id and NVL(cancel_flag,'N')='N' and approved_flag='Y') group by organization_code, need_by_date ) where need_by_date between '01-JUL-2012' and '30-JUL-2012' group by organization_code

2. Extent of planned purchasing = (no of planned purchase orders / no of total purchase orders), (Value of planned Pos / Value of total Pos)

select organization_code,SUM(po_no) po_nos, SUM(po_planned_no) po_planned_nos from ( select organization_code, 1 po_no,

NVL((select count(1) from apps.po_requisition_headers_all prha,apps.po_requisition_lines_all prla where prha.interface_source_code='MSC' and prha.requisition_header_id=prla.requisition_header_id and plla.LINE_LOCATION_ID=prla.LINE_LOCATION_ID ),0) po_planned_no from apps.po_line_locations_all plla, mtl_parameters mp where ship_to_organization_id=organization_id and NVL(cancel_flag,'N')='N') group by organization_code

3. Extent of sourcing rules = (No of buy items in assignment set / total no of buy items

select SUM(item_no) item_nos, SUM(item_sr_no) item_sr_nos, organization_code from ( select organization_code,1 item_no, NVL((select 1 from apps.msc_sr_assignments msa where assignment_set_id=1 and msa.organization_id=msi.organization_id and msa.inventory_item_id=msi.inventory_item_id),0) item_sr_no from apps.msc_system_items msi where plan_id= 24 and planning_make_buy_code = 2) group by organization_code;

4. Extent of blanket agreements = (No of buy items covered in Bas / Total no of buy items)

select SUM(item_no) item_nos, sum(item_bas) item_bas from ( select 1 item_no, NVL((select count(1) from apps.po_lines_all pl,apps.po_headers_all ph where ph.type_lookup_code='BLANKET' and ph.po_header_id=pl.po_header_id and NVL(pl.cancel_flag,'N')='N' and NVL(pl.closed_code,'OPEN')='OPEN' and pl.item_id=msi.inventory_item_id and trunc (nvl(pl.expiration_date,sysdate+1)) > trunc( sysdate)) ,0)item_bas from apps.mtl_system_items msi where planning_make_buy_code = 2 and inventory_item_status_code='Active' and msi.organization_id=93);

5. Extent of rejections for buy item = (Qty rejected / Qty received) for given period, (Value rejected / Value received) for a given period

select * from ( select organization_code, sum(QUANTITY_RECEIVED) QUANTITY_RECEIVED, sum(QUANTITY_REJECTED) QUANTITY_REJECTED,need_by_date,sum(price_override) from apps.po_line_locations_all pll, apps.mtl_parameters mp where NVL(cancel_flag,'N')='N' and NVL(closed_flag,'N')='N' and NVL(approved_flag,'N')='N' and ship_to_organization_id=organization_id

group by organization_code, quantity_rejected,quantity_received,need_by_date,price_override ) where QUANTITY_REJECTED>0

6. Extent of orders without compression = no of orders, where (need by date creation date) is greater than processing lead time / total no of orders

select organization_code,SUM(po_no) po_nos, SUM(po_wo_comp_no) po_wo_comp_no_nos from ( select organization_code,1 po_no, NVL((select 1 from apps.po_line_locations_all pll2, apps.mtl_system_items msi, apps.po_lines_all pl where trunc(need_by_date)-trunc(pll2.creation_date)>full_lead_time and pll2.line_location_id=pll.line_location_id and pll2.po_line_id=pl.po_line_id and pll2.ship_to_organization_id=msi.organization_id and pl.item_id=msi.inventory_item_id and rownum=1),0) po_wo_comp_no from apps.po_line_locations_all pll, apps.mtl_parameters mp where ship_to_organization_id=mp.organization_id and NVL(cancel_flag,'N')='N' and approved_flag='Y') group by organization_code

7. On time production = (No of WOs completed on or before due date / Total no of WOs) for a given period

select organization_code,round((sum(wo_completed_nos)/sum(wo_nos))*100,0) on_time_production from ( select organization_code,scheduled_completion_date,SUM(wo_no) wo_nos, SUM(wo_completed_nos) wo_completed_nos from ( select organization_code,trunc(wdj1.scheduled_completion_date) scheduled_completion_date, 1 wo_no, NVL((select 1 from apps.wip_discrete_jobs wdj2 where wdj2.status_type in (12,14,15,4,5) and trunc(wdj2.date_completed)<=trunc(wdj2.scheduled_completion_date) and wdj1.wip_entity_id=wdj2.wip_entity_id),0) wo_completed_nos from apps.wip_discrete_jobs wdj1 , apps.mtl_parameters mp where wdj1.status_type in (12,14,15,4,5) and mp.organization_id=wdj1.organization_id) group by organization_code,scheduled_completion_date ) where scheduled_completion_date between '21-JUL-12' and '31-JUL-12' group by organization_code

8. Extent of planned production = ( no of planned work orders / no of total work orders )

select organization_code,round((sum(wo_planned_nos)/sum(wo_nos))*100,0) extent_of_planned_prod from ( select organization_code,creation_date,SUM(wo_no) wo_nos,SUM(wo_planned_nos) wo_planned_nos from( select organization_code, trunc(wdj1.creation_date) creation_date, 1 wo_no, NVL((select 1

from apps.wip_discrete_jobs wdj2 where status_type!= 7 and source_code='MSC' and wdj1.wip_entity_id=wdj2.wip_entity_id),0) wo_planned_nos from apps.wip_discrete_jobs wdj1, apps.mtl_parameters mp where status_type!= 7 and wdj1.organization_id=mp.organization_id) group by organization_code,creation_date ) where creation_date between '01-JUL-12' and '31-AUG-12' group by organization_code

9.Extent of timely order release=( No of planned orders for make items due but not released / Total no of planned orders recommended for make items )

select organization_code, round((orders_not_released/orders_due)*100,0) extent_of_timely_release from ( select organization_code, sum(orders_due) orders_due, sum(orders_not_released) orders_not_released from ( select mpo.organization_code, 1 orders_due, NVL((select 1 from apps.msc_supplies ms1 where ms1.plan_id= ms.plan_id and ms1.transaction_id=ms.transaction_id and nvl(implement_quantity,0)=0),0) orders_not_released from apps.msc_supplies ms, apps.msc_plan_organizations mpo where ms.plan_id= 24 and ms.order_type=5 and ms.supplier_id is null and ms.source_organization_id is null

and mpo.organization_id=ms.organization_id and trunc(new_schedule_date)<=trunc(sysdate) ) group by organization_code )

10. Extent of rejections = (Qty rejected / Qty produced) for given period, (Value rejected / Value produced) for a given period

select organization_code, extent_of_rejections from (

round((sum(QUANTITY_REJECTED)/sum(QUANTITY_COMPLETED))*100,0)

select organization_code, sum(QUANTITY_COMPLETED) QUANTITY_COMPLETED, sum(QUANTITY_REJECTED) QUANTITY_REJECTED, date_completed from ( select organization_code, wdj.QUANTITY_COMPLETED, trunc(wdj.date_completed) date_completed, (SELECT sum(QUANTITY_REJECTED) FROM apps.wip_operations wp where wp.wip_entity_id=wdj.wip_entity_id) QUANTITY_REJECTED from apps.mtl_parameters mp,APPS.WIP_DISCRETE_JOBS wdj where wdj.status_type!= 7 and wdj.QUANTITY_COMPLETED>0 and mp.organization_id=wdj.organization_id) group by organization_code, date_completed ) where date_completed between '15-AUG-2012' and '23-AUG-2012' group by organization_code

Pegging Query
select * from ( select x.plan_name , x.end_demand_order_number , (CASE WHEN x.pegging_id=x.end_pegging_id THEN 1 WHEN x.prev_pegging_id=x.end_pegging_id THEN 2 ELSE (select count(*)+3 from msc_full_pegging fp WHERE fp.end_pegging_id=x.end_pegging_id AND fp.pegging_id <> fp.end_pegging_id AND fp.prev_pegging_id <> fp.end_pegging_id AND fp.plan_id=x.plan_id AND fp.pegging_id <= x.prev_pegging_id) END) pegging_level , x.organization_code , x.organization_id , x.item_name , x.inventory_item_id , x.supply_due_date , x.supply_order_type , x.supply_order_number , x.new_order_quantity , x.allocated_supply_qty , x.demand_order_number from( select distinct compile_designator plan_name , i.item_name , i.inventory_item_id

, i.organization_code , i.organization_id , p.allocated_quantity allocated_supply_qty , p.end_item_usage , s.new_schedule_date supply_due_date , s.old_schedule_date , s.new_wip_start_date , s.old_wip_start_date , decode(s.order_type,5,to_char(s.disposition_id),17,to_char(s.disposition_id),to_char(s.order_number)) supply_order_number , sf.meaning supply_order_type , sup.partner_name supplier , sups.partner_address supplier_site , s.new_order_quantity , s.old_order_quantity , s.non_nettable_qty , s.subinventory_code , s.lot_number , decode(s.firm_planned_type,1,'Yes','No') firm_planned_type , decode(s.release_status,1,'Yes','No') checked_for_release , s.operation_seq_num , s.new_dock_date , s.old_dock_date , decode(s.applied,2,'Released','Not Released') release_flag , s.need_by_date , fw.meaning wip_status_code , s.days_late , df.meaning demand_type , decode(d.origination_type,1,to_char(d.disposition_id),to_char(d.order_number)) demand_order_number , d.using_requirement_quantity demand_qty , d.using_assembly_demand_date demand_due_date

, d.quantity_by_due_date demand_qty_by_due_date , d.unmet_quantity demand_unmet_qty , d.demand_class demand_demand_class , ef.meaning end_demand_type , designator end_demand_designator , emsi.item_name end_demand_item , ed.using_requirement_quantity end_demand_qty , ed.order_number end_demand_order_number , ed.using_assembly_demand_date end_demand_date , c.partner_name end_demand_customer , cs.partner_address customer_address , ss.partner_address ship_to_address , ed.demand_class end_demand_demand_class , ed.promise_date end_demand_promise_date , ed.issued_quantity end_demand_issued_qty , ed.quantity_by_due_date end_demand_qty_by_due_date , ed.unmet_quantity end_demand_unmet_qty , ed.request_ship_date end_demand_request_ship_date , ed.ship_method end_demand_ship_method , p.plan_id , p.pegging_id , p.end_pegging_id , p.prev_pegging_id from msc_system_items i , msc_plans pl , msc_full_pegging p , msc_full_pegging ep , msc_supplies s , msc_demands ed , msc_demands d

, msc_system_items emsi , fnd_lookup_values sf , fnd_lookup_values ef , fnd_lookup_values df , fnd_lookup_values fw , msc_trading_partners c , msc_trading_partner_sites cs , msc_trading_partner_sites ss , msc_trading_partners sup , msc_trading_partner_sites sups , msc_designators sd where p.plan_id != -1 and pl.plan_id=p.plan_id and sf.lookup_type(+)='MRP_ORDER_TYPE' and sf.language(+)='US' and sf.lookup_code(+)=s.order_type and ef.lookup_type(+)='MRP_DEMAND_ORIGINATION' and ef.language(+)='US' and ef.lookup_code(+)=ed.origination_type and df.lookup_type(+)='MRP_DEMAND_ORIGINATION' and df.language(+)='US' and df.lookup_code(+)=d.origination_type and c.partner_id(+)=ed.customer_id and cs.partner_site_id(+)=ed.customer_site_id and ss.partner_site_id(+)=ed.ship_to_site_id and i.plan_id = p.plan_id and i.sr_instance_id = p.sr_instance_id and i.inventory_item_id = p.inventory_item_id and i.organization_id = p.organization_id and emsi.plan_id(+) = ed.plan_id

and emsi.sr_instance_id(+) = ed.sr_instance_id and emsi.inventory_item_id(+) = ed.inventory_item_id and emsi.organization_id(+) = ed.organization_id and s.plan_id (+)= p.plan_id and s.sr_instance_id (+)= p.sr_instance_id and s.transaction_id (+)= p.transaction_id and sup.partner_id(+)=s.supplier_id and sups.partner_site_id(+)=s.supplier_site_id and fw.lookup_code(+)=s.wip_status_code and fw.lookup_type(+)='WIP_JOB_STATUS' and fw.language(+)='US' and d.plan_id(+) = p.plan_id and d.sr_instance_id(+) = p.sr_instance_id and d.demand_id(+) = p.demand_id and d.using_requirement_quantity(+)>0 and ep.plan_id = p.plan_id and ep.sr_instance_id = p.sr_instance_id and ep.pegging_id = p.end_pegging_id and ed.plan_id(+) = ep.plan_id and ed.sr_instance_id(+) = ep.sr_instance_id and ed.demand_id(+) = ep.demand_id and ed.using_requirement_quantity(+)>0 and sd.designator_id(+)=ed.schedule_designator_id and p.end_pegging_id!=p.pegging_id UNION select distinct compile_designator plan_name , i.item_name , i.inventory_item_id , i.organization_code , i.organization_id

, p.allocated_quantity allocated_supply_qty , p.end_item_usage , s.new_schedule_date supply_due_date , s.old_schedule_date , s.new_wip_start_date , s.old_wip_start_date , decode(s.order_type,5,to_char(s.disposition_id),17,to_char(s.disposition_id),to_char(s.order_number)) supply_order_number , sf.meaning supply_order_type , sup.partner_name supplier , sups.partner_address supplier_site , s.new_order_quantity , s.old_order_quantity , s.non_nettable_qty , s.subinventory_code , s.lot_number , decode(s.firm_planned_type,1,'Yes','No') firm_planned_type , decode(s.release_status,1,'Yes','No') checked_for_release , s.operation_seq_num , s.new_dock_date , s.old_dock_date , decode(s.applied,2,'Released','Not Released') release_flag , s.need_by_date , fw.meaning wip_status_code , s.days_late , null demand_type , null demand_order_number , null demand_qty , null demand_due_date , null demand_qty_by_due_date , null demand_unmet_qty

, null demand_demand_class , ef.meaning end_demand_type , designator end_demand_designator , emsi.item_name end_demand_item , ed.using_requirement_quantity end_demand_qty , ed.order_number end_demand_order_number , ed.using_assembly_demand_date end_demand_date , c.partner_name end_demand_customer , cs.partner_address customer_address , ss.partner_address ship_to_address , ed.demand_class end_demand_demand_class , ed.promise_date end_demand_promise_date , ed.issued_quantity end_demand_issued_qty , ed.quantity_by_due_date end_demand_qty_by_due_date , ed.unmet_quantity end_demand_unmet_qty , ed.request_ship_date end_demand_request_ship_date , ed.ship_method end_demand_ship_method , p.plan_id , p.pegging_id , p.end_pegging_id , p.prev_pegging_id from msc_supplies s , msc_plans pl , msc_system_items i , msc_full_pegging p , msc_demands ed , msc_system_items emsi , fnd_lookup_values sf , fnd_lookup_values ef , fnd_lookup_values fw

, msc_trading_partners c , msc_trading_partner_sites cs , msc_trading_partner_sites ss , msc_trading_partners sup , msc_trading_partner_sites sups , msc_designators sd where p.plan_id != -1 and pl.plan_id=p.plan_id and sf.lookup_type(+)='MRP_ORDER_TYPE' and sf.language(+)='US' and sf.lookup_code(+)=s.order_type and ef.lookup_type(+)='MRP_DEMAND_ORIGINATION' and ef.language(+)='US' and ef.lookup_code(+)=ed.origination_type and c.partner_id(+)=ed.customer_id and cs.partner_site_id(+)=ed.customer_site_id and ss.partner_site_id(+)=ed.ship_to_site_id and i.plan_id = p.plan_id and i.sr_instance_id = p.sr_instance_id and i.inventory_item_id = p.inventory_item_id and i.organization_id = p.organization_id and emsi.plan_id(+) = ed.plan_id and emsi.sr_instance_id(+) = ed.sr_instance_id and emsi.inventory_item_id(+) = ed.inventory_item_id and emsi.organization_id(+) = ed.organization_id and s.plan_id (+)= p.plan_id and s.sr_instance_id (+)= p.sr_instance_id and s.transaction_id (+)= p.transaction_id and sup.partner_id(+)=s.supplier_id and sups.partner_site_id(+)=s.supplier_site_id

and fw.lookup_code(+)=s.wip_status_code and fw.lookup_type(+)='WIP_JOB_STATUS' and fw.language(+)='US' and ed.plan_id(+) = p.plan_id and ed.sr_instance_id(+) = p.sr_instance_id and ed.demand_id(+) = p.demand_id and ed.using_requirement_quantity(+)>0 and sd.designator_id(+)=ed.schedule_designator_id and p.end_pegging_id=p.pegging_id) x ) where plan_name='ASCP-DC' and end_demand_order_number='425170.BV Disti Standard.ORDER ENTRY(1.1)' order by pegging_level

Rebalancing Query
select organization_code, source_organization_code, item_name, sum(quantity) rebalance_inv from ( SELECT md.demand_id , md.organization_id source_organization_id , msi.organization_code source_organization_code , md.using_assembly_demand_date , md.using_requirement_quantity , md.source_organization_id organization_id , mtp.organization_code organization_code , md.inventory_item_id , msi.sr_inventory_item_id , msi.item_name , md.plan_id , mp.compile_designator , msp.child_id , msp.quantity

FROM msc_demands md, msc_single_lvl_peg msp, msc_system_items msi, msc_supplies ms2, msc_plans mp, apps.msc_trading_partners mtp WHERE md.demand_id = msp.parent_id AND md.origination_type=1 AND md.inventory_item_id = msi.inventory_item_id AND md.plan_id = msi.plan_id AND md.plan_id = mp.plan_id AND mp.compile_designator = 'DRP_PLAN' -- DRP plan AND md.sr_instance_id = msi.sr_instance_id AND md.organization_id = msi.organization_id AND msp.pegging_type = 2 AND md.plan_id = msp.plan_id AND ms2.transaction_id = msp.child_id AND ms2.order_type = 18 AND ms2.plan_id = msp.plan_id AND mtp.sr_tp_id=md.source_organization_id AND mtp.partner_type=3 AND msp.child_id < > -1 ) group by organization_code, source_organization_code,item_name order by 1,2

/************************************************************************************* *********** Procedure To

Update On Hand Quantity Post Collections.

This procedure is used to update organization_id in collected data for msc_supplies for onhand transactions that are transferred to other orgs because of inventory rebalancing. In case the transfer quantity is less than the onhand quantity for the onhand transaction, the onhand quantity is decremented and a new record inserted in collected data for the transfer quantity.

************************************************************************************** **********/

CREATE OR REPLACE PROCEDURE xxsi_update_oh_org ( errbuf OUT VARCHAR2 , retcode OUT NUMBER) AS CURSOR inv_update_rec_cur IS SELECT inventory_item_id ,organization_id ,source_organization_id ,plan_id ,sum(quantity) quantity ,child_id FROM XXSI_MSC_REBAL_TRNFER_V --WHERE plan_id = p_plan_id GROUP BY inventory_item_id, organization_id,source_organization_id, plan_id, child_id;

l_new_quantity l_quantity

NUMBER; NUMBER;

l_disposition_status_type NUMBER;--1

l_order_type l_new_order_quantity l_old_order_quantity l_reschedule_flag l_firm_planned_type l_lot_number l_subinventory_code l_expiration_date

NUMBER; NUMBER; NUMBER; NUMBER; NUMBER; VARCHAR2(50); VARCHAR2(50); DATE;

l_planning_partner_site_id NUMBER; l_planning_tp_type l_owning_partner_site_id l_owning_tp_type l_vmi_flag l_new_schedule_date l_transaction_id l_created_by BEGIN FOR rec IN inv_update_rec_cur LOOP l_quantity:= 0; BEGIN SELECT new_order_quantity INTO l_quantity FROM Msc_supplies a WHERE plan_id = -1 AND order_type = 18 AND transaction_id = rec.child_id AND inventory_item_id = rec.inventory_item_id AND organization_id = rec.source_organization_id; dbms_output.put_line('transaction_id '||rec.child_id); NUMBER; NUMBER; NUMBER; NUMBER; DATE; NUMBER; NUMBER;

dbms_output.put_line('l_quantity '||l_quantity); dbms_output.put_line('rec.quantity '||rec.quantity); Fnd_File.put_line(Fnd_File.LOG,'transaction_id '||rec.child_id); Fnd_File.put_line(Fnd_File.LOG,'l_quantity '||l_quantity); Fnd_File.put_line(Fnd_File.LOG,'rec.quantity '||rec.quantity); EXCEPTION WHEN OTHERS THEN NULL; dbms_output.put_line(' Error Code' || SQLCODE || ' ' || SQLERRM); Fnd_File.put_line(Fnd_File.LOG,' Error Code' || SQLCODE || ' ' || SQLERRM); END; F l_quantity = rec.quantity THEN UPDATE msc_supplies SET organization_id = rec.organization_id WHERE order_type = 18 AND transaction_id = rec.child_id AND organization_id = rec.source_organization_id AND plan_id =-1; dbms_output.put_line('Update if equal qty '||rec.child_id); Fnd_File.put_line(Fnd_File.LOG,'Update if equal qty '||rec.child_id); ELSE l_new_quantity := l_quantity - rec.quantity; dbms_output.put_line('l_new_quantity '||l_new_quantity); Fnd_File.put_line(Fnd_File.LOG,'l_new_quantity '||l_new_quantity); UPDATE msc_supplies SET new_order_quantity = l_new_quantity WHERE order_type = 18 AND transaction_id = rec.child_id AND organization_id = rec.source_organization_id

AND plan_id =-1; dbms_output.put_line('Update if qty is different '||rec.child_id); Fnd_File.put_line(Fnd_File.LOG,'Update if qty is different '||rec.child_id); SELECT disposition_status_type ,new_schedule_date ,order_type ,new_order_quantity , old_order_quantity , reschedule_flag , firm_planned_type , lot_number , subinventory_code , expiration_date , planning_partner_site_id , planning_tp_type , owning_partner_site_id , owning_tp_type , vmi_flag , created_by INTO l_disposition_status_type ,l_new_schedule_date ,l_order_type ,l_new_order_quantity ,l_old_order_quantity ,l_reschedule_flag ,l_firm_planned_type ,l_lot_number ,l_subinventory_code ,l_expiration_date ,l_planning_partner_site_id

,l_planning_tp_type ,l_owning_partner_site_id ,l_owning_tp_type ,l_vmi_flag ,l_created_by FROM msc_supplies WHERE transaction_id = rec.child_id AND order_type = 18 AND plan_id = -1 AND organization_id = rec.source_organization_id; l_transaction_id := msc_supplies_s.nextval; dbms_output.put_line('New transaction_id '||l_transaction_id); Fnd_File.put_line(Fnd_File.LOG,'New transaction_id '||l_transaction_id); INSERT INTO msc_supplies (plan_id ,transaction_id ,organization_id ,sr_instance_id ,inventory_item_id ,new_schedule_date ,disposition_id -- -23453 ,disposition_status_type --1 ,order_type --18 ,new_order_quantity ,old_order_quantity ,reschedule_flag --2 ,firm_planned_type --2 ,lot_number ,subinventory_code ,expiration_date

,last_update_date ,last_updated_by ,creation_date ,created_by ,last_update_login ,planning_partner_site_id ,planning_tp_type ,owning_partner_site_id ,owning_tp_type ,vmi_flag) VALUES (-1 --p_plan_id ,l_transaction_id --msc_supplies_s.nextval --265741092 ,rec.organization_id --84 ,1 ,rec.inventory_item_id --338580 ,l_new_schedule_date , -23453 ,l_disposition_status_type ,18 -- order_type ,rec.quantity -- new_order_quantity ,rec.quantity -- old_order_quantity ,l_reschedule_flag ,l_firm_planned_type ,l_lot_number||'-1' ,l_subinventory_code ,l_expiration_date ,sysdate ,l_created_by ,sysdate -- last_update_date -- last_updated_by -- creation_date

,l_created_by ,-1

--created_by

--last_update_login

,rec.organization_id --l_planning_partner_site_id ,l_planning_tp_type -- planning_tp_type ,rec.organization_id --l_owning_partner_site_id ,l_owning_tp_type -- owning_tp_type ,l_vmi_flag ); dbms_output.put_line('After Insert '||rec.child_id); Fnd_File.put_line(Fnd_File.LOG,'After Insert '||rec.child_id); END IF; dbms_output.put_line('After IF '||rec.child_id); Fnd_File.put_line(Fnd_File.LOG,'After IF '||rec.child_id); END LOOP; dbms_output.put_line('After LOOP '); Fnd_File.put_line(Fnd_File.LOG,'After LOOP '); COMMIT; EXCEPTION WHEN OTHERS THEN Fnd_File.put_line(Fnd_File.LOG,'Error in updating '||SUBSTR(SQLERRM,1,200)); END; -- vmi_flag

/***********************************************************************

View to show all the material that is suggested to be moved by DRP plan
***********************************************************************/ CREATE OR REPLACE VIEW apps.si_msc_rebal_trnfer_v (transaction_id, order_type, organization_id, organization_code,

new_schedule_date, new_order_quantity, firm_planned_type, source_organization_id, source_organization_code, inventory_item_id, sr_inventory_item_id, item_name, plan_id, plan_name, child_id, quantity ) AS SELECT ms.transaction_id , ms.order_type , ms.organization_id , msi.organization_code , ms.new_schedule_date , ms.new_order_quantity , ms.firm_planned_type , ms.source_organization_id , mtp.organization_code , ms.inventory_item_id , msi.sr_inventory_item_id , msi.item_name , ms.plan_id , mp.compile_designator , msp.child_id , msp.quantity

FROM msc_supplies ms, msc_single_lvl_peg msp, msc_system_items msi, msc_supplies ms2, msc_plans mp, apps.msc_trading_partners mtp WHERE ms.transaction_id = msp.parent_id AND ms.order_type = 51 AND ms.inventory_item_id = msi.inventory_item_id AND ms.plan_id = msi.plan_id AND ms.plan_id = mp.plan_id AND mp.compile_designator = 'DRP_PLAN' -- DRP plan AND ms.sr_instance_id = msi.sr_instance_id AND ms.organization_id = msi.organization_id AND msp.pegging_type = 1 AND ms.plan_id = msp.plan_id AND ms2.transaction_id = msp.child_id AND ms2.order_type = 18 AND ms2.plan_id = msp.plan_id AND mtp.sr_tp_id=ms.source_organization_id AND mtp.partner_type=3 AND msp.child_id < > -1;

DRP validation SQL


select * from ( select a.source_organization_id, a.source_organization_code, sum(a.quantity) pegging, a.item_name, a.inventory_item_id, (select sum(new_order_quantity) from msc_supplies s

WHERE order_type = 18 AND s.organization_id=a.source_organization_id AND s.inventory_item_id=a.inventory_item_id AND s.plan_id =3061) supplies from ( SELECT ms.transaction_id , ms.order_type , ms.organization_id , msi.organization_code , ms.new_schedule_date , ms.new_order_quantity , ms.firm_planned_type , ms.source_organization_id , mtp.organization_code source_organization_code , ms.inventory_item_id , msi.sr_inventory_item_id , msi.item_name , ms.plan_id , mp.compile_designator , msp.child_id , msp.quantity FROM msc_supplies ms, msc_single_lvl_peg msp, msc_system_items msi, msc_supplies ms2, msc_plans mp, apps.msc_trading_partners mtp WHERE ms.transaction_id = msp.parent_id AND ms.order_type = 51 AND ms.inventory_item_id = msi.inventory_item_id

AND ms.plan_id = msi.plan_id AND ms.plan_id = mp.plan_id AND mp.compile_designator = 'DRP_PLAN' -- DRP plan AND ms.sr_instance_id = msi.sr_instance_id AND ms.organization_id = msi.organization_id AND msp.pegging_type = 1 AND ms.plan_id = msp.plan_id AND ms2.transaction_id = msp.child_id AND ms2.order_type = 18 AND ms2.plan_id = msp.plan_id AND mtp.sr_tp_id=ms.source_organization_id AND mtp.partner_type=3 AND msp.child_id < > -1) a group by a.source_organization_id, a.source_organization_code, a.item_name, a.inventory_item_id ) where pegging>supplies

To Find Duplicate Item Category Code


SELECT category_set_name, category_concat_segments, COUNT (*) FROM mtl_category_set_valid_cats_v WHERE (category_set_id = 1) GROUP BY category_set_name, category_concat_segments HAVING COUNT (*) > 1 ORDER BY category_concat_segments

Get Number Of canceled requisition


SELECT a.AUTHORIZATION_STATUS,(a.ORG_ID),(SELECT distinct hr.per_all_people_f.first_name|| || hr.per_all_people_f.middle_names|| || hr.per_all_people_f.last_name Employee Name FROM hr.per_all_people_f where hr.per_all_people_f.PERSON_ID in (select employee_id from fnd_user fu where fu.user_id = a.CREATED_BY)) CREATED_BY,count(SEGMENT1 ) FROM po_requisition_headers_all a WHERE a.creation_date BETWEEN TO_DATE(01/01/2007, DD/MM/YYYY) and TO_DATE(30/05/2007, DD/MM/YYYY) and a.AUTHORIZATION_STATUS = CANCELLED group by a.AUTHORIZATION_STATUS,a.ORG_ID,a.CREATED_BY

Number of line processed in Order Management


SELECT COUNT (line_id) Order Line Processed FROM oe_order_lines_all WHERE creation_date BETWEEN TO_DATE (:Fdate, DD/MM/YYYY) AND TO_DATE (:tdate, DD/MM/YYYY) AND flow_status_code = CLOSED;

To Check Item Catogry For Inventory master (No Of Segments May Vary)
SELECT ood.organization_name, segment1|| -|| segment2|| -|| segment3 catgory FROM org_organization_definitions ood, mtl_categories_vl mcv, mtl_category_sets mcs WHERE mcs.structure_id = mcv.structure_id ORDER BY ood.organization_name

Check Locators for inventory Inventory Org Wise(Number of segment may vary)
SELECT mil.segment1 loc_seg1, mil.segment11 loc_seg11, mil.segment2 loc_seg2, mil.segment3 loc_seg3, mil.segment4 loc_seg4, mil.segment5 loc_seg5, mil.segment6 loc_seg6,ood.ORGANIZATION_NAME,mil.SUBINVENTORY_CODE FROM mtl_item_locations mil,org_organization_definitions ood where mil.ORGANIZATION_ID = ood.ORGANIZATION_ID

Display All Subinventories Setup


select msi.secondary_inventory_name, MSI.SECONDARY_INVENTORY_NAME Subinventory, MSI.DESCRIPTION Description, MSI.DISABLE_DATE Disable Date, msi.PICKING_ORDER Picking Order, gcc1.concatenated_segments Material Account, gcc2.concatenated_segments Material Overhead Account, gcc3.concatenated_segments Resource Account, gcc4.concatenated_segments Overhead Account, gcc5.concatenated_segments Outside Processing Account, gcc6.concatenated_segments Expense Account, gcc7.concatenated_segments Encumbrance Account, msi.material_overhead_account, msi.resource_account, msi.overhead_account, msi.outside_processing_account, msi.expense_account, msi.encumbrance_account from mtl_secondary_inventories msi, gl_code_combinations_kfv gcc1,

gl_code_combinations_kfv gcc2, gl_code_combinations_kfv gcc3, gl_code_combinations_kfv gcc4, gl_code_combinations_kfv gcc5, gl_code_combinations_kfv gcc6, gl_code_combinations_kfv gcc7 where msi.material_account = gcc1.CODE_COMBINATION_ID(+) and msi.material_overhead_account = gcc2.CODE_COMBINATION_ID(+) and msi.resource_account = gcc3.CODE_COMBINATION_ID(+) and msi.overhead_account = gcc4.CODE_COMBINATION_ID(+) and msi.outside_processing_account = gcc5.CODE_COMBINATION_ID(+) and msi.expense_account = gcc6.CODE_COMBINATION_ID(+) and msi.encumbrance_account = gcc7.CODE_COMBINATION_ID(+) order by msi.secondary_inventory_name

To Select Unit Of measure exist in E-business suite


select uom_code,unit_of_measure from mtl_units_of_measure

Query to find out Customer Master Information. Customer Name, Account Number, Adress etc.
select p.PARTY_NAME,ca.ACCOUNT_NUMBER,loc.address1,loc.address2,loc.address3,loc.city,loc.postal_code, loc.country,ca.CUST_ACCOUNT_ID from apps.ra_customer_trx_all I, apps.hz_cust_accounts CA, apps.hz_parties P, apps.hz_locations Loc, apps.hz_cust_site_uses_all CSU, apps.hz_cust_acct_sites_all CAS, apps.hz_party_sites PS where I.COMPLETE_FLAG =Y and I.bill_TO_CUSTOMER_ID= CA.CUST_ACCOUNT_ID and ca.PARTY_ID=p.PARTY_ID and I.bill_to_site_use_id=csu.site_use_id and csu.CUST_ACCT_SITE_ID=cas.CUST_ACCT_SITE_ID and cas.PARTY_SITE_ID=ps.party_site_id and ps.location_id=loc.LOCATION_ID

Query to find on Hand Quantity


select sum(transaction_quantity) from MTL_ONHAND_QUANTITIES where inventory_item_id=9 and organization_id=188

Qunatity on order, Expected Deliver


select sum(ordered_quantity),a.SCHEDULE_SHIP_DATE from oe_order_lines_all a where inventory_item_id=10 and ship_from_org_id=188 group by a.SCHEDULE_SHIP_DATE

Query to find Item Code, Item Description Oracle Item Master Query
select item, description from mtl_system_items_b where inventory_item_id=&your_item and organization_id=&organization_id) item

Query to Find out On Hand Quantity of specific Item Oracle inventory


select sum(transaction_quantity) from mtl_onhand_quantity_details where inventory_item_id=&your_item and organization_id=&organization_id

Qty On Order, Expected delivery date(


select sum(ordered_quantity),scheduled_ship_date from oe_order_lines_all where inventory_item_id=&your_item

and ship_from_org_id=&organization_id group by scheduled_ship_date) order_info

Total Received Qty


select sum(transaction_quantity) from mtl_material_transactions inventory_item_id=&your_item and organization_id=&organization_id and transaction_quantity>0)

Total received Qty in 9 months


select sum(transaction_quantity) from mtl_material_transactions inventory_item_id=&your_item and organization_id=&organization_id and transaction_quantity>0 and transaction_date between trunc(sysdate) and trunc(sysdate-270))

Total issued quantity in 9 months


select sum(transaction_quantity) from mtl_material_transactions inventory_item_id=&your_item and organization_id=&organization_id and transaction_quantity<0 and transaction_date between trunc(sysdate) and trunc(sysdate-270)) tot_iss_qty_9mths, Average monthly consumption (select sum(transaction_quantity)/30 from mtl_material_transactions inventory_item_id=&your_item and organization_id=&organization_id and transaction_quantity<0) ;

Display all categories that the Item Belongs


SELECTunique micv.CATEGORY_SET_NAME Category Set, micv.CATEGORY_SET_ID Category Set ID, decode( micv.CONTROL_LEVEL, 1, Master, 2, Org, Other) Control Level, micv.CATEGORY_ID Category ID, micv.CATEGORY_CONCAT_SEGS Category FROM MTL_ITEM_CATEGORIES_V micv

Another Query to Get Onhand Qty With Oranization ID, Item Code, Quantity
SELECT organization_id, (SELECT ( msib.segment1|| -|| msib.segment2|| -|| msib.segment3|| -|| msib.segment4) FROM mtl_system_items_b msib WHERE msib.inventory_item_id = moq.inventory_item_id AND msib.organization_id = moq.organization_id) Item Code, (SELECT description FROM mtl_system_items_b msib WHERE msib.inventory_item_id = moq.inventory_item_id AND msib.organization_id = moq.organization_id) item Description, SUM (moq.transaction_quantity) onhandqty FROM mtl_onhand_quantities moq GROUP BY moq.organization_id, (moq.inventory_item_id)

Procure to Pay Cycle Query


Includes two scripts to fetch all the transactions information related with in a procure to pay cycle. Two scripts are provided to use one with receipts and other when receipts are not created.

WITH OUT RECEIPTS Procure to Pay query without receipts


select distinct reqh.segment1 REQ_NUM, reqh.AUTHORIZATION_STATUS REQ_STATUS, -poh.po_header_id, poh.segment1 PO_NUM, pol.line_num, poh.AUTHORIZATION_STATUS PO_STATUS, -i.invoice_id, i.invoice_num, i.invoice_amount, i.amount_paid, i.vendor_id, --v.vendor_name, p.check_id, c.check_number, h.gl_transfer_flag, h.period_name from ap_invoices_all i, ap_invoice_distributions_all invd, po_headers_all poh, po_lines_all pol, po_distributions_all pod, po_vendors v, po_requisition_headers_all reqh, po_requisition_lines_all reql, po_req_distributions_all reqd, ap_invoice_payments_all p, ap_checks_all c, ap_ae_headers_all h, ap_ae_lines_all l where 1=1 and i.vendor_id = v.vendor_id and c.check_id = p.check_id and p.invoice_id = i.invoice_id and poh.PO_HEADER_ID = pol.PO_HEADER_ID and reqh.REQUISITION_HEADER_ID = reql.REQUISITION_HEADER_ID

and reqd.REQUISITION_LINE_ID = reql.REQUISITION_LINE_ID and pod.REQ_DISTRIBUTION_ID = reqd.DISTRIBUTION_ID and pod.PO_HEADER_ID = poh.PO_HEADER_ID and pod.PO_DISTRIBUTION_ID = invd.PO_DISTRIBUTION_ID and invd.INVOICE_ID = i.INVOICE_ID and h.ae_header_id = l.ae_header_id and l.SOURCE_TABLE = 'AP_INVOICES' AND l.SOURCE_ID = i.invoice_id --and poh.segment1 = 4033816 -- PO NUMBER and reqh.segment1 = '501' --and i.invoice_num = 3114 --and c.check_number = --and vendor_id = -- REQ NUMBER -- INVOICE NUMBER -- CHECK NUMBER -- VENDOR ID

WITH RECEIPTS PROCURE TO PAY CYCLE QUERY WITH RECEIPTS


SELECT DISTINCT reqh.segment1 req_num, reqh.authorization_status req_status, -POH.PO_HEADER_ID, poh.segment1 po_num, pol.line_num, poh.authorization_status po_status, rcvh.receipt_num, rcv.inspection_status_code, -I.INVOICE_ID, i.invoice_num, i.invoice_amount, i.amount_paid, i.vendor_id, --V.VENDOR_NAME, P.CHECK_ID, c.check_number, h.gl_transfer_flag, h.period_name FROM ap_invoices_all i, ap_invoice_distributions_all invd, po_headers_all poh, po_lines_all pol, po_distributions_all pod, po_vendors v, po_requisition_headers_all reqh, po_requisition_lines_all reql, po_req_distributions_all reqd, rcv_transactions rcv, rcv_shipment_headers rcvh, rcv_shipment_lines rcvl,

ap_invoice_payments_all p, ap_checks_all c, ap_ae_headers_all h, ap_ae_lines_all l WHERE 1 = 1 AND i.vendor_id = v.vendor_id AND c.check_id = p.check_id AND p.invoice_id = i.invoice_id AND poh.po_header_id = pol.po_header_id AND reqh.requisition_header_id = reql.requisition_header_id AND reqd.requisition_line_id = reql.requisition_line_id AND pod.req_distribution_id = reqd.distribution_id AND pod.po_header_id = poh.po_header_id --AND POH.PO_HEADER_ID = RCV.PO_HEADER_ID AND rcvh.shipment_header_id = rcv.shipment_header_id(+) --AND RCVH.SHIPMENT_HEADER_ID = RCVL.SHIPMENT_HEADER_ID --AND RCV.TRANSACTION_TYPE = 'RECEIVE' --AND RCV.SOURCE_DOCUMENT_CODE = 'PO' --AND POL.PO_LINE_ID = RCV.PO_LINE_ID --AND POD.PO_DISTRIBUTION_ID = RCV.PO_DISTRIBUTION_ID AND pod.po_distribution_id = invd.po_distribution_id AND invd.invoice_id = i.invoice_id AND h.ae_header_id = l.ae_header_id AND l.source_table = 'AP_INVOICES' AND l.source_id = i.invoice_id --AND POH.SEGMENT1 = 36420 -- PO NUMBER AND reqh.segment1 = '501' --AND I.INVOICE_NUM = 3114 --AND C.CHECK_NUMBER = --AND VENDOR_ID = --AND RECEIPT_NUM = 692237 -- REQ NUMBER -- INVOICE NUMBER -- CHECK NUMBER -- VENDOR ID

Re-process errored RCV transactions as no error found


select b.column_name, error_message,error_message_name, table_name,a.header_interface_id,a.* from apps.rcv_transactions_interface a, apps.po_interface_errors b where b.interface_header_id=a.header_interface_id and b.interface_line_id(+)=a.interface_transaction_id

select header_interface_id, a.* from apps.rcv_transactions_interface a

select * from apps.po_interface_errors where interface_line_id in (2207326, 2207327);

select * from apps.po_interface_errors where interface_header_id in (652186, 652187);

update apps.rcv_transactions_interface set processing_status_code='PENDING', transaction_status_code='PENDING' where interface_transaction_id in (2207326, 2207327);

update apps.rcv_headers_interface a set processing_status_code='PENDING', validation_flag='Y' where header_interface_id in (652186, 652187);

commit;

Other Searching for RCV transactions


select * from apps.rcv_transactions_interface a where interface_transaction_id in (2207735, 2207736, 2207750)

select * from apps.po_line_locations_all where line_location_id in (813687, 813683, 813704)

select * from apps.rcv_transactions where po_line_location_id in (813687, 813683, 813704) and transaction_type='DELIVER'

Check if RCV transaction already processed


select b.column_name, error_message,error_message_name, table_name,a.header_interface_id,a.* from apps.rcv_transactions_interface a, apps.po_interface_errors b where b.interface_header_id=a.header_interface_id and b.interface_line_id(+)=a.interface_transaction_id

select po_line_location_id from apps.rcv_transactions_interface a where interface_transaction_id in (2207735,

2207736, 2207750)

select * --check if quantity received shows receipt from apps.po_line_locations_all where line_location_id in (813687, 813683, 813704)

select * --check if transaction existing from apps.rcv_transactions where po_line_location_id in (813687, 813683, 813704) and transaction_type='DELIVER'

delete from apps.rcv_headers_interface where header_interface_id in (653172, 653173, 653175);

delete from apps.rcv_transactions_interface where interface_transaction_id in (2207735, 2207736, 2207750);

commit;

for creating BOM


CREATE OR REPLACE FORCE VIEW "APPS"."SI_BILLS_OF_MATERIAL_V" ("ITEM", "ORG_CODE", "ORG_NAME", "ITEM_DESCRIPTION", "ALTERNATE", "ITEM_STATUS", "ITEM_PLANNER", "COMPONENT_ITEM", "COMPONENT_DESCRIPTION", "COMPONENT_STATUS", "COMPONENT_PLANNER", "UOM", "COMPONENT_QUANTITY", "EFFECTIVE_FROM", "EFFECTIVE_TO", "LAST_UPDATE_DATE",Organization_id, inventory_item_id) AS (SELECT ia.segment1 item, mp.ORGANIZATION_CODE, hr.name, ia.description item_description, b.alternate_bom_designator alternate, ia.inventory_item_status_code item_status, ia.planner_code item_planner, ic.segment1 component_item, ic.description component_description, ic.inventory_item_status_code component_status, ic.planner_code component_planner, ic.primary_unit_of_measure uom, c.component_quantity, TRUNC(c.effectivity_date) effective_from, TRUNC(c.disable_date) effective_to, c.last_update_date, ic.organization_id, --Added By Raj Singh on 28-SEP-12 for Ticket#31558 ic.inventory_item_id --Added By Raj Singh on 28-SEP-12 for Ticket#31558 FROM bom_bill_of_materials b, bom_inventory_components c, mtl_system_items_b ia, mtl_system_items_b ic, mtl_parameters mp, hr_organization_units hr WHERE b.bill_sequence_id = c.bill_sequence_id AND b.assembly_item_id = ia.inventory_item_id AND b.organization_id = ia.organization_id

AND b.ORGANIZATION_ID

= hr.ORGANIZATION_ID

AND hr.ORGANIZATION_ID = mp.ORGANIZATION_ID AND c.component_item_id = ic.inventory_item_id AND ia.organization_id = ic.organization_id );

Triniti Interface Errors ErrorTriniti > > > > > > > > > > >
Solutionselect * from po_headers_all where segment1=7000490; ============================================================================================
Purchase Order Status: select segment1 po#, revision_num r#, substr(type_lookup_code,1,4) type, authorization_status auth_status, closed_code, wf_item_type, wf_item_key, org_id from po_headers_all where segment1 = '&PO_NUMBER' Requisition Status: select segment1 req#,authorization_status auth_status, closed_code, wf_item_type, wf_item_key, org_id from po_requisition_headers_all where segment1 = '&REQ_NUM' Release Status: select po.segment1 po#, rel.release_num rel#, po.revision_num po_r#, po.authorization_status po_status, po.closed_code close_po, po.wf_item_type po_type, po.wf_item_key po_key, po.org_id org, rel.wf_item_type rel_type, rel.wf_item_key rel_key, rel.po_release_id rel_id, rel.authorization_status rel_status, rel.hold_flag hold from po_headers_all po, po_releases_all rel where po.po_header_id = rel.po_header_id and po.segment1 = '&PO_NUM' and rel.release_num = 'REL_NUM' order by 1,2

, Interface Report ASEK-ASSY SII1292CNUC , PMG799F , RECEIVING , Error at stmt , num -2707- No Valid Blanket or Release ,24013

Purchase Order Action History: select poah.sequence_num seq#, poah.action_date, poah.action_code, poah.employee_id emp_id, fnd.user_name, substr(poah.object_type_code,1,3) type, poah.object_sub_type_code sub_type, poah.object_revision_num rev, pohead.org_id from po_action_history poah, fnd_user fnd, po_headers_all pohead where poah.object_id = pohead.po_header_id and pohead.segment1 = '&PO_NUMBER' and pohead.org_id = '&ORG_ID' and substr(poah.object_type_code,1,3) = 'PO' and poah.employee_id = fnd.employee_id and fnd.session_number != 0 order by 2,1 Requisition Action History: select poah.sequence_num seq#, poah.action_date, poah.action_code, poah.employee_id emp_id, fnd.user_name, substr (poah.object_type_code,1,3) type, poah.object_sub_type_code sub_type, poah.object_revision_num rev, pohead.org_id, poah.note from po_action_history poah, fnd_user fnd, po_requisition_headers_all pohead where poah.object_id = pohead.requisition_header_id and pohead.segment1 = '&REQ_NUMBER' and substr(poah.object_type_code,1,3) = 'REQ' and pohead.org_id = '&ORG_ID' and poah.employee_id = fnd.employee_id and fnd.session_number != 0 order by 9,2,1 Position Attached to Username: SELECT pos.name position_name, pa.position_id,fnd.user_name FROM PER_ALL_ASSIGNMENTS_F pa, per_positions pos,per_jobs job, fnd_user fnd WHERE pa.POSITION_ID = pos.POSITION_ID and pa.job_ID = job.job_id and sysdate between pa.EFFECTIVE_START_DATE and pa.EFFECTIVE_END_DATE and pa.primary_flag = 'Y' and pa.assignment_type = 'E' and pa.person_id = fnd.employee_id and pa.PERSON_ID = (select employee_id from fnd_user where user_name = '&user_name' CODE FILES The following code files can be used to compare the file versions in the problematic instance to those available in later patches, for possible fixes. This can be done by searching on Metalink, under Patches, searching by file name (included in). Type Filename Description Workflow poxwfrqa.wft Requisition Approval Workflow file Workflow poxwfpoa.wft Purchase Order Approval Workflow file Workflow poxwfatc.wft CREATEPO Workflow file Package POXWPA1B.pls PO_REQAPPROVAL_INIT1 - Base Requisition Approval Package POXWPA2B.pls PO_POAPPROVAL_INIT1 - Base Purchase Order Approval Package POXWPA3B.pls PO_REQAPPROVAL_FINDAPPRV1 - Find Approver for Reqs Package POXWPA4B.pls PO_REQAPPROVAL_ACTION - Req Approval Action & History Package POXWPA5B.pls PO_REQAPPROVAL_LAUNCH - Start of Req Approval Process Package POXWPA9B.pls PO_APPROVAL_ACTION - PO Approval Action and History

1] TO LIST OUT ALL CANCEL REQUISITIONS:->> list My cancel Requistion

select prh.REQUISITION_HEADER_ID, prh.PREPARER_ID , prh.SEGMENT1 "REQ NUM", trunc(prh.CREATION_DATE), prh.DESCRIPTION, prh.NOTE_TO_AUTHORIZERfrom apps.Po_Requisition_headers_all prh, apps.po_action_history pah where Action_code='CANCEL' and pah.object_type_code='REQUISITION' and pah.object_id=prh.REQUISITION_HEADER_ID 2] TO LIST ALL INTERNAL REQUISITIONS THAT DO NOT HAVE AN ASSOCIATED INTERNAL SALES ORDER >> Select RQH.SEGMENT1 REQ_NUM,RQL.LINE_NUM,RQL.REQUISITION_HEADER_ID ,RQL.REQUISITION_LINE_ID,RQL.ITEM_ID ,RQL.UNIT_MEAS_LOOKUP_CODE ,RQL.UNIT_PRICE ,RQL.QUANTITY ,RQL.QUANTITY_CANCELLED,RQL.QUANTITY_DELIVERED ,RQL.CANCEL_FLAG ,RQL.SOURCE_TYPE_CODE ,RQL.SOURCE_ORGANIZATION_ID ,RQL.DESTINATION_ORGANIZATION_ID,RQH.TRANSFERRED_TO_OE_FLAGfromPO_REQUISITION_LINES_ALL RQL, PO_REQUISITION_HEADERS_ALL RQHwhereRQL.REQUISITION_HEADER_ID = RQH.REQUISITION_HEADER_IDand RQL.SOURCE_TYPE_CODE = 'INVENTORY'and RQL.SOURCE_ORGANIZATION_ID is not nulland not exists (select 'existing internal order'from OE_ORDER_LINES_ALL LINwhere LIN.SOURCE_DOCUMENT_LINE_ID = RQL.REQUISITION_LINE_IDand LIN.SOURCE_DOCUMENT_TYPE_ID = 10)

ORDER BY RQH.REQUISITION_HEADER_ID, RQL.LINE_NUM; 3] Display what requisition and PO are linked(Relation with Requisition and PO )>>

select r.segment1 "Req Num", p.segment1 "PO Num"from po_headers_all p, po_distributions_all d,po_req_distributions_all rd, po_requisition_lines_all rl,po_requisition_headers_all r where p.po_header_id = d.po_header_id and d.req_distribution_id = rd.distribution_id and rd.requisition_line_id = rl.requisition_line_id and rl.requisition_header_id = r.requisition_header_id 4] List all Purchase Requisition without a Purchase Order that means a PR has not been autocreated to PO. (Purchase Requisition without a Purchase Order)>>

select prh.segment1 "PR NUM", trunc(prh.creation_date) "CREATED ON", trunc(prl.creation_date) "Line Creation Date" , prl.line_num "Seq #", msi.segment1 "Item Num", prl.item_description "Description", prl.quantity "Qty", trunc(prl.need_by_date) "Required By", ppf1.full_name "REQUESTOR", ppf2.agent_name "BUYER" from po.po_requisition_headers_all prh, po.po_requisition_lines_all prl, apps.per_people_f ppf1, (select distinct agent_id,agent_name from apps.po_agents_v ) ppf2, po.po_req_distributions_all prd, inv.mtl_system_items_b msi, po.po_line_locations_all pll, po.po_lines_all pl, po.po_headers_all ph WHERE prh.requisition_header_id = prl.requisition_header_id and prl.requisition_line_id = prd.requisition_line_id and ppf1.person_id = prh.preparer_id and prh.creation_date between ppf1.effective_start_date and ppf1.effective_end_date and ppf2.agent_id(+) = msi.buyer_id and msi.inventory_item_id = prl.item_id and msi.organization_id = prl.destination_organization_id and pll.line_location_id(+) = prl.line_location_id and pll.po_header_id = ph.po_header_id(+) AND PLL.PO_LINE_ID = PL.PO_LINE_ID(+) AND PRH.AUTHORIZATION_STATUS = 'APPROVED' AND PLL.LINE_LOCATION_ID IS NULL AND PRL.CLOSED_CODE IS NULL AND NVL(PRL.CANCEL_FLAG,'N') <> 'Y' ORDER BY 1,2 5] list all information form PR to PO as a requisition moved from different stages till converting into PR. This query capture all details related to that PR to PO.>> LIST AND ALL DATA ENTRY FROM PR TILL PO

select distinct u.description "Requestor", porh.segment1 as "Req Number", trunc(porh.Creation_Date) "Created On", pord.LAST_UPDATED_BY, porh.Authorization_Status "Status", porh.Description "Description", poh.segment1 "PO Number", trunc(poh.Creation_date) "PO Creation Date", poh.AUTHORIZATION_STATUS "PO Status", trunc(poh.Approved_Date) "Approved Date"from apps.po_headers_all poh, apps.po_distributions_all pod, apps.po_req_distributions_all pord, apps.po_requisition_lines_all porl, apps.po_requisition_headers_all porh, apps.fnd_user u where porh.requisition_header_id = porl.requisition_header_id and porl.requisition_line_id = pord.requisition_line_id and pord.distribution_id = pod.req_distribution_id(+) and pod.po_header_id = poh.po_header_id(+) and porh.created_by = u.user_id order by 2 6] Identifying all POs which does not have any PRs>>LIST ALL PURCHASE REQUISITION WITHOUT A PURCHASE ORDER THAT MEANS A PR HAS NOT BEEN AUTOCREATED TO PO. select prh.segment1 "PR NUM", trunc(prh.creation_date) "CREATED ON", trunc(prl.creation_date) "Line Creation Date" , prl.line_num "Seq #", msi.segment1 "Item Num", prl.item_description "Description", prl.quantity "Qty", trunc(prl.need_by_date) "Required By", ppf1.full_name "REQUESTOR", ppf2.agent_name "BUYER" from po.po_requisition_headers_all prh, po.po_requisition_lines_all prl, apps.per_people_f ppf1, (select distinct agent_id,agent_name from apps.po_agents_v ) ppf2, po.po_req_distributions_all prd, inv.mtl_system_items_b msi, po.po_line_locations_all pll, po.po_lines_all pl, po.po_headers_all ph WHERE prh.requisition_header_id = prl.requisition_header_id and prl.requisition_line_id = prd.requisition_line_id and ppf1.person_id = prh.preparer_id and prh.creation_date between ppf1.effective_start_date and ppf1.effective_end_date and ppf2.agent_id(+) = msi.buyer_id and msi.inventory_item_id = prl.item_id and msi.organization_id = prl.destination_organization_id and pll.line_location_id(+) = prl.line_location_id and pll.po_header_id = ph.po_header_id(+) AND PLL.PO_LINE_ID = PL.PO_LINE_ID(+) AND PRH.AUTHORIZATION_STATUS = 'APPROVED' AND PLL.LINE_LOCATION_ID IS NULL AND PRL.CLOSED_CODE IS NULL AND NVL(PRL.CANCEL_FLAG,'N') <> 'Y' ORDER BY 1,2 7] Relation between Requisition and PO tables>>Here is link:

PO_DISTRIBUTIONS_ALL =>PO_HEADER_ID, REQ_DISTRIBUTION_IDPO_HEADERS_ALL=>PO_HEADER_ID, SEGMENT1PO_REQ_DISTRIBUTIONS_ALL =>DISTRIBUTION_ID, REQUISITION_LINE_IDPO_REQUISITION_LINES_ALL =>REQUISITION_LINE_ID)PO_REQUISITION_HEADERS_ALL =>REQUISITION_HEADER_ID, REQUISITION_LINE_ID, SEGMENT1 What you have to make a join on PO_DISTRIBUTIONS_ALL (REQ_DISTRIBUTION_ID) and PO_REQ_DISTRIBUTIONS_ALL (DISTRIBUTION_ID) to see if there is a PO for the req. --You need to find table which hold PO Approval path These two table keeps the data: PO_APPROVAL_LIST_HEADERS PO_APPROVAL_LIST_LINES 8] List all the POs with there approval ,invoice and Payment Details>>LIST AND PO WITH THERE APPROVAL , INVOICE AND PAYMENT DETAILS

select a.org_id "ORG ID", E.SEGMENT1 "VENDOR NUM",e.vendor_name "SUPPLIER NAME",UPPER(e.vendor_type_lookup_code) "VENDOR TYPE", f.vendor_site_code "VENDOR SITE CODE",f.ADDRESS_LINE1 "ADDRESS",f.city "CITY",f.country "COUNTRY", to_char(trunc(d.CREATION_DATE)) "PO Date", d.segment1 "PO NUM",d.type_lookup_code "PO Type", c.quantity_ordered "QTY ORDERED", c.quantity_cancelled "QTY CANCELLED", g.item_id "ITEM ID" , g.item_description "ITEM DESCRIPTION",g.unit_price "UNIT PRICE", (NVL(c.quantity_ordered,0)NVL(c.quantity_cancelled,0))*NVL(g.unit_price,0) "PO Line Amount", (select decode(ph.approved_FLAG, 'Y', 'Approved') from po.po_headers_all ph where ph.po_header_ID = d.po_header_id)"PO Approved?", a.invoice_type_lookup_code "INVOICE TYPE",a.invoice_amount "INVOICE AMOUNT", to_char(trunc(a.INVOICE_DATE)) "INVOICE DATE", a.invoice_num "INVOICE NUMBER", (select decode(x.MATCH_STATUS_FLAG, 'A', 'Approved') from ap.ap_invoice_distributions_all x where x.INVOICE_DISTRIBUTION_ID = b.invoice_distribution_id)"Invoice Approved?", a.amount_paid,h.amount, h.check_id, h.invoice_payment_id "Payment Id", i.check_number "Cheque Number", to_char(trunc(i.check_DATE)) "PAYMENT DATE" FROM AP.AP_INVOICES_ALL A, AP.AP_INVOICE_DISTRIBUTIONS_ALL B, PO.PO_DISTRIBUTIONS_ALL C, PO.PO_HEADERS_ALL D, PO.PO_VENDORS E, PO.PO_VENDOR_SITES_ALL F, PO.PO_LINES_ALL G, AP.AP_INVOICE_PAYMENTS_ALL H, AP.AP_CHECKS_ALL I where a.invoice_id = b.invoice_id and b.po_distribution_id = c. po_distribution_id (+) and c.po_header_id = d.po_header_id (+) and e.vendor_id (+) = d.VENDOR_ID and f.vendor_site_id (+) = d.vendor_site_id and d.po_header_id = g.po_header_id and c.po_line_id = g.po_line_id and a.invoice_id = h.invoice_id and h.check_id = i.check_id and f.vendor_site_id = i.vendor_site_id and c.PO_HEADER_ID is not null and a.payment_status_flag = 'Y' and d.type_lookup_code != 'BLANKET' 10] To know the link to GL_JE_LINES table for purchasing accrual and budgetary control actions..The budgetary (encumbrance) and accrual actions in the purchasing module generate records that will be imported into GL for the corresponding accrual and budgetary journals.

The following reference fields are used to capture and keep PO information in the GL_JE_LINES table. These reference fields are populated when the Journal source (JE_SOURCE in GL_JE_HEADERS) isPurchasing. Budgetary Records from PO (These include reservations, reversals and cancellations): REFERENCE_1- Source (PO or REQ) REFERENCE_2- PO Header ID or Requisition Header ID (from po_headers_all.po_header_id orpo_requisition_headers_all.requisition_header_id) REFERENCE_3- Distribution ID (from po_distributions_all.po_distribution_id orpo_req_distributions_all.distribution_id) REFERENCE_4- Purchase Order or Requisition number (from po_headers_all.segment1 orpo_requisition_headers_all.segment1) REFERENCE_5- (Autocreated Purchase Orders only) Backing requisition number (from po_requisition_headers_all.segment1) Accrual Records from PO: REFERENCE_1- Source (PO) REFERENCE_2- PO Header ID (from po_headers_all.po_header_id) REFERENCE_3- Distribution ID (from po_distributions_all.po_distribution_id REFERENCE_4- Purchase Order number (from po_headers_all.segment1) REFERENCE_5- (ON LINE ACCRUALS ONLY) Receiving Transaction ID (from rcv_receiving_sub_ledger.rcv_transaction_id) Take a note for Period end accruals, the REFERENCE_5 column is not used. 11] List all open PO'S>> select h.segment1 "PO NUM", h.authorization_status "STATUS", l.line_num "SEQ NUM", ll.line_location_id, d.po_distribution_id , h.type_lookup_code "TYPE" from po.po_headers_all h, po.po_lines_all l, po.po_line_locations_all ll, po.po_distributions_all d where h.po_header_id = l.po_header_id and ll.po_line_id = l.po_Line_id and ll.line_location_id = d.line_location_id and h.closed_date is null and h.type_lookup_code not in ('QUOTATION') 12] There are different authorization_status can a requisition have.Approved Cancelled In Process Incomplete Pre-Approved Rejected and you should note: When we finally close the requisition from Requisition Summary form the authorization_status of the requisition does not change. Instead its closed_code becomes FINALLY CLOSED. 13] A standard Quotations one that you can tie back to a PO. Navigate to RFQ -> Auto create -> enter a PO and reference it back. 14] To debug for a PO , where should I start.Thats is possible, your PO get stuck somewhere, so what you have to do is to analyze which stage it stucked.Get po_header_id first and run each query and then analyze the data.For better understanding this is splited into 5 major stages. Stage 1: PO Creation : PO_HEADERS_ALL select po_header_id from po_headers_all where segment1 =; select * from po_headers_all where po_header_id =; po_lines_all select * from po_lines_all where po_header_id =; po_line_locations_all

select * from po_line_locations_all where po_header_id =; po_distributions_all select * from po_distributions_all where po_header_id =; po_releases_all SELECT * FROM po_releases_all WHERE po_header_id =; Stage 2: Once PO is received data is moved to respective receving tables and inventory tables RCV_SHIPMENT_HEADERS select * from rcv_shipment_headers where shipment_header_id in(select shipment_header_id from rcv_shipment_lineswhere po_header_id =); RCV_SHIPMENT_LINES select * from rcv_shipment_lines where po_header_id =; RCV_TRANSACTIONS select * from rcv_transactions where po_header_id =; RCV_ACCOUNTING_EVENTS SELECT * FROM rcv_Accounting_Events WHERE rcv_transaction_id IN(select transaction_id from rcv_transactionswhere po_header_id =); RCV_RECEIVING_SUB_LEDGER select * from rcv_receiving_sub_ledger where rcv_transaction_id in (select transaction_id from rcv_transactions where po_header_id =); RCV_SUB_LEDGER_DETAILS select * from rcv_sub_ledger_detailswhere rcv_transaction_id in (select transaction_id from rcv_transactions where po_header_id =); MTL_MATERIAL_TRANSACTIONS select * from mtl_material_transactions where transaction_source_id =; MTL_TRANSACTION_ACCOUNTS select * from mtl_transaction_accounts where transaction_id in ( select transaction_id from mtl_material_transactions where transaction_source_id = =); Stage 3: Invoicing details AP_INVOICE_DISTRIBUTIONS_ALL select * from ap_invoice_distributions_all where po_distribution_id in ( select po_distribution_id from po_distributions_all where po_header_id =); AP_INVOICES_ALL select * from ap_invoices_all where invoice_id in(select invoice_id from ap_invoice_distributions_all where po_distribution_id in( select po_distribution_id from po_distributions_all where po_header_id =)); Stage 4 : Many Time there is tie up with Project related PO PA_EXPENDITURE_ITEMS_ALL select * from pa_expenditure_items_all peia where peia.orig_transaction_reference in( select to_char(transaction_id) from mtl_material_transactionswhere transaction_source_id = ); Stage 5 : General Ledger Prompt 17. GL_BC_PACKETS ..This is for encumbrances SELECT * FROM gl_bc_packets WHERE reference2 IN (); GL_INTERFACE SELECT *FROM GL_INTERFACE GLIWHERE user_je_source_name =PurchasingAND gl_sl_link_table =RSLAND reference21=POAND EXISTS( SELECT 1FROM rcv_receiving_sub_ledger RRSLWHERE GLI.reference22 =RRSL.reference2AND GLI.reference23 =RRSL.reference3AND GLI.reference24 =RRSL.reference4AND RRSL.rcv_transaction_id in(select transaction_id from rcv_transactionswhere po_header_id )); GL_IMPORT_REFERENCES SELECT *FROM gl_import_references GLIRWHERE reference_1=POAND gl_sl_link_table =RSLAND EXISTS( SELECT 1FROM rcv_receiving_sub_ledger RRSLWHERE GLIR.reference_2 =RRSL.reference2AND GLIR.reference_3 =RRSL.reference3AND GLIR.reference_4 =RRSL.reference4AND RRSL.rcv_transaction_id in(select transaction_id from rcv_transactions where po_header_id =))

Das könnte Ihnen auch gefallen