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.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
, iut.serial_number
, rsh.receipt_num rma_receipt_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
, fusion.rcv_shipment_headers rsh
, fusion.rcv_shipment_lines rsl
, fusion.rcv_transactions rt
, fusion.DOO_FULFILL_LINE_DETAILS dfld
, fusion.DOO_FULFILL_LINES_ALL dfla
, fusion.DOO_HEADERS_ALL dha
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 ittv.transaction_type_name = 'RMA Receipt'
AND itst.transaction_source_type_name = 'RMA'
AND rsh.shipment_header_id = rsl.shipment_header_id
AND rsh.shipment_header_id = rt.shipment_header_id
AND rsl.shipment_header_id = rt.shipment_header_id
AND rsl.shipment_line_id = rt.shipment_line_id
AND rt.transaction_id = imt.rcv_transaction_id
AND imt.rcv_transaction_id = dfld.RMA_RECEIPT_TRANSACTION_ID
AND dfld.fulfill_line_id = dfla.fulfill_line_id
AND dfla.header_id = dha.header_id
and dha.submitted_flag = 'Y'
AND dha.order_number = :p_order_number
ORDER BY imt.creation_date DESC
Tuesday, March 22, 2022
Fusion: SCM: SQL to get the RMA receipts and order number details
Sunday, February 27, 2022
Oracle Fusion SQL: SQL to Extract the Sales order Orchestraction Steps with each Step Status details
SELECT h.source_order_number
, h.header_id
, f.fulfill_line_id
, f.source_line_number
, f.source_line_id
, pd.process_name
, psvl.step_id
, psvl.step_number
, psvl.parent_step_number
, psvlt.step_name
, psi.step_instance_id
, psi.group_id
, psvl.step_type
, psi.step_active
, psi.step_status
, psi.task_instance_id
, nvl(to_char(psi.actual_start_date, 'dd-mm-yy hh24:mi:ss'), 'NULL') "actual_start_Date"
, nvl(to_char(psi.actual_completion_date, 'dd-mm-yy hh24:mi:ss'), 'NULL') "actual_completion_Date"
, nvl(to_char(psi.planned_start_date, 'dd-mm-yy hh24:mi:ss'), 'NULL') "planned_start_Date"
, nvl(to_char(psi.planned_completion_date, 'dd-mm-yy hh24:mi:ss'), 'NULL') "planned_completion_Date"
, nvl(to_char(psi.required_start_date, 'dd-mm-yy hh24:mi:ss'), 'NULL') "required_start_Date"
, nvl(to_char(psi.required_completion_date, 'dd-mm-yy hh24:mi:ss'), 'NULL') "required_completion_Date"
, psi.last_updated_by
FROM fusion.doo_headers_all h
, fusion.doo_fulfill_lines_all f
, fusion.doo_orchestration_groups g
, fusion.doo_process_steps_b psvl
, fusion.doo_process_definitions_b pd
, fusion.doo_process_steps_tl psvlt
, fusion.doo_process_step_instances psi
WHERE 1 = 1
AND h.submitted_flag = 'Y'
AND h.header_id = f.header_id
AND f.header_id = g.header_id
AND g.status = 'ACTIVE'
AND f.fulfill_line_id = g.fulfillment_line_id
AND g.doo_process_instance_id = psi.doo_process_instance_id
AND psi.step_id = psvl.step_id
AND psvl.step_id = psvlt.step_id
AND psvl.doo_process_id = pd.doo_process_id
AND psvlt.language = userenv('LANG')
AND H.ORDER_NUMBER = :p_order_number
ORDER BY h.source_order_number
, LPAD(f.source_line_number, 2)
, f.fulfill_line_id
, psvl.doo_process_id
, psvl.step_number;
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;
Tuesday, July 20, 2021
FA:OM:SQL To List EFF Segments and attribute Columns mapping for Specific Context
SELECT DISTINCT fdcb.context_code
, fdcb.context_identifier
, fdcb.enabled_flag
, fdsb.segment_code
, fdsb.segment_identifier
, fdsb.column_name
FROM fusion.fnd_df_contexts_tl fdct
, fusion.fnd_df_contexts_b fdcb
, fusion.fnd_df_segments_tl fdst
, fusion.fnd_df_segments_b fdsb
WHERE fdct.context_code = fdcb.context_code
AND fdcb.context_code = fdsb.context_code
AND fdst.context_code = fdsb.context_code
AND fdst.segment_code = fdsb.segment_code
AND fdct.application_id = fdcb.application_id
AND fdct.language = userenv('Lang')
AND fdst.language = userenv('Lang')
AND fdct.descriptive_flexfield_code = 'DOO_FULFILL_LINES_ADD_INFO'
AND fdcb.context_code = '<Context_Code>'
ORDER BY fdcb.context_identifier
, fdsb.segment_identifier
Tuesday, July 6, 2021
FA:RCV:SQL to get RMA Receipts Details in Oracle Fusion
REM RMA Receipts Details
SELECT DHA.SOURCE_ORDER_NUMBER
, HDR_LKP.MEANING ORDER_TYPE
, DFLA.SOURCE_LINE_NUMBER
, LINE_LKP.MEANING LINE_TYPE
, INV.ORGANIZATION_CODE
, DSV.DISPLAY_NAME FUL_LINE_STATUS
, (SELECT TO_CHAR(CREATION_DATE, 'DD-MON-YYYY') FROM INV_MATERIAL_TXNS WHERE RCV_TRANSACTION_ID = RMA_RECEIPT_TRANSACTION_ID) INV_TXN_CREATION_DATE
, ESIB.ITEM_NUMBER
, DLA.ORDERED_QTY LINE_ORDERED_QTY
, DFLA.ORDERED_QTY FULFILL_LINE_ORDERED_QTY
, DFLA.RMA_DELIVERED_QTY
, DFLD.RMA_RECEIPT_NUMBER
, DFLD.RMA_RECEIPT_LINE_NUMBER
, DFLD.RMA_RECEIPT_DATE
, DLA.DISPLAY_LINE_NUMBER
|| '.'
|| DFLA.FULFILL_LINE_NUMBER LINE_NUM
FROM FUSION.INV_ORG_PARAMETERS INV
, FUSION.DOO_FULFILL_LINES_ALL DFLA
, FUSION.DOO_FULFILL_LINE_DETAILS DFLD
, FUSION.FND_LOOKUP_VALUES_VL LINE_LKP
, FUSION.DOO_LINES_ALL DLA
, FUSION.FND_LOOKUP_VALUES_VL HDR_LKP
, FUSION.DOO_HEADERS_ALL DHA
, FUSION.EGP_SYSTEM_ITEMS_B ESIB
, FUSION.DOO_STATUSES_VL DSV
, FUSION.DOO_ORCHESTRATION_APPLICATIONS DOA
WHERE DHA.HEADER_ID = DFLA.HEADER_ID
AND DHA.HEADER_ID = DLA.HEADER_ID
AND DFLA.LINE_ID = DLA.LINE_ID
AND DHA.SUBMITTED_FLAG = 'Y'
AND DHA.ORDER_TYPE_CODE = HDR_LKP.LOOKUP_CODE
AND HDR_LKP.LOOKUP_TYPE = 'ORA_DOO_ORDER_TYPES'
AND HDR_LKP.ENABLED_FLAG = 'Y'
AND DFLA.LINE_TYPE_CODE = LINE_LKP.LOOKUP_CODE
AND LINE_LKP.LOOKUP_TYPE IN ('ORA_DOO_LINE_TYPES', 'ORA_DOO_RETURN_LINE_TYPES')
AND LINE_LKP.ENABLED_FLAG = 'Y'
AND DOA.ORCHESTRATION_APPLICATION_CODE = 'DOO'
AND DOA.ORCHESTRATION_APPLICATION_ID = DSV.ORCHESTRATION_APPLICATION_ID
AND DFLA.STATUS_CODE = DSV.STATUS_CODE
AND DLA.INVENTORY_ITEM_ID = ESIB.INVENTORY_ITEM_ID
AND DLA.INVENTORY_ORGANIZATION_ID = ESIB.ORGANIZATION_ID
AND DFLA.FULFILL_ORG_ID = INV.ORGANIZATION_ID
AND UPPER(DFLD.TASK_TYPE(+)) = 'RETURN'
AND DFLA.FULFILL_LINE_ID = DFLD.FULFILL_LINE_ID(+)
AND DHA.SOURCE_ORDER_NUMBER = :P_ORDER_NUMBER
--AND ESIB.ITEM_NUMBER = NVL(:P_ITEM_NUMBER, ESIB.ITEM_NUMBER)
ORDER BY DHA.SOURCE_ORDER_NUMBER, LPAD(DLA.DISPLAY_LINE_NUMBER, 2) ASC;
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