select
a.po_header_id,
a.BLANKET_TOTAL_AMOUNT ceiling_of_the_order,
a.end_date valid_till,
a.creation_date,
a.segment1,a.comments,
a.revision_num ,
a.revised_date,
a.APPROVED_DATE,
b.po_line_id pld,
a.ship_to_location_id,a.agent_id ,a.ship_via_lookup_code,A.TERMS_ID,
a.attribute1,A.FREIGHT_TERMS_LOOKUP_CODE FREIGHT,a.fob_lookup_code,
a.bill_to_location_id,b.line_num,b.item_id,b.item_description,b.quantity,
b.unit_price,(b.quantity*b.unit_price) qty_into_rate,fvl.description,
b.unit_meas_lookup_code,c.segment1 vendor_code,c.vendor_name,d.address_line1 vendad1,
d.address_line2 vednad2,d.address_line3 vendad3,
d.city,d.state,d.zip,d.province, fnd.territory_short_name country,
d.area_code, d.phone,d.fax,
d.email_address,
b.po_line_id line_id,
a.bill_to_location_id,
a.ship_to_location_id,
a.attribute4 Attachment,
fvl.description meaning,
a.attribute3 format,
fvl2.description format_desc,
e.line_location_id,
e.need_by_date ship_need_date,
e.quantity shp_qty,
a.org_id,
b.unit_meas_lookup_code uom_cd
from
po_headers_all a,
po_lines_all b,
po_vendors c,
po_vendor_sites_all d,
fnd_flex_values_vl fvl,
FND_TERRITORIES_VL fnd,
FND_FLEX_VSET_V ffv,
fnd_flex_values_vl fvl2,
FND_FLEX_VSET_V ffv2,
po_line_locations_all e
where a.po_header_id=b.po_header_id
and a.vendor_id=c.vendor_id
and nvl(a.cancel_flag,'N') = 'N'
and nvl(b.cancel_flag,'N') = 'N'
and a.vendor_site_id=d.vendor_site_id
and c.vendor_id=d.vendor_id
and
fvl.flex_value=a.attribute1 and fvl.flex_value_set_id=ffv.flex_value_set_id
and ffv.parent_value_set_name like 'DIV_TEST'
and
fvl2.flex_value=a.attribute3 and fvl2.flex_value_set_id=ffv2.flex_value_set_id
and ffv2.parent_value_set_name like 'FORMAT_TEST'
and
fnd.territory_code = d.country AND
a.segment1 = :purchase_order_from
and a.org_id = :p_org_id
and
b.po_header_id =e.po_header_id and
b.po_line_id =e.po_line_id;
No comments:
Post a Comment