Data Conversion Extract Queries
Data Conversion Extract Queries
DBMS_APPLICATION_INFO.set_client_info (1703);
END;
/* Item Attachment*/
SELECT msib.segment1 item_number, ad.seq_num sequence_number,
mp.organization_code item_organization, dct.user_name category_name,
dt.description document_description, dat.user_name datatype_name,
det.user_entity_name entity_name, dt.LANGUAGE LANGUAGE,
d.security_type security_type, d.publish_flag, d.usage_type,
fdlt.long_text, fdst.short_text
FROM apps.fnd_document_datatypes dat,
apps.fnd_document_entities_tl det,
apps.fnd_documents_tl dt,
apps.fnd_documents d,
apps.fnd_document_categories_tl dct,
apps.fnd_attached_documents ad,
apps.mtl_parameters mp,
apps.mtl_system_items_b msib,
apps.fnd_documents_long_text fdlt,
apps.fnd_documents_short_text fdst
WHERE d.document_id = ad.document_id
AND dt.document_id = d.document_id
AND dt.LANGUAGE = USERENV ('LANG')
AND dct.category_id = d.category_id
AND dct.LANGUAGE = USERENV ('LANG')
AND d.datatype_id = dat.datatype_id
AND dat.LANGUAGE = USERENV ('LANG')
AND ad.entity_name = det.data_object_code
AND det.LANGUAGE = USERENV ('LANG')
AND ad.pk1_value = TO_CHAR (msib.organization_id)
AND ad.pk2_value = TO_CHAR (msib.inventory_item_id)
AND msib.organization_id = mp.organization_id
AND mp.organization_code = 'TOL'
--AND msib.inventory_item_id = 806124
AND dt.media_id = fdlt.media_id(+)
AND dt.media_id = fdst.media_id(+)
ORDER BY det.user_entity_name, ad.seq_num;
Query10: /*Routings*/
-- AR Tax Information
SELECT a.trx_number, b.extended_amount tax_amount
FROM apps.ra_customer_trx a,
apps.ra_customer_trx_lines b,
apps.ra_batch_sources c,
apps.ra_customers d,
apps.ra_customers e,
apps.ra_cust_trx_types f,
apps.hr_operating_units hr,
apps.ra_terms term,
apps.ar_memo_lines memo,
apps.ar_vat_tax_vl tax
WHERE a.customer_trx_id = b.customer_trx_id
AND b.line_type = 'TAX'
AND a.batch_source_id = c.batch_source_id
AND a.bill_to_customer_id = d.customer_id
AND a.ship_to_customer_id = e.customer_id
AND a.cust_trx_type_id = f.cust_trx_type_id
AND a.term_id = term.term_id
AND a.org_id = hr.organization_id
and hr.organization_id = 1703
AND b.memo_line_id = memo.memo_line_id(+)
AND b.vat_tax_id = tax.vat_tax_id(+)
AND c.NAME = 'ORDER MANAGEMENT-VLVS'
/*Kindly note that i was not able to extract the expense account information
which was specified in
the data file.*/
Query15: /*Suppliers*/
--Supplier header
SELECT pv.vendor_name, pv.segment1 legacy_system_vendor_number,
pv.vendor_type_lookup_code, pv.num_1099 tax_payer_id, pv.enabled_flag,
pv.summary_flag,
-- SIC_CODE ,
pv.small_business_flag, pv.women_owned_flag,
pv.minority_group_lookup_code, pv.federal_reportable_flag,
pv.type_1099 income_tax_type, pv.state_reportable_flag,
pv.tax_reporting_name, pv.organization_type_lookup_code,
pv.enforce_ship_to_location_code, pv.receiving_routing_id,
pv.qty_rcv_tolerance, pv.qty_rcv_exception_code,
pv.days_early_receipt_allowed, pv.days_late_receipt_allowed,
pv.receipt_days_exception_code, pv.allow_substitute_receipts_flag,
pv.allow_unordered_receipts_flag, pv.inspection_required_flag,
pv.receipt_required_flag, pv.payment_priority,
pv.pay_date_basis_lookup_code, pv.terms_date_basis,
pv.payment_method_lookup_code, pv.employee_id, pv.attribute2,
-- UPDATE FLAG ,
pv.allow_awt_flag naming_standard_flag
FROM apps.po_vendors pv;
--supplier sites
SELECT pvs.org_id emr_company_name, pv.vendor_name,
pv.segment1 legacy_system_vendor_number, pvs.vendor_site_code,
pvs.address_line1, pvs.address_line2, pvs.address_line3, pvs.city,
pvs.state, pvs.province, pvs.county, pvs.zip, pvs.country,
pvs.purchasing_site_flag, pvs.rfq_only_site_flag, pvs.pay_site_flag,
pvs.supplier_notif_method, pvs.email_address, pvs.area_code, pvs.phone,
pvs.fax_area_code, pvs.fax,
pvs.accts_pay_code_combination_id supplier_liability_account,
pvs.prepay_code_combination_id supplier_pre_payment_account,
pvs.terms_id payment_terms, pvs.pay_group_lookup_code,
pvs.payment_priority, pvs.pay_date_basis_lookup_code,
pvs.terms_date_basis, pvs.payment_method_lookup_code,
pvs.invoice_currency_code, pvs.payment_currency_code,
pvs.bank_account_num supplier_bank_acct_no, pvs.vat_code tax_code,
pvs.tax_reporting_site_flag, pvs.ship_to_location_id,
pvs.bill_to_location_id, pvs.freight_terms_lookup_code,
pvs.fob_lookup_code, pvs.match_option, pvs.ship_via_lookup_code,
pvs.bank_number supplier_bank_number,
--SUPPLIER BRANCH NUMBER
pvs.vat_registration_num tax_registration_number
--Naming Standards over-ride flag
--Ship Method
FROM apps.po_vendor_sites_all pvs, apps.po_vendors pv
WHERE pvs.vendor_id = pv.vendor_id AND pvs.org_id = 1703;
-- PO Headers
SELECT pha.comments header_description, hou.NAME organization_name,
--Action
--Document Type Code
pha.currency_code, pha.agent_id, pv.vendor_name, pvs.vendor_site_id,
pvs.vendor_site_code,
--Legacy Vendor Number
hl1.location_code ship_to_location,
hl2.location_code bill_to_location, apt.NAME payment_terms,
pha.fob_lookup_code fob, pha.freight_terms_lookup_code freight_terms,
-- Authorization Status
pha.vendor_contact_id, pha.segment1 po_number,
pha.ship_via_lookup_code carrier,
--Vendor Number
pha.note_to_receiver,
pha.note_to_vendor, pha.creation_date,
--Amount Agreed
--Effective from
--Effective To
pha.amount_limit
FROM apps.po_headers_all pha,
apps.hr_locations hl1,
apps.hr_locations hl2,
apps.ap_terms apt,
apps.hr_operating_units hou,
apps.po_vendors pv,
apps.po_vendor_sites_all pvs
WHERE pha.type_lookup_code = 'STANDARD'
AND pha.org_id = hou.organization_id
AND pha.org_id = 6720
AND hl1.location_id = pha.ship_to_location_id
AND hl2.location_id = pha.bill_to_location_id
AND apt.term_id = pha.terms_id
AND pvs.vendor_id = pv.vendor_id
and pha.vendor_id = pv.vendor_id
and pha.vendor_site_id = pvs.vendor_site_id
-- and trunc(pha.creation_date) > trunc(sysdate - 6)
-- and pha.segment1 like '%-T'
-- PO Lines
SELECT pha.segment1 po_number, pla.line_num line_number,
plla.shipment_num shipment_number, plt.line_type line_type,
msi.segment1 item_number, pla.item_description item_description,
pla.unit_meas_lookup_code unit_of_measure, plla.quantity quantity,
plla.need_by_date, pla.unit_price unit_price,
plla.taxable_flag tax_flag, plla.tax_name tax_name, rrh.routing_name,
--plla.INVOICE_MATCHING,
--pla.SUPPLIER_REF_NUMBER Supplier_Item_Number,
plla.attribute3 freight_fwder, plla.attribute9 ship_method,
ood.organization_code inventory_organization,
hl.location_code ship_to_location
FROM apps.po_line_locations_all plla,
apps.po_lines_all pla,
apps.po_headers_all pha,
apps.mtl_system_items msi,
apps.org_organization_definitions ood,
apps.hr_locations hl,
apps.po_line_types_tl plt,
apps.rcv_routing_headers rrh
WHERE plla.po_header_id = pla.po_header_id
AND pla.po_header_id = pha.po_header_id
and plla.po_header_id = pha.po_header_id
AND pla.po_line_id = plla.po_line_id
AND plla.ship_to_organization_id = msi.organization_id
AND pla.item_id = msi.inventory_item_id
AND msi.organization_id = 6721
AND plla.ship_to_location_id = hl.location_id
AND msi.organization_id = ood.organization_id
AND pla.line_type_id = plt.line_type_id
AND pha.type_lookup_code = 'STANDARD'
AND pha.org_id = 6720
--and plla.last_updated_by in (29015)
AND pla.line_type_id = plt.line_type_id
AND plt.source_lang = 'US'
AND rrh.routing_header_id = plla.receiving_routing_id
and trunc(pha.creation_date) > trunc(sysdate - 7)
and pha.segment1 like '%-T'
-- PO Distributions
SELECT phl.segment1 po_number, pll.line_num, pda.distribution_num,
pov.vendor_name, (SELECT full_name
FROM apps.per_people_x
WHERE person_id = phl.agent_id) agent_name,
pvs.vendor_site_code, phl.freight_terms_lookup_code, pll.quantity,
pll.quantity_committed, pll.committed_amount, pda.quantity_ordered,
phl.currency_code, phl.status_lookup_code, phl.note_to_vendor,
phl.note_to_receiver, pov.segment1 vendor_number, phl.fob_lookup_code,
phl.amount_limit, phl.approved_flag, phl.start_date_active,
phl.end_date_active,
(SELECT NAME
FROM apps.ap_terms_tl
WHERE term_id = phl.terms_id
AND LANGUAGE = USERENV ('lang')) pay_terms,
(SELECT line_type
FROM apps.po_line_types
WHERE line_type_id = pll.line_type_id) line_type,
(SELECT segment1
FROM apps.mtl_system_items_b
WHERE inventory_item_id = pll.item_id AND ROWNUM = 1) item_number,
pll.item_description, pll.unit_price, pll.taxable_flag, pll.tax_name,
pll.matching_basis, unit_meas_lookup_code uom, destination_type_code,
--Quote Lines
SELECT 2222 record_id, pla.line_num, plla.shipment_num, plt.line_type,
msi.segment1 item_number, pla.item_revision, NULL category_segments,
pla.item_description, pla.unit_meas_lookup_code unit_of_measure,
plla.quantity, pla.unit_price,
pla.supplier_ref_number supplier_item_number,
ood.organization_code inventory_organization,
hl.location_code ship_to_location, pha.segment1 quote_number,
NULL lead_time, NULL lead_time_uom_days
FROM apps.po_line_locations_all plla,
apps.po_lines_all pla,
apps.po_headers_all pha,
apps.mtl_system_items msi,
apps.org_organization_definitions ood,
apps.hr_locations hl,
apps.po_line_types_tl plt
WHERE plla.po_header_id = pla.po_header_id
AND pla.po_header_id = pha.po_header_id
AND pla.po_line_id = plla.po_line_id
AND plla.ship_to_organization_id = msi.organization_id
AND pla.item_id = msi.inventory_item_id
AND msi.organization_id = 1704
AND plla.ship_to_location_id = hl.location_id
AND msi.organization_id = ood.organization_id
AND pha.type_lookup_code = 'QUOTATION'
AND pha.org_id = 1703
AND pla.line_type_id = plt.line_type_id
AND plt.source_lang = 'US';
-- br.expenditure_type,
(SELECT expenditure_type
FROM apps.pa_expenditure_types
WHERE expenditure_type = br.expenditure_type) expenditure_type,
br.attribute1 queue_resource,
DECODE (br.cost_code_type,
1, 'Material',
2, 'Material Overhead',
3, 'Resource',
4, 'Outside Processing',
5, 'Overhead',
NULL
) cost_code_type,
msib.segment1 osp_item,
DECODE (br.allow_costs_flag, 1, 'Y', 2, 'N', NULL) allow_costs_flag,
-- br.default_activity_id,
(SELECT activity
FROM apps.cst_activities ca
WHERE activity_id = br.default_activity_id) activity,
DECODE (br.standard_rate_flag,
1, 'Y',
2, 'N',
NULL
) standard_rate_flag,
gcc1.segment1
|| '-'
|| gcc1.segment2
|| '-'
|| gcc1.segment3
|| '-'
|| gcc1.segment4
|| '-'
|| gcc1.segment5
|| '-'
|| gcc1.segment6
|| '-'
|| gcc1.segment7 absorption_account,
gcc2.segment1
|| '-'
|| gcc2.segment2
|| '-'
|| gcc2.segment3
|| '-'
|| gcc2.segment4
|| '-'
|| gcc2.segment5
|| '-'
|| gcc2.segment6
|| '-'
|| gcc2.segment7 rate_variance_account
FROM apps.bom_resources br,
apps.mtl_parameters mp,
apps.gl_code_combinations gcc1,
apps.gl_code_combinations gcc2,
apps.mtl_system_items_b msib
WHERE br.organization_id = mp.organization_id
AND mp.organization_code = 'SZK'
AND br.rate_variance_account = gcc2.code_combination_id(+)
AND br.absorption_account = gcc1.code_combination_id(+)
AND msib.inventory_item_id(+) = br.purchase_item_id
AND msib.organization_id(+) = br.organization_id;
SELECT spec_type,
spec_number,
spec_name,
spec_revision,
spec_status status,
replaced_by_spec_number replaced_by,
spec_details SPECIFICATION,
spec_url url
FROM apps.xxinv_vlvs_add_spec_details;
SELECT mp.organization_code,
DECODE ((SELECT COUNT (1)
FROM xxinv_vlvs_item_add_spec
WHERE spec_number = xia.spec_number
AND inv_item_id = xia.inv_item_id
AND organization_id = xia.organization_id
AND xia.organization_id <> mp.master_organization_id),
0, 'N',
'Y'
) common_flag,
msb.segment1 item_number,
xia.spec_number spec_no,
xia.po_print_flag p_o_t,
xia.wo_print_flag w_o_t,
work_order_document_flag w_o_d,
NULL add_update_delete
FROM apps.xxinv_vlvs_item_add_spec xia,
apps.xxinv_vlvs_add_spec_details xad,
apps.mtl_parameters mp,
apps.mtl_system_items_b msb
WHERE xia.organization_id = mp.organization_id
AND xia.spec_type = xad.spec_type
AND xia.spec_number = xad.spec_number
AND mp.organization_code = 'SZK'
AND msb.inventory_item_id = xia.inv_item_id
AND msb.organization_id = xia.organization_id;