在SLA中技术方面最常用的就是日记帐来源追溯,在追溯的过程中从GL到SLA和11i差别不大,
使通过gl_import_references表来进行,该表的je_batch_id,je_header_id,je_line_num
是和GL关联,该表字段gl_sl_link_id是和SLA中的行表(XLA_AE_LINES)关联,
在SLA中重要的几张表如下:
xla_transaction_entities:The table XLA_ENTITIES contains information about
sub-ledger document or transactions.
XLA_EVENTS:The XLA_EVENTS table record all information related to a specific
event. This table is created as a type XLA_ARRAY_EVENT_TYPE.
XLA_AE_HEADERS:The XLA_AE_HEADERS table stores subledger journal entries.
There is a one-to-many relationship between accounting events and journal entry headers.
XLA_AE_LINES:The XLA_AE_LINES table stores the subledger journal entry lines.
There is a one-to-many relationship between subledger journal entry headers and subledger
journal entry lines
XLA_DISTRIBUTION_LINKS:The XLA_DISTRIBUTION_LINKS table stores the link between
transactions and subledger journal entry lines.
在一个系统PKG中有如下结构的插值语句,从而可以清楚的得出几个表之间的联系:
insert all
when
(line_id = 1) then
into xla_transaction_entities (upg_batch_id , entity_id,……)
values
(……)
into xla_events
(upg_batch_id, entity_id, event_id, ……)
values
(……)
into xla_ae_headers
(upg_batch_id,
entity_idnt_id ,
ae_header_id ,
……)
values
(……)
when
(1 = 1) then
into xla_ae_lines
(upg_batch_id, ae_header_id, ae_line_num, ……)
values (……)
into xla_distribution_links
(upg_batch_id , event_id , ae_header_id,
ae_line_num , ……)
values
(……)
select …… from ……;
上面提到的gl_import_references.gl_sl_link_id字段就是和xla_ae_lines.gl_sl_link_id字段关联,在这些表中和子模块关联的字段在xla_transaction_entities中,该表中有如下形式的字段
源表关联字段
source_id_int_num
source_id_char_num
这两个字段是用来和源模块关联,该字段的设置是在各个子模块:
路径是:设置>>会计科目设置>>子分类帐会计设置>>会计方法生成器>>事件>>事件模型
界面如下:该界面的实体代码就是对应xla_transaction_entities表中的ENTITY_CODE字段,每个来源就标示了该子分类帐是哪个模块产生的。

点击[标示]进入如下界面:该界面中的实体表列字段时子模块相关源表的字段,标示列就是SLA中
xla_transaction_entities表的列,SLA和字模块的联系就是通过该界面的设置来完成的。

安全性控制字段
security_id_char_num
security_id_int_num
这两个字段是用来进行安全验证,数据屏蔽使用xla_transaction_entities是有VDP验证的表,各个模块使用的策略函数是通过设置>>会计科目设置>>子分类帐会计设置>>子分类帐应用产品 来设置的,
如AP模块使用的是:XLA_SECURITY_POLICY_PKG.MO_POLICY,在该方法中有一句很重要
(p_obj_schema IN VARCHAR2, p_obj_name IN VARCHAR2)RETURN VARCHAR2 IS
l_mo_policy VARCHAR2(4000);
l_log_module VARCHAR2(240);
BEGIN
IF g_log_enabled THEN
l_log_module := C_DEFAULT_MODULE || '.MO_Policy';
END IF;
IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
trace('MO_Policy.Begin', C_LEVEL_PROCEDURE, l_log_module);
END IF;
l_mo_policy := mo_global.org_security
(obj_schema => null ,
obj_name => null );
IF (C_LEVEL_STATEMENT >= g_log_level) THEN
trace('l_mo_policy after calling
mo_global.org_security = ' || l_mo_policy,
C_LEVEL_STATEMENT,
l_log_module);
END IF;
l_mo_policy := REGEXP_REPLACE(l_mo_policy,
'org_id',
'security_id_int_1',
1,
1);
-- Security identifiers are not populated. In case of, manual journal entires
-- or third party merge events.
-- bug 4717192, add the if condition
IF (l_mo_policy is not null) THEN
l_mo_policy := l_mo_policy || ' or security_id_int_1 IS NULL ';
END IF;
xla_utility_pkg.print_logfile
('l_mo_policy after replace = ' || l_mo_policy);
IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
trace('MO_Policy.End', C_LEVEL_PROCEDURE, l_log_module);
END IF;
RETURN(l_mo_policy);
END MO_Policy;
一般的MOAC
VPD使用的字段时ORG_ID该处是将ORG_ID替换为security_id_int_1,很明显了
现在分析了GL和SLA以及 SLA和字模块之间联系,在加上上面的那段插值代码中对应的表关系,就很容易整理
出常见的追溯关系了,可能也有特殊情况没有涉及到。
下面是一个实例 :
首先看**这边的分配,该分配是对应于SLA中的表xla_distribution_links
在该情况下可以查询出每个会计帐户的明细来历,这是AP**的分配
,aid.invoice_line_number "**行号"
distribution_line_number 分配行号
,aid.rcv_transaction_id 接收事务id
,aid.amount "金额"
from ap_invoice_distributions aid
,ap_invoices
api
where api.invoice_id = aid.invoice_id
and aid.invoice_id = 10140
order by aid.invoice_line_number
,distribution_line_number;
分析:应付分配中的账户,在SLA中会产生两行数据,并且这两行数据借贷相反 金额相同。
从GL查行数据,在GL的一个header下的行有可能是经过合并后的行,因此GL的行并不能准确的表示出帐户源的帐户信息,在GL的同一个帐户行可能对应着AP这边很多张**的帐户信息,但会计行中的子分类帐日记帐分录行的每一行则一定对应着同一张**。
如下代码是整理的追溯一般代码
--======xla_transaction_entities=========--------
xte.application_id "应用",
xte.entity_id,
xte.ledger_id "分类帐SOB",
xte.entity_code,
xett.name "事务实体类型",
le.name "法人主体",
le.legal_entity_identifier "人主体所得税纳税登记", --legal_entity_tax
------------------------------
--AP_INVOICES
AP ** INVOICE_ID,
--AP_PAYMENTS
AP付款 CHECK_ID,
--RECEIPTS
收款 CASH_RECEIPT_ID,
--TRANSACTIONS 事务处理
销售 ** CUSTOMER_TRX_ID,
xte.source_id_int_1 "事务源对应ID",
------------------------------
/*--下面两个字段折旧的时候会有值
xte.source_id_int_2 ,
xte.source_id_int_3,*/
xte.security_id_int_1 "ORG_ID",
xte.source_application_id "源对应应用",
--======xla_event=========--------
xe.event_type_code, --Event type code
xent.name "事件类型",
-- ,xe.event_status_code --Event status code
-- ,xe.process_status_code --Processing status code
/*This flag indicates whether the event is on hold or not.
possible values: (Y)--yes, (N)--No*/
-- ,xe.on_hold_flag,
--==============xla_ae_headers=======-----
xah.ledger_id "SOB",
xah.je_category_name --General Ledger category name ,
xah.accounting_date,
xah.period_name "期间",
/* ,xah.balance_type_code --Balance type (Actual, Budget, or Encumbrance)
,xah.gl_transfer_date
,xah.accounting_entry_status_code
,xah.accounting_entry_type_code
,xah.zero_amount_flag,*/
--==============xla_ae_line=======-----
xal.ae_line_num "行号",
xal.code_combination_id "账户ID",
gjl.code_combination_id "日记帐gcc",
xal.gl_transfer_mode_code,
xal.accounting_class_code "会计分类",
xlp.meaning "会计分类",
xal.accounted_dr "入账借项(本位币)",
xal.accounted_cr "入账贷项(本位币)",
xal.currency_code "币种",
xal.entered_dr "账户原币借项",
xal.entered_cr "账户原币贷项",
gir.je_line_num "日记帐行号",
xte.entity_id,
xte.application_id,
xe.event_id,
xah.ae_header_id,
xal.ae_line_num
from xla_transaction_entities xte,
xla_entity_types_tl xett,
xle_entity_profiles le,
xla_events xe,
xla_event_types_tl xent,
xla_ae_headers xah,
xla_ae_lines xal,
xla_lookups xlp,
gl_import_references gir,
gl_je_lines gjl
where 1 = 1
and xte.entity_id = xe.entity_id
and xte.application_id = xe.application_id
and xte.legal_entity_id = le.legal_entity_id(+)
and xah.event_id = xe.event_id
and xah.application_id = xe.application_id
and xent.event_type_code = xe.event_type_code
and xent.application_id = xe.application_id
and xent.language = 'ZHS'
and xah.ae_header_id = xal.ae_header_id
and xah.application_id = xal.application_id
and xlp.lookup_type(+) = 'XLA_ACCOUNTING_CLASS'
and xlp.lookup_code(+) = xal.accounting_class_code
and gir.gl_sl_link_id = xal.gl_sl_link_id
and gir.gl_sl_link_table = xal.gl_sl_link_table
and gjl.je_header_id = gir.je_header_id
and gjl.je_line_num = gir.je_line_num
and xett.entity_code = xte.entity_code
and xett.application_id = xte.application_id
and xett.language = 'ZHS'
and gir.je_batch_id = 3008;