Sie sind auf Seite 1von 14

This Document is Prepared by Sreenivasa Gurani Date Dec 2011. POM Wonderful.

OPM SUBLEDGER ACCOUNTING VIEW


This support document is intended to provide you with the XXPOM_OPM_SUBLEDGER_V view query design logic information for Oracle Process Manufacturing (OPM) module in Release 12. View XXPOM_OPM_SUBLEDGER_V fetches all the Subledger Accounting transactions for OPM Organizations.

View Definition:
CREATE OR REPLACE FORCE VIEW XXPOM.XXPOM_OPM_SUBLEDGER_V ( REFERENCE_NO, TXN_SOURCE, TRANSACTION_NUMBER, ACCOUNTING_CLASS, ACCOUNTING_ENTITY_NAME, ACCOUNTING_EVENT_CLASS_NAME, ACCOUNTING_EVENT_TYPE_NAME, TRANSACTION_SOURCE_TYPE_NAME, TRANSACTION_TYPE_NAME, TRANSACTION_ACTION_NAME, ORGANIZATION_ID, ORGANIZATION_CODE, SUBINVENTORY, ITEM, ITEM_DESCRIPTION, INVENTORY_ITEM_ID, SUPPLIER_NAME, PO_NUMBER, SHIPMENT_NUMBER, RECEIPT_LINE_NUMBER, RECEIPT_NUMBER, ORDER_LINE_NUMBER, ORDER_NUMBER, CUSTOMER_NAME, CUSTOMER_NUMBER, PRODUCTION_BATCH_NUMBER, PRODUCTION_BATCH_STATUS, ROUTING_NUMBER, FORMULA_NUMBER, RECIPE_NUMBER, CURRENCY_CODE_BASE,

TRANSACTION_CURRENCY_CODE, GL_DATE, TRANSACTION_DATE, GL_TRANSFER_DATE, GL_TRANSFER_STATUS, JE_CATEGORY_NAME, SLA_JE_HEADER_DESCRIPTION, SLA_JE_LINE_DESCRIPTION, POM_ACCOUNTING_FLEXFIELD, POM_BUS_UNIT, POM_PROD_LINE, POM_CHANNEL, POM_COST_CENTER, POM_NAT_ACCT, ACCOUNT_DESCRIPTION, SLA_JE_AMOUNT_CR, SLA_JE_AMOUNT_DR, SLA_JE_AMOUNT_CR_BASE, SLA_JE_AMOUNT_DR_BASE, DEBIT_CREDIT_SIGN, AMOUNT_TRANS, AMOUNT_BASE, TRANSACTION_QUANTITY, TRANSACTION_UOM, ACCOUNTING_EVENT_LINE_NUMBER, ACCOUNTING_EVENT_NUMBER, LEDGER_NAME, LEGAL_ENTITY_NAME, CALENDAR_YEAR, GL_PERIOD_NAME, PERIOD_CODE, LOT_NUMBER, TRANSACTION_CATEGORY_CODE, VALUATION_COST_TYPE, ACCOUNTING_ENTRY_STATUS, ACCOUNTING_ENTRY_TYPE, ACCRUAL_REVERSAL_FLAG, RESOURCE_NAME, TRANSACTION_REFERENCE, TRANSACTION_SOURCE_NAME, ACCOUNTING_ENTITY_CODE, ACCOUNTING_EVENT_CLASS_CODE, DOCUMENT_ID, SOURCE_LINE_ID, TRANSACTION_SOURCE_TYPE_ID, TRANSACTION_ACTION_ID, TRANSACTION_TYPE_ID, APPLICATION_ID,

ORDER_TYPE ) AS SELECT xlaeh.reference_no, xlaeh.txn_source, xlaeh.transaction_id transaction_number, accounting_class.meaning accounting_class, entity_name.NAME accounting_entity_name, event_class.NAME accounting_event_class_name, event_type.NAME accounting_event_type_name, mtst.transaction_source_type_name, mtt.transaction_type_name, ml.meaning transaction_action_name, item.organization_id organization_id, mp.organization_code, mattr.subinventory_code subinventory, item.segment1 item, item.description item_description, item.inventory_item_id, rcv_shp.supplier_name, rcv_shp.po_number, COALESCE (rcv_shp.shipment_number, mattr.shipment_number) shipment_number, COALESCE (rcv_shp.receipt_line_number, rma_ord_rcpt.receipt_line_number) receipt_line_number, COALESCE (rcv_shp.receipt_number, rma_ord_rcpt.receipt_number) receipt_number, COALESCE (rma_ord_rcpt.order_line_number, so_v.order_line_number) order_line_number, COALESCE (rma_ord_rcpt.order_number, so_v.order_number) order_number, COALESCE (rma_ord_rcpt.customer_name, so_v.customer_name) customer_name, COALESCE (rma_ord_rcpt.customer_number, so_v.customer_number) customer_number, pm_batch.production_batch_number, pm_batch.production_batch_status, pm_batch.routing_number, pm_batch.formula_number, pm_batch.recipe_number, xlaeh.base_currency currency_code_base, xlaeh.transaction_currency transaction_currency_code, xhead.accounting_date gl_date, xlaeh.transaction_date transaction_date, xhead.gl_transfer_date gl_transfer_date, DECODE (xhead.gl_transfer_status_code, 'E', 'Error',

'N', 'No', 'NT', 'No Transfer', 'Y', 'Yes', xhead.gl_transfer_status_code) gl_transfer_status, xhead.je_category_name je_category_name, xhead.description sla_je_header_description, xline.description sla_je_line_description, acctsla.segment1 || '.' || acctsla.segment2 || '.' || acctsla.segment3 || '.' || acctsla.segment4 || '.' || acctsla.segment5 pom_accounting_flexfield, acctsla.segment1 pom_bus_unit, acctsla.segment2 pom_prod_line, acctsla.segment3 pom_channel, acctsla.segment4 pom_cost_center, acctsla.segment5 pom_nat_acct, (SELECT pom_bus_unit.description || '.' || pom_prod_line.description || '.' || pom_channel.description || '.' || pom_cost_center.description || '.' || pom_nat_acct.description FROM apps.fnd_flex_values_vl pom_prod_line, apps.fnd_flex_values_vl pom_cost_center, apps.fnd_flex_values_vl pom_bus_unit, apps.fnd_flex_values_vl pom_nat_acct, apps.fnd_flex_values_vl pom_channel WHERE pom_bus_unit.flex_value = acctsla.segment1 --'01' AND pom_bus_unit.flex_value_set_id = 1008863 AND pom_prod_line.flex_value = acctsla.segment2 -- '040' AND pom_prod_line.flex_value_set_id = 1008859 AND pom_channel.flex_value = acctsla.segment3 --'46' AND pom_channel.flex_value_set_id = 1008862 AND pom_cost_center.flex_value = acctsla.segment4 --'6001' AND pom_cost_center.flex_value_set_id = 1008861 AND pom_nat_acct.flex_value = acctsla.segment5 --'58320' AND pom_nat_acct.flex_value_set_id = 1008860) account_description,

NVL (xline.entered_cr, 0) sla_je_amount_cr, NVL (xline.entered_dr, 0) sla_je_amount_dr, NVL (xline.accounted_cr, 0) sla_je_amount_cr_base, NVL (xline.accounted_dr, 0) sla_je_amount_dr_base, DECODE ( SIGN (NVL (xline.entered_cr, 0) - NVL (xline.entered_dr, 0)), +1, -1, -1, +1 ) debit_credit_sign, (DECODE ( SIGN (NVL (xline.entered_cr, 0) - NVL (xline.entered_dr, 0)), +1, -1, -1, +1 )) * (NVL (xline.entered_cr, 0) + NVL (xline.entered_dr, 0)) amount_trans, (DECODE ( SIGN (NVL (xline.entered_cr, 0) - NVL (xline.entered_dr, 0)), +1, -1, -1, +1 )) * (NVL (xline.accounted_cr, 0) + NVL (xline.accounted_dr, 0)) amount_base, xlaeh.transaction_quantity transaction_quantity, xlaeh.transaction_uom, xline.ae_line_num accounting_event_line_number, xevnt.event_number accounting_event_number, sob.NAME ledger_name, sstat.legal_entity_name legal_entity_name, sstat.fiscal_year calendar_year, xhead.period_name gl_period_name, gmfps.period_code period_code, xlaeh.lot_number lot_number, xhead.doc_category_code transaction_category_code, DECODE (xlaeh.valuation_cost_type_id, '1000', 'Standard Cost', '1001', 'PCA Monthly Period Moving Average Csting', '1002', 'PCA Weekly Period Moving Average Costing', xlaeh.valuation_cost_type_id) valuation_cost_type, DECODE (xhead.accounting_entry_status_code,

'D', 'Draft', 'F', 'Final', 'I', 'Invalid', 'N', 'Incomplete', 'R', 'Invalid Related Entry', 'RELATED_EVENT_ERROR', 'Related Event In Error', xhead.accounting_entry_status_code) accounting_entry_status, DECODE (xhead.accounting_entry_type_code, 'DEFERRED', 'Deferred', 'MANUAL', 'Manual', 'MERGE', 'Merge', 'STANDARD', 'Standard', xhead.accounting_entry_type_code) accounting_entry_type, NVL (xhead.accrual_reversal_flag, 'N') accrual_reversal_flag, xlaeh.resources resource_name, mattr.transaction_reference, mattr.transaction_source_name, xlaeh.entity_code accounting_entity_code, xlaeh.event_class_code accounting_event_class_code, xlaeh.source_document_id document_id, xlaeh.source_line_id, xlaeh.transaction_source_type_id, xlaeh.transaction_action_id, xlaeh.transaction_type_id, xhead.application_id,so_v.Order_type FROM apps.mtl_parameters mp, gl.gl_code_combinations acctsla, noetix_sys.n_xla_lookups_vl accounting_class, inv.mtl_system_items_b item, apps.xla_event_types_vl event_type, apps.xla_event_classes_vl event_class, apps.xla_entity_types_vl entity_name, xla.xla_events xevnt, xla.xla_ae_lines xline, xla.xla_ae_headers xhead, gmf.gmf_period_statuses gmfps, gmf.gl_subr_sta sstat, gl.gl_ledgers sob, gmf.gmf_xla_extract_headers xlaeh, apps.mtl_transaction_types mtt, apps.mtl_txn_source_types mtst, apps.mfg_lookups ml, xxpom.xxpom_rcv_shipment_v rcv_shp, xxpom.xxpom_rma_order_recipt_v rma_ord_rcpt, xxpom.xxpom_sales_order_v so_v, xxpom.xxpom_pm_batch_details_v pm_batch,

apps.mtl_material_transactions mattr WHERE 1=1 /* Joins from XLAEXH to XHEAD and XLINE */ AND xevnt.event_id = xlaeh.event_id AND xhead.event_id = xevnt.event_id AND xhead.entity_id = xevnt.entity_id AND xline.ae_header_id = xhead.ae_header_id /* Joins to derives the meaning of the Entity code, event_code, event_type and all transaction names */ AND entity_name.application_id = xhead.application_id AND entity_name.entity_code = xlaeh.entity_code AND NVL (entity_name.enabled_flag, 'X') = 'Y' AND event_class.application_id = xhead.application_id AND event_class.event_class_code = xlaeh.event_class_code AND NVL (event_class.enabled_flag, 'X') = 'Y' AND event_type.application_id = xhead.application_id AND event_type.event_class_code = xlaeh.event_class_code AND event_type.event_type_code = xlaeh.event_type_code AND NVL (event_type.enabled_flag, 'X') = 'Y' AND mtt.transaction_type_id(+) = xlaeh.transaction_type_id AND ml.lookup_type(+) = 'MTL_TRANSACTION_ACTION' AND ml.lookup_code(+) = xlaeh.transaction_action_id AND mtst.transaction_source_type_id(+) = xlaeh.transaction_source_type_id /* Joins to derive accounts ,Items, Organization informations */ AND xlaeh.organization_id = mp.organization_id(+) AND sob.ledger_id = xlaeh.ledger_id AND sstat.reference_no = xlaeh.reference_no AND gmfps.period_id = sstat.period_id AND item.inventory_item_id(+) = xlaeh.inventory_item_id AND item.organization_id(+) = xlaeh.organization_id AND xline.code_combination_id = acctsla.code_combination_id(+) AND xline.accounting_class_code = accounting_class.lookup_code(+) AND accounting_class.lookup_type(+) = 'XLA_ACCOUNTING_CLASS' AND (NVL (xline.entered_cr, 0) != 0 OR NVL (xline.entered_dr, 0) != 0) /* Join SLA to XXPOM.XXPOM_RCV_SHIPMENT_V to derive the PO, RECIPT,SHIPMENT NUMBER */ AND rcv_shp.transaction_id(+) = xlaeh.transaction_id AND rcv_shp.source_document_id(+) = xlaeh.source_document_id AND rcv_shp.source_line_id(+) = xlaeh.source_line_id /* Join SLA to RMA_ORD_RCPT to get ORDER information for RMA transactions */ AND rma_ord_rcpt.transaction_id(+) = xlaeh.transaction_id /* Join SLA to SO_V to derive the Sales order or ISO info */ AND so_v.transaction_id(+) = xlaeh.transaction_id /* Join SLA to PM_BATCH to derive the batch details */ AND pm_batch.batch_id_source_document_id(+) = xlaeh.source_document_id

AND pm_batch.organization_id(+) = xlaeh.organization_id /* Join to MATTR to get the material transaction details */ AND mattr.transaction_id(+) = xlaeh.transaction_id

Tables and Views Used in View:


apps.mtl_parameters mp, gl.gl_code_combinations acctsla, noetix_sys.n_xla_lookups_vl accounting_class, inv.mtl_system_items_b item, apps.xla_event_types_vl event_type, apps.xla_event_classes_vl event_class, apps.xla_entity_types_vl entity_name, xla.xla_events xevnt, xla.xla_ae_lines xline, xla.xla_ae_headers xhead, gmf.gmf_period_statuses gmfps, gmf.gl_subr_sta sstat, gl.gl_ledgers sob, gmf.gmf_xla_extract_headers xlaeh, apps.mtl_transaction_types mtt, apps.mtl_txn_source_types mtst, apps.mfg_lookups ml, xxpom.xxpom_rcv_shipment_v rcv_shp, xxpom.xxpom_rma_order_recipt_v rma_ord_rcpt, xxpom.xxpom_sales_order_v so_v, xxpom.xxpom_pm_batch_details_v pm_batch, apps.mtl_material_transactions mattr

Important Table Description:


1) GMF_XLA_EXTRACT_HEADERS: SLA Extract Headers table which stores transactions for process

inventory organizations are processed and all the necessary data for accounting are stored in this table. When the SLA accounting program is run data from this table is extracted for creation of journal entries in SLA.
2) GMF_XLA_EXTRACT_LINES: SLA Extract Lines table which stores transactions for process

inventory organizations are processed and all the necessary data for accounting are stored in this table. When the SLA accounting program is run data from this table is extracted for creation of journal entries in SLA.

3) RCV_TRANSACTIONS: stores historical information about receiving transactions 4) XLA_AE_HEADERS: SLA table stores subledger journal entries. There is a one-to-many

relationship between accounting events and journal entry headers.


5) XLA_AE_LINES:SLA table stores the subledger journal entry lines. There is a one-to-many

relationship between subledger journal entry headers and subledger journal entry lines.
6) XLA_DISTRIBUTION_LINKS: SLA table stores the link between transactions and Subledger journal

entry lines.
7) MTL_MATERIAL_TRANSACTIONS : Inventory Transaction table which stores a record of every

material transaction or cost update performed in Inventory.

8) MTL_SYSTEM_ITEMS: Item definition table having all information relating to an item, such as

lot/sublot control, unit of measure information, and all class and type designations.
9) GMF_PERIOD_BALANCES : OPM Financials table having ending balance, consumption, and yield

for closed inventory periods.


10) GMF_PERIOD_STATUSES :OPM Financails table which stores the OPM Financials period status.

Query Description :
To Understand the query , lets divide the query in eight parts. 1) To fetch all SLA transactions : Join gmf_xla_extract_headers to xla_ae_headers and xla_ae_lines tables This join provides the all OPM SLA transactions. i.e., /* Joins from XLAEXH to XHEAD and XLINE */ AND xevnt.event_id = xlaeh.event_id AND xhead.event_id = xevnt.event_id AND xhead.entity_id = xevnt.entity_id AND xline.ae_header_id = xhead.ae_header_id 2) To derives the Entity code, Event_code, Event_type Transaction_type, Transaction_source and Transaction_action. This joins provide the meaning/name/types of all transactions. i.e., /* Joins to derives the meaning of the Entity code, event_code, event_type and all transaction names */ AND entity_name.application_id = xhead.application_id AND entity_name.entity_code = xlaeh.entity_code AND NVL (entity_name.enabled_flag, 'X') = 'Y'

AND event_class.application_id = xhead.application_id AND event_class.event_class_code = xlaeh.event_class_code AND NVL (event_class.enabled_flag, 'X') = 'Y' AND event_type.application_id = xhead.application_id AND event_type.event_class_code = xlaeh.event_class_code AND event_type.event_type_code = xlaeh.event_type_code AND NVL (event_type.enabled_flag, 'X') = 'Y' AND mtt.transaction_type_id(+) = xlaeh.transaction_type_id AND ml.lookup_type(+) = 'MTL_TRANSACTION_ACTION' AND ml.lookup_code(+) = xlaeh.transaction_action_id AND mtst.transaction_source_type_id(+) = xlaeh.transaction_source_type_id 3) To derive accounts ,Items, Organization details. i.e., /* Joins to derive accounts ,Items, Organization informations */ AND xlaeh.organization_id = mp.organization_id(+) AND sob.ledger_id = xlaeh.ledger_id AND sstat.reference_no = xlaeh.reference_no AND gmfps.period_id = sstat.period_id AND item.inventory_item_id(+) = xlaeh.inventory_item_id AND item.organization_id(+) = xlaeh.organization_id AND xline.code_combination_id = acctsla.code_combination_id(+) AND xline.accounting_class_code = accounting_class.lookup_code(+) AND accounting_class.lookup_type(+) = 'XLA_ACCOUNTING_CLASS' AND (NVL (xline.entered_cr, 0) != 0 OR NVL (xline.entered_dr, 0) != 0) 4) To derive the PO, RECIPT,SHIPMENT NUMBER details Created custom view to pull Purchasing and Receipt Information. View Name : xxpom.xxpom_rcv_shipment_v View Script is added at end of this document. i.e., /* Join SLA to XXPOM.XXPOM_RCV_SHIPMENT_V to derive the PO, RECIPT,SHIPMENT NUMBER */ AND rcv_shp.transaction_id(+) = xlaeh.transaction_id AND rcv_shp.source_document_id(+) = xlaeh.source_document_id AND rcv_shp.source_line_id(+) = xlaeh.source_line_id 5) To derive ORDER details for RMA transactions. Created custom view to pull RMA order details View Name : xxpom.xxpom_rma_order_recipt_v View Script is added at end of this document. i.e., /* Join SLA to RMA_ORD_RCPT to get ORDER information for RMA transactions */ AND rma_ord_rcpt.transaction_id(+) = xlaeh.transaction_id 6) To derive the Sales Order and Internal Sales Order(ISO) Details Created custom view to pull Sales Order and ISO details. View Name: xxpom.xxpom_sales_order_v View Script is added at end of this document. i.e.,

/* Join SLA to SO_V to derive the Sales order or ISO info */ AND so_v.transaction_id(+) = xlaeh.transaction_id 7) To derive Production Batch details Created custom view to pull Batch number, product and other details from production batches. View Name : xxpom.xxpom_pm_batch_details_v i.e., /* Join SLA to PM_BATCH to derive the batch details */ AND pm_batch.batch_id_source_document_id(+) = xlaeh.source_document_id AND pm_batch.organization_id(+) = xlaeh.organization_id 8) To derive the material transaction details /* Join to MATTR to get the material transaction details */ AND mattr.transaction_id(+) = xlaeh.transaction_id

Custom Views Scripts:


1) XXPOM_PM_BATCH_DETAILS_V CREATE OR REPLACE VIEW XXPOM_PM_BATCH_DETAILS_V AS SELECT batch.batch_id batch_id_source_document_id, batch.organization_id, rout.routing_no routing_number, fmst.formula_no formula_number, recp.recipe_no recipe_number, batch.actual_cmplt_date production_actual_end_date, batch.actual_start_date production_actual_start_date, batch.batch_no production_batch_number, DECODE (batch.batch_status, '-1', 'Cancelled', '1', 'Pending', '2', 'WIP', '3', 'Completed', '4', 'Closed', batch.batch_status ) production_batch_status FROM gmd.gmd_routings_b rout, gmd.fm_form_mst_b fmst, gmd.gmd_recipe_validity_rules revlr, gmd.gmd_recipes_b recp, gme.gme_batch_header batch WHERE 1 = 1 --AND batch.batch_id = 703955 --xlaeh.source_document_id AND batch.batch_status IN (-1, 1, 2, 3, 4) AND revlr.recipe_validity_rule_id(+) = batch.recipe_validity_rule_id AND recp.recipe_id(+) = revlr.recipe_id AND fmst.formula_id(+) = batch.formula_id AND rout.routing_id(+) = batch.routing_id

2) XXPOM_RCV_SHIPMENT_V CREATE OR REPLACE VIEW XXPOM_RCV_SHIPMENT_V AS SELECT rvact.accounting_txn_id transaction_id, rcvtr.shipment_header_id SOURCE_DOCUMENT_ID, rcvtr.transaction_id SOURCE_LINE_ID, vend.vendor_name supplier_name, pohdr.segment1 po_number, rcvsl.line_num receipt_line_number, rcvsh.receipt_num receipt_number, rcvsh.shipment_num shipment_number FROM po.rcv_shipment_lines rcvsl, po.rcv_shipment_headers rcvsh, po.rcv_transactions rcvtr, apps.gmf_rcv_accounting_txns rvact, ap.ap_suppliers vend, po.po_headers_all pohdr WHERE 1 = 1 -- AND RVACT.ACCOUNTING_TXN_ID = 14274-- XLAEH.TRANSACTION_ID -- AND RCVTR.SHIPMENT_HEADER_ID = 241278--XLAEH.SOURCE_DOCUMENT_ID -- AND RCVTR.TRANSACTION_ID =773779-- XLAEH.SOURCE_LINE_ID AND rcvtr.transaction_id = rvact.rcv_transaction_id AND rcvtr.source_document_code IN ('PO', 'REQ') AND rcvsh.shipment_header_id = rcvtr.shipment_header_id AND rcvsh.receipt_source_code IN ('VENDOR', 'INTERNAL ORDER') AND rcvsl.shipment_line_id = rcvtr.shipment_line_id AND rcvsl.shipment_header_id = rcvsh.shipment_header_id AND pohdr.po_header_id(+) = rcvtr.po_header_id AND vend.vendor_id(+) = pohdr.vendor_id UNION SELECT mattr.transaction_id transaction_id, rcvtr.shipment_header_id SOURCE_DOCUMENT_ID, rcvtr.transaction_id SOURCE_LINE_ID, vend.vendor_name supplier_name, pohdr.segment1 po_number, rcvsl.line_num receipt_line_number, rcvsh.receipt_num receipt_number, rcvsh.shipment_num shipment_number FROM po.rcv_shipment_lines rcvsl, po.rcv_shipment_headers rcvsh, po.rcv_transactions rcvtr, apps.mtl_material_transactions mattr, ap.ap_suppliers vend, po.po_headers_all pohdr WHERE 1 = 1 -- AND MATTR.TRANSACTION_ID = 29638944-- XLAEH.TRANSACTION_ID --AND RCVTR.SHIPMENT_HEADER_ID = 229257--XLAEH.SOURCE_DOCUMENT_ID -- AND RCVTR.TRANSACTION_ID =764553-- XLAEH.SOURCE_LINE_ID AND rcvtr.transaction_id = mattr.rcv_transaction_id AND rcvtr.source_document_code IN ('PO', 'REQ')

AND rcvsh.shipment_header_id = rcvtr.shipment_header_id AND rcvsh.receipt_source_code IN ('VENDOR', 'INTERNAL ORDER') AND rcvsl.shipment_line_id = rcvtr.shipment_line_id AND rcvsl.shipment_header_id = rcvsh.shipment_header_id AND pohdr.po_header_id(+) = rcvtr.po_header_id AND vend.vendor_id(+) = pohdr.vendor_id

3) XXPOM_RMA_ORDER_RECIPT_V CREATE OR REPLACE VIEW XXPOM.XXPOM_RMA_ORDER_RECIPT_V AS SELECT mattr.transaction_id, party.party_name customer_name, custa.account_number customer_number, lines.line_number order_line_number, head.order_number order_number, rcvsl.line_num receipt_line_number, rcvsh.receipt_num receipt_number FROM ar.hz_cust_accounts custa, ar.hz_parties party, ont.oe_order_lines_all lines, po.rcv_shipment_lines rcvsl, po.rcv_shipment_headers rcvsh, ont.oe_order_headers_all head, po.rcv_transactions rcvtr, apps.mtl_material_transactions mattr WHERE 1 = 1 --AND mattr.transaction_id = 29938453 AND rcvtr.transaction_id = mattr.rcv_transaction_id AND rcvsh.shipment_header_id = rcvtr.shipment_header_id AND rcvsl.shipment_line_id = rcvtr.shipment_line_id AND rcvsl.shipment_header_id = rcvsh.shipment_header_id AND lines.line_id = rcvtr.oe_order_line_id AND head.header_id = lines.header_id AND custa.cust_account_id = head.sold_to_org_id AND party.party_id = custa.party_id 4) XXPOM_SALES_ORDER_V CREATE OR REPLACE FORCE VIEW XXPOM.XXPOM_SALES_ORDER_V ( TRANSACTION_ID, CUSTOMER_NAME, CUSTOMER_NUMBER, ORDER_LINE_NUMBER,

ORDER_NUMBER, Order_type ) AS SELECT mattr.transaction_id, party.party_name customer_name, custa.account_number customer_number, lines.line_number order_line_number, head.order_number order_number,ott.name Order_type FROM ar.hz_cust_accounts custa, ar.hz_parties party, ont.oe_order_lines_all lines, ont.oe_order_headers_all head, apps.mtl_material_transactions mattr, apps.oe_transaction_types_tl ott WHERE 1=1 AND lines.line_id = mattr.source_line_id AND head.header_id = lines.header_id AND custa.cust_account_id = head.sold_to_org_id AND party.party_id = custa.party_id AND mattr.TRANSACTION_SOURCE_TYPE_ID IN (2, 8) and ott.transaction_type_id(+)=head.order_type_id;

NOTE : Download latest scripts from XXPOM schema of Production data base.

Das könnte Ihnen auch gefallen