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);
Wednesday, April 13, 2022
FA:SCM:CST: SQL to Get Item Standard Cost
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;