标签:
In case of OPM Organization, R12, there will not be any entry in rcv_receiving_subledger for PO receipt. Instead the same data is available in gmf_rcv_accounting_txns where the linking column to rcv_transactions is rcv_transaction_id.
Deliver transaction details are available in mtl_material_transaction wherein the rcv_transaction table can be linked with rcv_transaction_id in mtl_material_transactions table.
For further drill down for accounting entries, gmf_xla_extract_headers table will have accounting entries details for both receipts and deliver wherein the linking column are source_document_id (which is shipment header id) and source_line_id (transaction_id from rcv_transactions table).
select e.application_id,
te.source_id_int_1,te.source_id_char_1,te.entity_id,
e.event_id,e.event_type_code,te.entity_code,
h.ae_header_id,
l.ae_line_num,l.application_id,l.code_combination_id,l.gl_transfer_mode_code,l.accounting_class_code,
l.accounted_dr,l.accounted_cr,
gir.reference_5,gir.reference_6,gir.reference_7,
te.transaction_number,
xdl.SOURCE_DISTRIBUTION_ID_NUM_1,
pha.segment1
from xla_events e,
xla_transaction_entities_upg te,
xla_ae_headers h,
xla_ae_lines l,
gl_import_references gir,
GMF_RCV_ACCOUNTING_TXNS GRA,
RCV_TRANSACTIONS RT,
PO_HEADERS_ALL PHA,
PO_LINES_ALL PLA,
XLA_DISTRIBUTION_LINKS xdl
where te.ledger_id = 2021
AND te.entity_id = h.entity_id
AND te.application_id = h.application_id
AND e.event_id = h.event_id
AND e.application_id = h.application_id
AND h.ae_header_id = l.ae_header_id
AND h.application_id = l.application_id
and gir.gl_sl_link_id = l.gl_sl_link_id
AND gir.gl_sl_link_table = l.gl_sl_link_table
and xdl.event_id = e.event_id
and xdl.ae_header_id = l.ae_header_id
and xdl.ae_line_num = l.ae_line_num
and xdl.application_id = l.application_id
AND TE.SOURCE_ID_INT_1 = GRA.ACCOUNTING_TXN_ID
AND GRA.RCV_TRANSACTION_ID = RT.TRANSACTION_ID
AND GRA.PO_HEADER_ID = PHA.PO_HEADER_ID
AND GRA.PO_LINE_ID = PLA.PO_LINE_ID
and e.transaction_date >= to_date(‘20140601‘,‘YYYYMMDD‘)
and e.transaction_date <= to_date(‘20140630‘,‘YYYYMMDD‘)
and e.event_type_code in ( ‘RECEIVE‘,‘RET_TO_VENDOR‘) --接收
and te.entity_code = ‘PURCHASING‘
标签:
原文地址:http://www.cnblogs.com/CarryLi7938/p/5552546.html