SELECT iod.organization_code,
iod.organization_name,
iod.business_unit_name,
iod.business_unit_id,
iod.legal_entity,
xep.NAME legal_entity_name,
hla.location_code,
hla.location_name,
hla.internal_location_code ,
Concat(Concat(Concat(Concat(Concat(Concat( Concat(Concat(hla.address_line_1
|| ', ', Nvl2(hla.address_line_2, hla.address_line_2
|| ', ', hla.address_line_2)), Nvl2(hla.address_line_3, hla.address_line_3
|| ', ', hla.address_line_3)), Nvl2(hla.address_line_4, hla.address_line_4
|| ', ', hla.address_line_4)), Nvl2(hla.town_or_city, hla.town_or_city
|| ', ', hla.town_or_city)), Nvl2(hla.region_1, hla.region_1
|| ', ', hla.region_1)), Nvl2(hla.region_2, hla.region_2
|| ', ', hla.region_2)), Nvl2(hla.country, country
|| ', ', hla.country)), hla.postal_code) concatenated_address,
iod.inventory_enabled_flag,
iod.inventory_flag,
iod.distributed_organization_flag,
iod.profit_center_bu_id,
iod.mfg_plant_flag,
iod.contract_mfg_flag,
iod.eam_enabled_flag,
iod.timezone_code
FROM inv_organization_definitions_v iod,
hr_locations_all hla,
xle_entity_profiles xep
WHERE iod.location_id = hla.location_id
AND iod.legal_entity = xep.legal_entity_id
AND NVL(iod.disable_date, sysdate+1) > sysdate;
Tuesday, June 14, 2022
FA:SQL: Query to get inventory organization/inventory organization location and business unit and Legal entity
Wednesday, April 13, 2022
FA:SCM:CST: SQL to Get Item Standard Cost
SELECT houft.name cost_organization_name
, esi.item_number
, csc.total_cost
, uom.uom_code
, cvu.val_unit_code
, cvs.val_structure_code
, cvs.val_structure_type_code
, ccb.cost_book_code
FROM cst_std_costs csc
, cst_val_units_b cvu
, cst_val_structures_b cvs
, egp_system_items_vl esi
, cst_cost_org_parameters ccop
, hr_organization_units_f_tl houft
, cst_cost_books_b ccb
, inv_units_of_measure_vl uom
WHERE csc.cost_book_id = ccb.cost_book_id
AND csc.cost_org_id = houft.organization_id
AND ccop.cost_org_id = houft.organization_id
AND cvu.val_structure_id = cvs.val_structure_id
AND csc.val_unit_id = cvu.val_unit_id
AND esi.inventory_item_id = csc.inventory_item_id
AND esi.organization_id = ccop.master_organization_id
AND houft.LANGUAGE = Userenv('LANG')
AND csc.uom_code = uom.uom_code
AND csc.status_code = 'PUBLISHED'
AND esi.item_number = :p_item_number
AND houft.name = :p_cost_org_name
AND trunc(nvl(csc.effective_end_date,sysdate+1)) > trunc(sysdate);
Fusion:SCM:MFG: SQL to Validat the Componenet Issue and WO Completion transactions against Work Order
SELECT imt.transaction_id,iop.organization_code warehouse_code
, TO_CHAR(imt.creation_date,'DD-MON-YYYY') txn_creation_date
, ittv.transaction_type_name
, flva.meaning transaction_action
, itst.transaction_source_type_name
, esi.item_number
, imt.subinventory_code
, imt.transaction_quantity
, imt.transaction_uom
, imt.transaction_date
, imt.transaction_source_name
, iut.serial_number
FROM fusion.inv_material_txns imt
, fusion.inv_org_parameters iop
, fusion.egp_system_items_b esi
, fusion.inv_transaction_types_vl ittv
, fusion.fnd_lookup_values_vl flva
, fusion.inv_txn_source_types_vl itst
, fusion.inv_unit_transactions iut
WHERE imt.organization_id = iop.organization_id
AND imt.organization_id = esi.organization_id
AND imt.inventory_item_id = esi.inventory_item_id
AND imt.transaction_type_id = ittv.transaction_type_id
AND ittv.transaction_action_id = flva.lookup_code
AND flva.lookup_type = 'INV_TRANSACTION_ACTION'
AND flva.enabled_flag = 'Y'
AND ittv.transaction_source_type_id = itst.transaction_source_type_id
AND imt.transaction_id = iut.transaction_id(+)
AND UPPER(ittv.transaction_type_name) IN ('WORK IN PROCESS MATERIAL ISSUE', 'WORK IN PROCESS PRODUCT COMPLETION')
AND UPPER(itst.transaction_source_type_name) = 'WORK ORDER'
AND esi.item_number = NVL(:p_item_number,esi.item_number)
AND iop.organization_code = NVL(:p_org_code,iop.organization_code)
AND imt.transaction_source_name = NVL(:p_wo_number, imt.transaction_source_name)
AND esi.item_number = NVL(:p_item_number, esi.item_number)
ORDER BY imt.creation_date desc;
Sunday, February 27, 2022
Oracle Fusion SQL : SQL to Extract Transfer Order details
, e.line_number
, so.organization_code source_inv_org
, do.organization_code dest_inv_org
, sku.item_number
, e.requested_qty
, e.shipped_qty
, e.received_qty
, e.delivered_qty
, e.source_subinventory_code source_subinventory
, e.destination_subinventory_code dest_subinventory
, d.fulfill_orchestration_required
, d.source_type_lookup hdr_source_type_lookup
, e.source_organization_id
, e.destination_organization_id
, e.line_id
, e.interface_status_lookup
, e.source_type_lookup
, e.destination_type_lookup
, e.destination_location_id
, e.status_lookup
, e.need_by_date
, e.scheduled_ship_date
, e.qty_uom_code
, e.unit_price
, e.req_bu_id
, e.supply_order_reference_number
, e.supply_order_ref_line_number
, d.header_id
, sku.inventory_item_id
, d.creation_date
FROM fusion.inv_transfer_order_headers d
, fusion.inv_transfer_order_lines e
, fusion.inv_org_parameters so
, fusion.inv_org_parameters do
, fusion.egp_system_items_b sku
WHERE 1 = 1
AND sku.inventory_item_id = e.inventory_item_id
AND sku.organization_id = e.source_organization_id
AND do.organization_id = e.destination_organization_id
AND so.organization_id = e.source_organization_id
AND d.header_id = e.header_id
AND so.organization_code = :p_from_organization
AND do.organization_code = :p_to_organization
AND sku.item_number = NVL(:p_part_number, sku.item_number)
AND e.supply_order_reference_number = Nvl(:p_supply_order, e.supply_order_reference_number)
ORDER BY d.creation_date DESC
, 1
, Lpad(e.line_number, 2);
Oracle Fusion SQL: OSQL to Extract Inventory Pending Transactions (Records stuck in Oracle inventory Interface table)
SELECT iop.organization_code,
iop.organization_name,
ittv.transaction_type_name,
flva.meaning transaction_action,
mti.tRANSACTION_SOURCE_NAME,
itst.transaction_source_type_name,
mti.transaction_interface_id txn_iface_id,
mti.transaction_header_id txn_hdr_id,
mti.inventory_item_id inv_item_id,
egp.item_number,
mti.subinventory_code subinv_code,
mti.transaction_quantity txn_qty,
mti.transaction_uom uom,
mti.transaction_type_id txn_typ_id,
mti.transaction_action_id txn_act_id,
mti.transaction_source_type_id txn_sty_id,
mti.transaction_source_id txn_src_id,
TO_CHAR(mti.transaction_date, 'DD-MON-YYYY HH24:MI:SS') txn_date,
mti.source_code src_code,
mti.process_flag pflag,
decode(to_char(nvl(mti.process_flag, 0)),'1', 'Ready', '2', 'Not Ready', '3', 'Error', to_char(mti.process_flag) ) pflag_desc,
mti.transaction_mode tmode,
decode( mti.transaction_mode, '2', 'Immediate', '3', 'Background', to_char(mti.transaction_mode) ) tmode_desc,
NVL(mti.lock_flag, 'N') lflag,
decode(mti.lock_flag, '1', 'Locked', '2', 'Not Locked', 'Not Locked') lflag_desc,
mti.error_code error_code,
mti.error_explanation error_explanation
FROM fusion.inv_transactions_interface mti,
fusion.inv_transaction_types_vl ittv,
fusion.fnd_lookup_values_vl flva,
fusion.inv_txn_source_types_vl itst,
fusion.egp_system_items_b egp,
fusion.inv_organization_definitions_v iop
WHERE 1 = 1
AND ittv.transaction_source_type_id = itst.transaction_source_type_id
AND mti.transaction_type_id = ittv.transaction_type_id
AND ittv.transaction_action_id = flva.lookup_code
AND flva.lookup_type = 'INV_TRANSACTION_ACTION'
AND flva.enabled_flag = 'Y'
AND iop.organization_id = egp.organization_id
AND mti.organization_id = egp.organization_id
AND mti.inventory_item_id = egp.inventory_item_id
AND iop.organization_code = NVL(:p_organization_code, iop.organization_code)
AND egp.item_number = NVL(:p_item_number, egp.item_number)
AND mti.error_code IS NOT NULL
ORDER BY transaction_date;
Oracle Fusion: SQL to extract Inventory Organization Parameters Details
SELECT a.organization_id,
a.organization_code,
g.name organization_name,
a.master_organization_id,
b.organization_code master_organization_code,
a.business_unit_id,
a.legal_entity_id,
a.negative_inv_receipt_code,
e.meaning neg_meaning,
a.stock_locator_control_code,
c.meaning stock_locator_meaning,
a.serial_number_type,
d.meaning serial_number_type_meaning,
a.lot_number_uniqueness,
f.meaning lot_uniq_meaning
FROM inv_org_parameters a,
inv_org_parameters b,
fnd_lookups c,
fnd_lookups d,
fnd_lookups e,
fnd_lookups f,
hr_organization_units_f_tl g
WHERE a.master_organization_id = b.organization_id
AND c.lookup_type = 'INV_LOCATION_CONTROL'
AND a.stock_locator_control_code = c.lookup_code (+)
AND d.lookup_type = 'INV_SERIAL_NUMBER'
AND a.serial_number_type = d.lookup_code (+)
AND e.lookup_type = 'INV_YES_NO_NUMERIC'
AND a.negative_inv_receipt_code = e.lookup_code (+)
AND f.lookup_type = 'INV_LOT_UNIQUENESS'
AND a.lot_number_uniqueness = f.lookup_code (+)
AND g.organization_id = a.organization_id
AND g.language = 'US'
ORDER BY a.organization_id
Friday, February 26, 2021
SQL to get the RMA Details In Oracle Fusion (Inventory/Order Management)
SELECT DISTINCT iop.organization_code warehouse_code
, haotl.name warehouse_name
, rt.subinventory
, rah.ra_document_number AS rma_number
, dla.display_line_number line_number
, dla.display_line_number
|| '.'
|| dfla.fulfill_line_number rma_line_number
, rsh.receipt_num rma_receipt_number
, esi.item_number sku
, nvl2(dlsn.item_serial_number_from, 1, rsl.quantity_received) quantity_received
, dlsn.item_serial_number_from
, dlsn.item_serial_number_to
, rt.transaction_id
, rt.transaction_type
, rt.quantity
, rt.uom_code
, ral.receipt_advice_line_number AS doo_fulfil_line_id
, dfld.rma_receipt_date AS rma_receipt_date
, rt.creation_date
, rt.transaction_date
, dha.order_type_code
, DECODE(dha.order_type_code, 'B2BRMA', NVL(substr(dfla.source_line_number,0,instr(dfla.source_line_number,'.')-1),dfla.source_line_number),1) source_line_number
FROM rcv_shipment_headers rah
, rcv_shipment_lines ral
, rcv_shipment_headers rsh
, rcv_shipment_lines rsl
, rcv_transactions rt
, inv_org_parameters iop
, fusion.hr_organization_units_f_tl haotl
, fusion.hr_org_unit_classifications_f houc
, doo_fulfill_lines_all dfla
, doo_fulfill_line_details dfld
, doo_lot_serial_numbers dlsn
, egp_system_items_b esi
, doo_lines_all dla
, doo_headers_all dha
WHERE 1 = 1
-- AND rah.ra_document_number = '1595254717339306'
AND rt.transaction_type = 'DELIVER'
AND rt.source_document_code = 'RMA'
AND rt.shipment_header_id = rsh.shipment_header_id
AND rt.shipment_line_id = rsl.shipment_line_id
AND rsh.shipment_header_id = rsl.shipment_header_id
AND rt.receipt_advice_header_id = rah.shipment_header_id
AND rt.receipt_advice_line_id = ral.shipment_line_id
AND iop.organization_id = rsl.to_organization_id
AND haotl.organization_id = rsl.to_organization_id
AND haotl.language = userenv('LANG')
AND houc.organization_id = haotl.organization_id
AND houc.classification_code = 'INV'
AND rt.transaction_id = dfld.rma_receipt_transaction_id
AND dfla.fulfill_line_id = dfld.fulfill_line_id
AND upper(dfld.task_type) = 'RETURN'
AND dfla.fulfill_line_id = dlsn.fulfill_line_id (+)
AND dfla.inventory_item_id = esi.inventory_item_id
AND dfla.inventory_organization_id = esi.organization_id
AND dfla.line_id = dla.line_id
AND dla.header_id = dha.header_id
ORDER BY 4
, 5
, 6
SQL to get Material Transaction Details (Oracle Fusion Inventory Management)
SQL to get Material Transaction Details
SELECT iop.organization_code warehouse_code
, ittv.transaction_type_name
, flva.meaning transaction_action
, itst.transaction_source_type_name
, esi.item_number
, imt.subinventory_code
, imt.transaction_quantity
, imt.transaction_uom
, imt.primary_quantity
, imt.transaction_date
, imt.transaction_source_id
, imt.transaction_source_name
, imt.rcv_transaction_id
, imt.distribution_account_id
, imt.trx_source_line_id
, imt.trx_source_delivery_id
, imt.rma_line_id
, imt.transfer_transaction_id
, imt.transaction_Set_id
, imt.source_code
, imt.source_line_id
, imt.transfer_organization_id
, imt.transfer_subinventory
, imt.shipment_number
FROM inv_material_txns imt
, inv_org_parameters iop
, egp_system_items_b esi
, inv_transaction_types_vl ittv
, fnd_lookup_values_vl flva
, inv_txn_source_types_vl itst
WHERE imt.organization_id = iop.organization_id
AND imt.organization_id = esi.organization_id
AND imt.inventory_item_id = esi.inventory_item_id
AND imt.transaction_type_id = ittv.transaction_type_id
AND ittv.transaction_action_id = flva.lookup_code
AND flva.lookup_type = 'INV_TRANSACTION_ACTION'
AND flva.enabled_flag = 'Y'
AND ittv.transaction_source_type_id = itst.transaction_source_type_id
AND ittv.transaction_type_name = 'RMA Receipt';
/
Sales Order Issue Materail Transaction Report.
SELECT iop.organization_code warehouse_code
, ittv.transaction_type_name
, flva.meaning transaction_action
, itst.transaction_source_type_name
, esi.item_number
, imt.subinventory_code
, imt.transaction_quantity
, imt.transaction_uom
, imt.primary_quantity
, imt.transaction_date
, imt.transaction_source_id
, imt.transaction_source_name
, imt.rcv_transaction_id
, imt.distribution_account_id
, imt.trx_source_line_id
, imt.trx_source_delivery_id
, imt.rma_line_id
, imt.transfer_transaction_id
, imt.transaction_set_id
, imt.source_code
, imt.source_line_id
, imt.transfer_organization_id
, imt.transfer_subinventory
, imt.shipment_number
, dha.source_order_number
, dha.order_number
, dfla.status_code
, dfla.source_line_number
FROM inv_material_txns imt
, inv_org_parameters iop
, egp_system_items_b esi
, inv_transaction_types_vl ittv
, fnd_lookup_values_vl flva
, inv_txn_source_types_vl itst
, fusion.doo_headers_all dha
, fusion.doo_fulfill_lines_all dfla
, fusion.wsh_delivery_assignments wda
, fusion.wsh_new_deliveries wnd
, fusion.wsh_delivery_details wdd
WHERE imt.organization_id = iop.organization_id
AND imt.organization_id = esi.organization_id
AND imt.inventory_item_id = esi.inventory_item_id
AND imt.transaction_type_id = ittv.transaction_type_id
AND ittv.transaction_action_id = flva.lookup_code
AND flva.lookup_type = 'INV_TRANSACTION_ACTION'
AND flva.enabled_flag = 'Y'
AND ittv.transaction_source_type_id = itst.transaction_source_type_id
AND ittv.transaction_type_name LIKE 'Sales Order Issue'
AND dha.header_id = dfla.header_id
AND dfla.fulfill_line_id = wdd.source_shipment_id
AND wdd.delivery_detail_id = wda.delivery_detail_id
AND wda.delivery_id = wnd.delivery_id (+)
AND wda.delivery_detail_id = imt.trx_source_line_id (+)
AND dha.submitted_flag = 'Y'
/