Sunday, February 27, 2022

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;

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.