EBS總賬模塊與其他模塊數據關聯關係(轉載)

表名:GL_IMPORT_REFERENCES
說明:總賬導入附加信息表
用途:用來追溯從子模塊傳入總賬模塊的明細,對於報表開發很有幫助
SQL 語句:

[sql] view plain copy

  1. select *  
  2. from gl_je_headers gjh,   
  3. gl_je_lines gjl,   
  4. gl_import_references gir  
  5. where gjh.je_header_id = gjl.je_header_id  
  6. and gjl.je_header_id = gir.je_header_id  
  7. and gjl.je_line_num = gir.je_line_num;  

 


1、gjh.je_source = 'Payables':
1)與 AP 模塊關聯表:ap_ae_lines_all
2)SQL 語句:

 

 

[sql] view plain copy

  1. select *  
  2. from gl_je_headers gjh,  
  3. gl_je_lines gjl,  
  4. gl_import_references gir,  
  5. ap_ae_lines_all ael,  
  6. ap_ae_headers_all aeh  
  7. where gjh.je_header_id = gjl.je_header_id  
  8. and gjl.je_header_id = gir.je_header_id  
  9. and gjl.je_line_num = gir.je_line_num  
  10. and gjh.je_source = 'Payables'  
  11. and gir.gl_sl_link_id = ael.gl_sl_link_id  
  12. and ael.ae_header_id = aeh.ae_header_id;  



3)根據 aeh.ae_category 或 aeh.accounting_event_id 判斷業務性質,從而關聯以下數據
庫表進行取值;
ap_invoices_all
ap_invoice_distributions_all
ap_checks_all
ap_invoice_payments_all
ap_accounting_events_all
4)借貸金額計算邏輯:
直接取 ap_ae_lines_all 的 ael.accounted_dr,ael.accounted_cr 字段值
  借項:
ael.accounted_dr;
  貸項:
ael.accounted_cr;
2、gjh.je_source = 'Receivables':
1)gjh.je_category in ('Credit Memos', 'Sales Invoices')
A.  與 AR 關聯表:ra_cust_trx_line_gl_dist_all 
2
B.  SQL 語句:

 

[sql] view plain copy

  1. select *  
  2. from gl_je_headers gjh,  
  3. gl_je_lines gjl,  
  4. gl_import_references gir,  
  5. ra_cust_trx_line_gl_dist_all rcl  
  6. where gjh.je_header_id = gjl.je_header_id  
  7. and gjl.je_header_id = gir.je_header_id  
  8. and gjl.je_line_num = gir.je_line_num  
  9. and gjh.je_source = 'Receivables'  
  10. and gjh.je_category in ('Credit Memos''Sales Invoices')  
  11. and gir.reference_3 = to_char(rcl.cust_trx_line_gl_dist_id);  



C.  根據 rcl.customer_trx_id、rcl.customer_trx_line_id 關聯以下表:
ra_customer_trx_all
ra_customer_trx_lines_all
D.  借貸金額計算邏輯:
根據自總賬模塊所追溯科目的性質,判斷 sign(rcl.acctd_amount)的符號和
gjl.accounted_dr 是否爲空,分別列在借方和貸方金額欄。
以下爲應收賬款科目借貸方金額計算邏輯,僅供參考:
  借項:

 

[sql] view plain copy

  1. decode(sign(rcl.acctd_amount),   
  2. 1, rcl.acctd_amount,   
  3. 0,   
  4. 0,   
  5. -1,   
  6. 0) acctd_dr;  



  貸項:

 

[sql] view plain copy

  1. decode(sign(rcl.acctd_amount),   
  2. 1,   
  3. 0,   
  4. 0,   
  5. 0,   
  6. -1,   
  7. rcl.acctd_amount * -1) acctd_cr;  



2)gjh.je_category in ('Trade Receipts', 'Credit Memo Applications')
A.  與 AR 關聯表:ar_receivable_applications_all
B.  SQL 語句:

 

[sql] view plain copy

  1. select *  
  2. from gl_je_headers gjh,  
  3. gl_je_lines gjl,  
  4. gl_import_references gir,  
  5. ar_receivable_applications_all ara  
  6. where gjh.je_header_id = gjl.je_header_id  
  7. and gjl.je_header_id = gir.je_header_id   
  8. 3  
  9. and gjl.je_line_num = gir.je_line_num  
  10. and gjh.je_source = 'Receivables'  
  11. and gjh.je_category in ('Trade Receipts''Credit Memo Applications')  
  12. and decode(gjh.je_category,  
  13. 'Trade Receipts',  
  14. substr(gir.reference_2, instr(gir.reference_2,  'C',  1) +  1),  
  15. gir.reference_2) = ara.receivable_application_id;  



C.  根據 ara.cash_receipt_id、 ara.customer_trx_id、 ara.applied_customer_trx_id
關聯以下表:
ar_cash_receipts_all
ra_customer_trx_all
D.  借貸金額計算邏輯:
根據自總賬模塊所追溯科目的性質,判斷 sign(ara.acctd_amount_applied_to)
的符號和 gjl.accounted_dr 是否爲空,分別列在借方和貸方金額欄。
以下爲應收賬款科目借貸方金額計算邏輯,僅供參考:
  借項:

 

[sql] view plain copy

  1. decode(gjh.je_category,  
  2. 'Trade Receipts',  
  3. decode(sign(ara.acctd_amount_applied_to),  
  4. 0,  
  5. 0,  
  6. 1,  
  7. 0,  
  8. ara.acctd_amount_applied_to * -1),  
  9. decode(sign(ara.acctd_amount_applied_to),  
  10. 0,  
  11. 0,  
  12. 1,  
  13. decode(gjl.accounted_dr,  
  14. null,  
  15. 0,  
  16. ara.acctd_amount_applied_to),  
  17. decode(gjl.accounted_dr,  
  18. null,  
  19. 0,  
  20. ara.acctd_amount_applied_to * -1))) acctd_dr;  



  貸項:

 

[sql] view plain copy

  1. decode(gjh.je_category,  
  2. 'Trade Receipts',  
  3. decode(sign(ara.acctd_amount_applied_to),  
  4. 0,  
  5. 0,  
  6. 1,  
  7. ara.acctd_amount_applied_to,   
  8. 4  
  9. 0),  
  10. decode(sign(ara.acctd_amount_applied_to),  
  11. 0,  
  12. 0,  
  13. 1,  
  14. decode(gjl.accounted_dr,  
  15. null,  
  16. ara.acctd_amount_applied_to,  
  17. 0),  
  18. decode(gjl.accounted_dr,  
  19. null,  
  20. ara.acctd_amount_applied_to * -1,  
  21. 0))) acctd_cr;  



3、gjh.je_source = 'Inventory':
1)與 INV 關聯表:mtl_transaction_accounts
2)SQL 語句:

 

[sql] view plain copy

  1. select *  
  2. from gl_je_headers gjh,  
  3. gl_je_lines  gjl,  
  4. gl_import_references gir,  
  5. mtl_transaction_accounts mta,  
  6. mtl_material_transactions mmt  
  7. where gjh.je_header_id = gjl.je_header_id  
  8. and gir.je_header_id = gjl.je_header_id  
  9. and gir.je_line_num = gjl.je_line_num  
  10. and gjh.je_source = 'Inventory'  
  11. and gir.reference_1 = to_char(mta.gl_batch_id)  
  12. and mta.transaction_id = mmt.transaction_id;  



3)根據 mmt.transaction_type_id 關聯以下表:
mtl_transaction_types
oe_order_headers_all
oe_order_liness_all
rcv_transactions
po_hedaers_all
po_lines_all
mtl_txn_request_headers
mtl_txn_request_lines
mtl_generic_dispositions
4)借貸金額計算邏輯:
根據自總賬模塊所追溯科目的性質,判斷 sign(mta.base_transaction_value)的符
號,分別列在借方和貸方金額欄
以下爲銷售成本科目借貸方借計算邏輯,僅供參考:
  借項:

 

[sql] view plain copy

  1. decode(sign(mta.base_transaction_value),   
  2. 5  
  3. 1,  
  4. mta.base_transaction_value,  
  5. 0) acctd_dr;  
  6.   貸項:  
  7. decode(sign(mta.base_transaction_value),  
  8. -1,  
  9. mta.base_transaction_value * -1,  
  10. 0) acctd_cr;  



4、gjh.je_source = 'Purchasing':
1)與 PO 關聯表:rcv_receiving_sub_ledger
2)SQL 語句:

 

[sql] view plain copy

  1. select *  
  2. from gl_je_headers gjh,  
  3. gl_je_lines gjl,  
  4. gl_import_references gir,  
  5. rcv_receiving_sub_ledger rcs  
  6. where gjh.je_header_id = gjl.je_header_id  
  7. and gir.je_header_id = gjl.je_header_id  
  8. and gir.je_line_num = gjl.je_line_num  
  9. and gjh.je_source = 'Purchasing'  
  10. and gir.reference_5 = to_char(rcs.rcv_transaction_id);  



3)根據 rcs.rcv_transaction_id 關聯以下表:
rcv_transactions
po_headers_all
po_lines_all
po_line_locations_all
po_distributions_all
4)借貸金額計算邏輯:
直接取 rcv_receiving_sub_ledger 的 rcs.accounted_dr 和 rcs.accounted_cr 字
段值
  借項:
rcs.accounted_dr;
  貸項:
rcs.accounted_cr;
5、gjh.je_source = 'Assets':
1)與 FA 關聯表:fa_adjustments
2)SQL 語句:

 

[sql] view plain copy

  1. select *  
  2. from gl_je_headers gjh,  
  3. gl_je_lines  gjl,  
  4. gl_import_references gir,  
  5. fa_adjustments fad  
  6. where gjh.je_header_id = gjl.je_header_id  
  7. and gir.je_header_id = gjl.je_header_id   
  8. 6  
  9. and gir.je_line_num = gjl.je_line_num  
  10. and gjh.je_source = 'Assets'  
  11. and gir.je_header_id = fad.je_header_id  
  12. and gir.je_line_num = fad.je_line_num;  



3)根據 source_type_code 關聯以下表:
fa_additions_b
fa_additions_tl
fa_books
fa_deprn_detail
fa_deprn_summary
fa_retirements
fa_transfer_details
fa_distribution_accounts
fa_distribution_history
fa_transaction_headers
4)借貸金額計算邏輯:
根據 fad.debit_credit_flag 的性質,判斷 fad.adjustment_amount 的借貸方屬性
  借項:
decode(fad.debit_credit_flag, 
'DR', 
fad.adjustment_amount, 
0) acctd_dr;
  貸項:
decode(fad.debit_credit_flag, 
'CR', 
fad.adjustment_amount, 
0) acctd_cr; 

 



 

 

轉載出處:https://blog.csdn.net/cai_xingyun/article/details/17923241

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章