You are on page 1of 4

/*Blanket PO Lines */

SELECT pha.segment1 || '-' || pla.line_num interface_line_key,


pha.segment1 interface_header_key,
'ADD' action,
pla.line_num,
pltv.line_type,
( SELECT max(segment1) from mtl_system_items
where inventory_item_id = pla.item_id
)item,
-- pla.category_id,
pla.item_description,
pla.item_revision,
NVL((SELECT mc.segment1||'.'||mc.segment2||'.'||mc.segment3 category_name
FROM mtl_item_categories mic,
mtl_category_sets mcs,
mtl_categories mc,
org_organization_definitions ood
WHERE ood.organization_id = mic.organization_id
AND mic.category_set_id = mcs.category_set_id
AND mic.category_id = mc.category_id
AND mcs.category_set_name = 'Purchasing Commodity'
AND ood.organization_code = 'GLO'
AND mic.inventory_item_id = pla.item_id and rownum = 1),'UNASSIGNED')
category_name, --<< Need to Check???
-- pla.committed_amount,
(NVL(pla.quantity,0) * pla.unit_price) amount,
-- pla.quantity,
pla.unit_meas_lookup_code,
pla.unit_price,
pla.allow_price_override_flag,
pla.not_to_exceed_price,
pla.vendor_product_num,
NULL filler1,
pla.note_to_vendor,
NULL note_to_receiver,
null secondary_quantity,
null secondary_unit_of_measure,
null vendor_product_num,
null negotiated_by_preparer_flag,
null hazard_class,
null un_number,
pla.note_to_vendor,
NULL note_to_receiver,
NULL attribute_category,
NULL attribute1,
NULL attribute2,
NULL attribute3,
NULL attribute4,
NULL attribute5,
NULL attribute6,
NULL attribute7,
NULL attribute8,
NULL attribute9,
NULL attribute10,
NULL attribute11,
NULL attribute12,
NULL attribute13,
NULL attribute14,
NULL attribute15,
NULL attribute16,
NULL attribute17,
NULL attribute18,
NULL attribute19,
NULL attribute20,
NULL
attribute_date1,
NULL
attribute_date2,
NULL
attribute_date3,
NULL
attribute_date4,
NULL
attribute_date5,
NULL
attribute_date6,
NULL
attribute_date7,
NULL
attribute_date8,
NULL
attribute_date9,
NULL
attribute_date10,
NULL
attribute_number1,
NULL
attribute_number2,
NULL
attribute_number3,
NULL
attribute_number4,
NULL
attribute_number5,
NULL
attribute_number6,
NULL
attribute_number7,
NULL
attribute_number8,
NULL
attribute_number9,
NULL
attribute_number10,
NULL
attribute_timestamp1,
NULL
attribute_timestamp2,
NULL
attribute_timestamp3,
NULL
attribute_timestamp4,
NULL
attribute_timestamp5,
NULL
attribute_timestamp6,
NULL
attribute_timestamp7,
NULL
attribute_timestamp8,
NULL
attribute_timestamp9,
NULL
attribute_timestamp10,
NULL unit_weight,
NULL
weight_uom_code,
NULL
weight_unit_of_measure,
NULL unit_volume,
NULL
volume_uom_code,
NULL
volume_unit_of_measure,
NULL template_name,
NULL
item_attribute_category,
NULL
item_attribute1,
NULL
item_attribute2,
NULL
item_attribute3,
NULL
item_attribute4,
NULL
item_attribute5,
NULL
item_attribute6,
NULL
item_attribute7,
NULL
item_attribute8,
NULL
item_attribute9,
NULL
item_attribute10,
NULL
item_attribute11,
NULL
item_attribute12,
NULL
item_attribute13,
NULL
item_attribute14,
NULL
item_attribute15,
NULL
source_agreement_prc_bu_name,
NULL
source_agreement,
NULL
source_agreement_line,
NULL Amt,
pla.price_break_lookup_code ,
pla.quantity orig_qty
FROM po_headers_all pha
, po_lines_all pla
, po_line_types pltv
WHERE pha.po_header_id = pla.po_header_id
AND pltv.line_type_id(+) = pla.line_type_id
AND NVL (pla.cancel_flag, 'N') = 'N'
AND pha.approved_flag = 'Y'
AND NVL (pha.closed_code, 'OPEN') NOT IN ('FINALLY CLOSED', 'CLOSED','CLOSED
FOR RECEIVING')
AND NVL (pla.closed_code, 'OPEN') NOT IN ('FINALLY CLOSED', 'CLOSED','CLOSED
FOR RECEIVING')
AND pha.type_lookup_code = 'BLANKET'
--and pha.segment1
IN( '30002','30011','30576','30026','30052','30059','30586','31007','31046','34475'
)
order by pha.segment1

You might also like