Oracle EBS SLA取值
-- 从GL总账追溯到 => 子分类账SLA => 子模块AP、AR等
SELECT xep.name, -- 法人主体
xep.legal_entity_identifier, -- 法人主体所得纳税税登记
--
xentity_t.entity_code,
xentity_t.name "事务实体类型名称",
--
xte.application_id "应用ID",
xte.entity_id,
xte.ledger_id "分类账SOB ID",
------------------------------
--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 "源应用ID",
--
xe.event_id,
xe.event_type_code,
xevent_t.name "事件类型",
--
--==============xla_ae_headers=======-----
xah.ae_header_id,
xah.ledger_id "SOB ID",
xah.je_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 "日记帐行号", --==============xla_distribution_links=======-----
xdl.source_distribution_type, -- 源账户分配类型
xdl.source_distribution_id_num_1 "源账户关联ID", -- Transaction source distribution identifer (Number)
xdl.tax_line_ref_id, -- 税明细行 ZX_LINES_V.TAX_LINE_ID -- Detail Tax Line Reference
xdl.unrounded_entered_dr, -- Unrounded Entered Debit Amount for the journal line (DR)
xdl.unrounded_entered_cr, -- Unrounded Entered Credit Amount for the journal line (CR)
--
xdl.applied_to_distribution_type, -- (如:AP_INV_DIST、PO_DISTRIBUTIONS_ALL等)
xdl.applied_to_source_id_num_1, -- (如:核销行 源发票ID 、PO_DISTRIBUTION_ID等)
xdl.applied_to_dist_id_num_1
--
FROM xle_entity_profiles xep,
--
xla_entity_types_tl xentity_t,
--
xla.xla_transaction_entities xte, -- ORG VPD
xla_event_types_tl xevent_t,
xla_events xe,
--
xla_distribution_links xdl, -- distribution
--
xla_ae_headers xah,
xla_ae_lines xal,
xla_lookups xlp,
--
gl_import_references gir,
gl_je_headers gjh,
gl_je_lines gjl
WHERE 1 = 1
-- 1.9 xep + xte
AND xep.legal_entity_id(+) = xte.legal_entity_id
-- 1.8 xentity_t + xte
AND xentity_t.entity_code = xte.entity_code
AND xentity_t.application_id = xte.application_id
AND xentity_t.language = userenv('LANG')
-- 1.7 xevent_t + xe
AND xevent_t.event_type_code = xe.event_type_code
AND xevent_t.application_id = xe.application_id
AND xevent_t.language = userenv('LANG')
-- 1.6 xte + xe/xah
-- XLA.XLA_TRANSACTION_ENTITIES_U1 on XLA.XLA_TRANSACTION_ENTITIES (ENTITY_ID, APPLICATION_ID)
-- 如果不关联xla_events表,则此处可以使用如下方式进行关联
-- AND xte.entity_id = xah.entity_id
-- AND xte.application_id = xah.application_id
AND xte.entity_id = xe.entity_id
AND xte.application_id = xe.application_id
-- 1.5 xe + xah
-- XLA.XLA_EVENTS_U1 on XLA.XLA_EVENTS (EVENT_ID, APPLICATION_ID)
-- XLA.XLA_EVENTS_U2 on XLA.XLA_EVENTS (ENTITY_ID, EVENT_NUMBER, APPLICATION_ID)
AND xe.event_id = xah.event_id
AND xe.application_id = xah.application_id -- 1.4 xal + xdl(distribution)
-- 此处为什么使用外连接 ? 因为有的事务处理没有distribution ^_^
AND xdl.ae_header_id(+) = xal.ae_header_id
AND xdl.ae_line_num(+) = xal.ae_line_num
AND xdl.application_id(+) = xal.application_id
-- 1.3 xah + xal
AND xah.ae_header_id = xal.ae_header_id
AND xah.application_id = xal.application_id
AND xlp.lookup_code(+) = xal.accounting_class_code
AND xlp.lookup_type(+) = 'XLA_ACCOUNTING_CLASS'
-- 1.2 xal + gir
AND xal.gl_sl_link_id = gir.gl_sl_link_id
AND xal.gl_sl_link_table = gir.gl_sl_link_table
-- 1.1 gir + gl
AND gir.je_header_id = gjh.je_header_id
AND gir.je_line_num = gjl.je_line_num
--
AND gjh.je_header_id = gjl.je_header_id
AND gjh.je_header_id = 216128 /*216124*/
-- AND gjl.je_line_num = 1, 2, 3
--应收事务处理追溯SLA
SELECT pv.vendor_name,
sum(rt.quantity) quantity,
sum(xal.accounted_dr) accounted_dr,
sum(xal.accounted_cr) accounted_cr
FROM xla_ae_lines xal,
gl_code_combinations_v gcc,
xla_ae_headers xae,
rcv_receiving_sub_ledger rrsl,
xla_distribution_links xdl,
rcv_transactions rt,
po_vendors pv
WHERE 1 = 1
AND xal.code_combination_id = gcc.code_combination_id
AND rrsl.code_combination_id = xal.code_combination_id
AND gcc.segment3 = '22020201'
AND xae.ae_header_id = xal.ae_header_id
AND xdl.source_distribution_id_num_1 = rrsl.rcv_sub_ledger_id
AND xdl.ae_header_id = xal.ae_header_id
AND rt.transaction_id = rrsl.rcv_transaction_id
AND rt.vendor_id = pv.vendor_id
AND xae.period_name = '01-15'
GROUP BY pv.vendor_name;
--应付发票追溯SLA
SELECT jh.name 总账日记账名称
jh.je_source 总账日记账来源
jh.je_category 总账日记账分类
jh.description 总账日记账说明
jh.currency_code 总账币别
jh.period_name 总账会计期间
jh.default_effective_date 总账有效日期
jl.je_line_num 总账行号
gcc.concatenated_segments 总账账户
jl.accounted_dr 总账入账借方
jl.accounted_cr 总账入账贷方
jl.description 总账行说明
xal.ae_line_num 分类账行号
xal.accounted_dr 分类账借方金额
xal.accounted_cr 分类账贷方金额
nvl(xal.accounted_dr, 0) - nvl(xal.accounted_cr, 0) 分类账余额
xal.description 分类账行说明
su.vendor_name 供应商名称
sus.vendor_site_code 供应商地点
ai.invoice_num 发票或付款编号
ai.invoice_date 发票日期
FROM gl_je_headers jh,
gl_je_lines jl,
gl_import_references gir,
gl_code_combinations_kfv gcc,
xla_ae_lines xal,
xla_ae_headers xah,
xla.xla_transaction_entities xte,
ap.ap_invoices_all ai,
ap.ap_suppliers su,
ap.ap_supplier_sites_all sus
WHERE jh.je_header_id = jl.je_header_id
AND jl.je_header_id = gir.je_header_id
AND jl.je_line_num = gir.je_line_num
AND jl.code_combination_id = gcc.code_combination_id
AND gir.gl_sl_link_id = xal.gl_sl_link_id
AND gir.gl_sl_link_table = xal.gl_sl_link_table
AND xal.application_id = xah.application_id
AND xal.ae_header_id = xah.ae_header_id
AND xah.application_id = xte.application_id
AND xah.entity_id = xte.entity_id
AND xte.source_id_int_1 = ai.invoice_id
AND xte.entity_code = 'AP_INVOICES'
AND ai.vendor_id = su.vendor_id
AND ai.vendor_id = sus.vendor_id
AND ai.vendor_site_id = sus.vendor_site_id
AND ai.org_id = sus.org_id
AND xal.displayed_line_number > 0
AND jh.ACTUAL_FLAG = 'A'
--AND su.vendor_name = '&供应商名称
-- AND gcc.segment1 like 'A140101'
AND gcc.code_combination_id = 31322
--AND gcc.segment2 = '&部门
-- AND gcc.segment3 = '&会计科目
AND jl.period_name = '2015-07'
--收款追溯SLA
SELECT hp.party_name
,(nvl(al.accounted_cr
,0) - nvl(al.accounted_dr
,0)) amount
,crh_first_posted.gl_date
,cr.comments
FROM xla.xla_ae_lines al
,xla.xla_ae_headers ah
,xla.xla_transaction_entities xte
,ar_cash_receipts_all cr
,ar_cash_receipt_history_all crh_first_posted
,hz_cust_site_uses_all csu
,hz_cust_acct_sites_all hcas
,hz_cust_accounts_all hca
,hz_parties hp WHERE 1 = 1
AND al.ae_header_id = ah.ae_header_id
AND ah.entity_id = xte.entity_id
AND xte.entity_code = 'RECEIPTS'
AND cr.cash_receipt_id = xte.source_id_int_1
AND ah.ledger_id = 2021
AND al.code_combination_id = 20795
AND hp.party_id = hca.party_id
AND csu.site_use_id = cr.customer_site_use_id
AND csu.cust_acct_site_id = hcas.cust_acct_site_id
AND hca.cust_account_id = hcas.cust_account_id
AND hcas.org_id = cr.org_id
AND crh_first_posted.cash_receipt_id(+) = cr.cash_receipt_id
AND crh_first_posted.org_id(+) = cr.org_id
AND crh_first_posted.first_posted_record_flag(+) = 'Y'
ORDER BY hp.party_name
--库存事务处理
SELECT pv.vendor_name,
poh.segment1,
mmt.transaction_quantity,
rt.quantity,
mmt.rcv_transaction_id,
mmt.transaction_type_id,
xal.accounted_dr,
xal.accounted_cr,
OOD.ORGANIZATION_NAME
FROM mtl_material_transactions mmt,
rcv_transactions rt,
po_headers_all poh,
po_vendors pv,
xla_ae_lines xal,
gl_code_combinations_v gcc,
xla_ae_headers xah,
xla.xla_events xe,
xla.xla_transaction_entities xte,
org_organization_definitions ood
WHERE 1 = 1
AND xal.code_combination_id = gcc.code_combination_id
AND gcc.segment3 = '22020201'
AND xal.ae_header_id = xah.ae_header_id
AND xah.event_id = xe.event_id
AND xe.entity_id = xte.entity_id
AND xte.entity_code = 'MTL_ACCOUNTING_EVENTS'
AND mmt.transaction_id = xte.source_id_int_1
AND mmt.rcv_transaction_id = rt.transaction_id(+)
AND rt.po_header_id = poh.po_header_id(+)
AND poh.vendor_id = pv.vendor_id(+)
AND ood.organization_id = mmt.organization_id
AND to_char(mmt.transaction_date, 'YYYY-MM') = '2015-02';
--付款
-- 从应付付款追溯
SELECT jh.name 总账日记账名称
jh.je_source 总账日记账来源
jh.je_category 总账日记账分类
jh.description 总账日记账说明
jh.currency_code 总账币别
jh.period_name 总账会计期间
jh.default_effective_date 总账有效日期
jl.je_line_num 总账行号
gcc.concatenated_segments 总账账户
jl.accounted_dr 总账入账借方
jl.accounted_cr 总账入账贷方
jl.description 总账行说明
xal.ae_line_num 分类账行号
xal.accounted_dr 分类账借方金额
xal.accounted_cr 分类账贷方金额
nvl(xal.accounted_dr, 0) - nvl(xal.accounted_cr, 0) 分类账余额
xal.description 分类账行说明
su.vendor_name 供应商名称
sus.vendor_site_code 供应商地点
to_char(ac.check_number) 付款或付款编号
ac.check_date 发票或付款日期
FROM gl_je_headers jh,
gl_je_lines jl,
gl_import_references gir,
gl_code_combinations_kfv gcc,
xla_ae_lines xal,
xla_ae_headers xah,
xla.xla_transaction_entities xte,
ap.ap_checks_all ac,
ap.ap_suppliers su,
ap.ap_supplier_sites_all sus
WHERE jh.je_header_id = jl.je_header_id
AND jl.je_header_id = gir.je_header_id
AND jl.je_line_num = gir.je_line_num
AND jl.code_combination_id = gcc.code_combination_id
AND gir.gl_sl_link_id = xal.gl_sl_link_id
AND gir.gl_sl_link_table = xal.gl_sl_link_table
AND xal.application_id = xah.application_id
AND xal.ae_header_id = xah.ae_header_id
AND xah.application_id = xte.application_id
AND xah.entity_id = xte.entity_id
AND xte.source_id_int_1 = ac.check_id
AND xte.entity_code = 'AP_PAYMENTS'
AND ac.vendor_id = su.vendor_id
AND ac.vendor_id = sus.vendor_id
AND ac.vendor_site_id = sus.vendor_site_id
AND ac.org_id = sus.org_id
AND xal.displayed_line_number > 0
AND jh.ACTUAL_FLAG = 'A'
--AND su.vendor_name = '&供应商名称
-- AND gcc.segment1 like 'A14%'
AND gcc.code_combination_id = 31322
--AND gcc.segment2 = '&部门
--AND gcc.segment3 = '&会计科目
AND jl.period_name = '2015-07'
--采购
SELECT jh.name 总账日记账名称
jh.je_source 总账日记账来源
jh.je_category 总账日记账分类
jh.description 总账日记账说明
jh.currency_code 总账币别
jh.period_name 总账会计期间
jh.default_effective_date 总账有效日期
jl.je_line_num 总账行号
gcc.concatenated_segments 总账账户
jl.accounted_dr 总账入账借方
jl.accounted_cr 总账入账贷方
jl.description 总账行说明
xal.ae_line_num 分类账行号
xal.accounted_dr 分类账借方金额
xal.accounted_cr 分类账贷方金额
nvl(xal.accounted_dr, 0) - nvl(xal.accounted_cr, 0) 分类账余额
xal.description 分类账行说明
su.vendor_name 供应商名称
sus.vendor_site_code 供应商地点
to_char(ac.check_number) 付款或付款编号
ac.check_date 发票或付款日期
FROM gl_je_headers jh,
gl_je_lines jl,
gl_import_references gir,
gl_code_combinations_kfv gcc,
xla_ae_lines xal,
xla_ae_headers xah,
xla.xla_transaction_entities xte,
ap.ap_checks_all ac,
ap.ap_suppliers su,
ap.ap_supplier_sites_all sus
WHERE jh.je_header_id = jl.je_header_id
AND jl.je_header_id = gir.je_header_id
AND jl.je_line_num = gir.je_line_num
AND jl.code_combination_id = gcc.code_combination_id
AND gir.gl_sl_link_id = xal.gl_sl_link_id
AND gir.gl_sl_link_table = xal.gl_sl_link_table
AND xal.application_id = xah.application_id
AND xal.ae_header_id = xah.ae_header_id
AND xah.application_id = xte.application_id
AND xah.entity_id = xte.entity_id
AND xte.source_id_int_1 = ac.check_id
AND xte.entity_code = 'AP_PAYMENTS'
AND ac.vendor_id = su.vendor_id
AND ac.vendor_id = sus.vendor_id
AND ac.vendor_site_id = sus.vendor_site_id
AND ac.org_id = sus.org_id
AND xal.displayed_line_number > 0
AND jh.ACTUAL_FLAG = 'A'
--AND su.vendor_name = '&供应商名称
-- AND gcc.segment1 like 'A14%'
AND gcc.code_combination_id = 31322
--AND gcc.segment2 = '&部门
--AND gcc.segment3 = '&会计科目
AND jl.period_name = '2015-07'
Oracle EBS SLA取值的更多相关文章
- Oracle EBS 配置文件取值
SELECT op.profile_option_id, tl.profile_option_name, tl.user_profile_option_name, lv.level_id, lv.文件 ...
- Oracle EBS SLA 详解(转)
原文地址: Oracle EBS SLA 详解
- 关于oracle分组排序取值的问题
按照 某字段分组 某字段排序 然后取出该分组中排第1条数据(每组只取一条) SELECT* FROM( SELECT a.*,row_number() over(partition by ORI_FE ...
- Oracle EBS SLA 详解
SLA概述 SLA :子分类账(Subledger Accounting),这个在R12中大力宣扬的内容,我们通常的认为总账就是对Journal的汇总,但是在实际的操作中我们会发现,对于Sub sys ...
- Oracle EBS SLA(子分类账)
SLA概述 SLA(Subledger Accounting) 子帐是子分类帐会计的简称,字面上的含义就是子分类帐会计分录 SLA常用表介绍 在SLA中技术方面最常用的就是日记账来源追溯,在追溯的过程 ...
- Oracle Ebs R12 SLA与GL关系变化
http://www.cnblogs.com/bruce_zhao/p/3809886.html Oracle Ebs R12 SLA与GL关系变化 SLA概念:SLA(Subledger Accou ...
- Oracle存储过程-自定义数据类型,集合,遍历取值
摘要 Oracle存储过程,自定义数据类型,集合,遍历取值 目录[-] 0.前言 1.Packages 2.Packages bodies 3.输出结果 0.前言 在Oracle的存储过程中,可能会遇 ...
- Oracle EBS R12经验谈(二)
作者: jianping.ni 时间: 2009-2-13 12:52 标题: Oracle EBS R12经验谈(二) OAF页面:银行帐户开户人LOV值列表无值 在输入 应付超 ...
- ORACLE EBS常用表
http://www.cnblogs.com/quanweiru/archive/2012/09/26/2704628.html call fnd_global.APPS_INITIALIZE(131 ...
随机推荐
- 解决tomcat使用时catalina.out过大的问题
在项目上线之前需要做很多事情,其中最容易忘记的就是禁用不必要的日志和调整必要的参数. 调整参数这里主要指的是最大连接数,最小等待时间,虚拟机内存等. 而这里重点要提出的是,你需要禁用tomcat中不必 ...
- Java中函数的重载和重写
重载 重载指的是两个或者两个以上同名函数,但它们的参数不一样,这时会出现函数重载的情况.比如下面这段代码 class Test{ public void a(){ System.out.println ...
- MYSQL中常用的强制性操作(例如强制索引)
mysql常用的hint 对于经常使用oracle的朋友可能知道,oracle的hint功能种类很多,对于优化sql语句提供了很多方法.同样,在mysql里,也有类似的hint功能.下面介绍一些常用的 ...
- C# 连接 sql server
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...
- spinnaker自动发布k8s部署应用<一>
一.准备环境 !docker-ce---17.06.2-ce !k8s集群----1.11.1 !helm部署工具---helm-v2.10.0 !spinnaker-charts---spinnak ...
- webpack4 自学笔记五(tree-shaking)
全部的代码及笔记都可以在我的github上查看, 欢迎star: https://github.com/Jasonwang911/webpackStudyInit/tree/master/ThreeS ...
- Java Switch支持的类型问题
常见支持类型为int,byte,short,char及枚举类型.以上是JDK1.6以前的版本.JDK1.7时,又增加了String. 参考资料:1.java switch支持的数据类型 2.java中 ...
- iOS: Designated Initializer(指定初始化函数)
偶然间看到“ Designated Initializer”一词,心里一惊,这是什么东西,怎么没听说过?难道是我道行太浅?真的是这样?(好伤心啊)一阵子我怀疑之后,果断上网查了一下这个 Designa ...
- 盒子模型的margin负数用法
盒子的margin用法大家都应该很清楚,在实际中一般使用margin来水平居中或者让自己移动相应的位置,但是margin给负数在实际中也是有用的. 如图为两个浮动的盒子. 给左边的盒子margin-l ...
- 【Winform系列】Winform控件DataGridView添加数据的几种方式
1:直接添加 在控件中设置好每列的名称 例如: DataGridViewRow row = new DataGridViewRow(); int j = dgv.Rows.Add(row); dgv. ...