Tuesday, November 3, 2015

PO - RCV - INV - XLA - GL

/* Formatted on 03-Nov-15 2:28:17 PM (QP5 v5.114.809.3010) */
/* Formatted on 03-Nov-15 2:28:45 PM (QP5 v5.114.809.3010) */
SELECT   *
  FROM   po_headers_all
 WHERE   segment1 = 1361170636

-- Accounting Entries for PO --

/* Formatted on 03-Nov-15 2:28:49 PM (QP5 v5.114.809.3010) */
SELECT   *
  FROM   po_headers_all
 WHERE   segment1 = 1361170636

--PO Receipt --
/* Formatted on 03-Nov-15 2:28:52 PM (QP5 v5.114.809.3010) */
SELECT   *
  FROM   rcv_transactions
 WHERE   po_header_id = 1182531

--RECEIVE     --  RECEIVING   --  rcv_receiving_sub_ledger
--DELIVER     -- INVENTORY  --  mtl_material_transactions

-- For DELIVER
/* Formatted on 03-Nov-15 2:28:55 PM (QP5 v5.114.809.3010) */
SELECT   *
  FROM   mtl_material_transactions
 WHERE   RCV_TRANSACTION_ID IN (SELECT   transaction_id
                                  FROM   rcv_transactions
                                 WHERE   po_header_id = 1182531)
-- 2699101
/* Formatted on 03-Nov-15 2:29:00 PM (QP5 v5.114.809.3010) */
SELECT   *
  FROM   mtl_transaction_accounts
 WHERE   transaction_id = 18820381
      -- 18820381
-- For Receive
--Accrual_Method_Flag = 'O'
--JE_SOURCE_NAME ='Purchasing'

--Transactions with accrue_on_receipt_flag ='N' ie Period End Accruals are
--      classified as:
--Accrual_Method_Flag = 'P'
--JE_SOURCE_NAME ='Purchasing'

select * from rcv_receiving_sub_ledger where RCV_TRANSACTION_ID in (select
      transaction_id
      from rcv_transactions
      where po_header_id = 1182531 )

/* Formatted on 03-Nov-15 2:28:30 PM (QP5 v5.114.809.3010) */
SELECT   jel.*
  FROM   gl_import_references gli,
         xla_ae_lines xll,
         xla_ae_headers xlh,
         xla_distribution_links xld,
         rcv_receiving_sub_ledger rsl,
         gl_je_lines jel
 WHERE       gli.gl_sl_link_table = xll.gl_sl_link_table
         AND gli.gl_sl_link_id = xll.gl_sl_link_id
         AND xll.ae_header_id = xlh.ae_header_id
         AND xld.ae_header_id = xlh.ae_header_id
         AND jel.je_header_id = gli.je_header_id
         AND jel.je_line_num = gli.je_line_num
         AND xld.source_distribution_id_num_1 = rsl.rcv_sub_ledger_id
         AND rsl.RCV_TRANSACTION_ID IN (SELECT   transaction_id
                                          FROM   rcv_transactions
                                         WHERE   po_header_id = 1182531)
         AND xld.source_distribution_type = 'RCV_RECEIVING_SUB_LEDGER'
         AND xll.gl_sl_link_table = 'XLAJEL'