Oracle EBS中分类账和法人实体 的关系(有sql语句实例)



版权声明:本文为博主原创文章,未经博主允许不得转载。
首先,对于EBS中的法人实体和分类账以及OU之间的一个层次关系如下图:
其中,对于分类账和法人实体,并不简单是一对多的关系,按照理论上来讲:由于分类账存在辅助分类账,所以一个法人实体除了对应一个主分类账(Primary Ledger)外,还可能存在辅助分类账,但是一个法人实体肯定只对应一个唯一的主分类账,而对于分类账之间是否存在有“主从关系”还不太清楚,有待进一步考证。
而在R12中,要找出他们之间的关系就需要通过一下sql来看了:
- SELECT lg.ledger_id,
- lg.NAME ledger_name,
- lg.short_name ledger_short_name,
- cfgdet.object_id legal_entity_id,
- le.NAME legal_entity_name,
- reg.location_id location_id,
- hrloctl.location_code location_code,
- hrloctl.description location_description,
- lg.ledger_category_code,
- lg.currency_code,
- lg.chart_of_accounts_id,
- lg.period_set_name,
- lg.accounted_period_type,
- lg.sla_accounting_method_code,
- lg.sla_accounting_method_type,
- lg.bal_seg_value_option_code,
- lg.bal_seg_column_name,
- lg.bal_seg_value_set_id,
- cfg.acctg_environment_code,
- cfg.configuration_id,
- rs.primary_ledger_id,
- rs.relationship_enabled_flag
- FROM gl_ledger_config_details primdet,
- gl_ledgers lg,
- gl_ledger_relationships rs,
- gl_ledger_configurations cfg,
- gl_ledger_config_details cfgdet,
- xle_entity_profiles le,
- xle_registrations reg,
- hr_locations_all_tl hrloctl
- WHERE rs.application_id = 101
- AND ((rs.target_ledger_category_code = 'SECONDARY' AND
- rs.relationship_type_code <> 'NONE') OR
- (rs.target_ledger_category_code = 'PRIMARY' AND
- rs.relationship_type_code = 'NONE') OR
- (rs.target_ledger_category_code = 'ALC' AND
- rs.relationship_type_code IN ('JOURNAL', 'SUBLEDGER')))
- AND lg.ledger_id = rs.target_ledger_id
- AND lg.ledger_category_code = rs.target_ledger_category_code
- AND nvl(lg.complete_flag, 'Y') = 'Y'
- AND primdet.object_id = rs.primary_ledger_id
- AND primdet.object_type_code = 'PRIMARY'
- AND primdet.setup_step_code = 'NONE'
- AND cfg.configuration_id = primdet.configuration_id
- AND cfgdet.configuration_id(+) = cfg.configuration_id
- AND cfgdet.object_type_code(+) = 'LEGAL_ENTITY'
- AND le.legal_entity_id(+) = cfgdet.object_id
- AND reg.source_id(+) = cfgdet.object_id
- AND reg.source_table(+) = 'XLE_ENTITY_PROFILES'
- AND reg.identifying_flag(+) = 'Y'
- AND hrloctl.location_id(+) = reg.location_id
- AND hrloctl.LANGUAGE(+) = userenv('LANG');
- SELECT lg.ledger_id,
- lg.NAME ledger_name,
- lg.short_name ledger_short_name,
- cfgdet.object_id legal_entity_id,
- le.NAME legal_entity_name,
- reg.location_id location_id,
- hrloctl.location_code location_code,
- hrloctl.description location_description,
- lg.ledger_category_code,
- lg.currency_code,
- lg.chart_of_accounts_id,
- lg.period_set_name,
- lg.accounted_period_type,
- lg.sla_accounting_method_code,
- lg.sla_accounting_method_type,
- lg.bal_seg_value_option_code,
- lg.bal_seg_column_name,
- lg.bal_seg_value_set_id,
- cfg.acctg_environment_code,
- cfg.configuration_id,
- rs.primary_ledger_id,
- rs.relationship_enabled_flag
- FROM gl_ledger_config_details primdet,
- gl_ledgers lg,
- gl_ledger_relationships rs,
- gl_ledger_configurations cfg,
- gl_ledger_config_details cfgdet,
- xle_entity_profiles le,
- xle_registrations reg,
- hr_locations_all_tl hrloctl
- WHERE rs.application_id = 101
- AND ((rs.target_ledger_category_code = 'SECONDARY' AND
- rs.relationship_type_code <> 'NONE') OR
- (rs.target_ledger_category_code = 'PRIMARY' AND
- rs.relationship_type_code = 'NONE') OR
- (rs.target_ledger_category_code = 'ALC' AND
- rs.relationship_type_code IN ('JOURNAL', 'SUBLEDGER')))
- AND lg.ledger_id = rs.target_ledger_id
- AND lg.ledger_category_code = rs.target_ledger_category_code
- AND nvl(lg.complete_flag, 'Y') = 'Y'
- AND primdet.object_id = rs.primary_ledger_id
- AND primdet.object_type_code = 'PRIMARY'
- AND primdet.setup_step_code = 'NONE'
- AND cfg.configuration_id = primdet.configuration_id
- AND cfgdet.configuration_id(+) = cfg.configuration_id
- AND cfgdet.object_type_code(+) = 'LEGAL_ENTITY'
- AND le.legal_entity_id(+) = cfgdet.object_id
- AND reg.source_id(+) = cfgdet.object_id
- AND reg.source_table(+) = 'XLE_ENTITY_PROFILES'
- AND reg.identifying_flag(+) = 'Y'
- AND hrloctl.location_id(+) = reg.location_id
- AND hrloctl.LANGUAGE(+) = userenv('LANG');
从数据结果中可以看出,系统中有7个分类账(LEDGER)和5个法人实体(LEGAL_ENTITY),对于TCL_YSP这个法人实体来说,拥有两个分类账,其LEDGER_CATEGORY_CODE分别为PRIMARY和SECONDARY,说明了一个法人实体有一个主分类账,并且可以有辅助分类账,而2041这个分类账,则没有对应的法人实体,但是其LEDGER_CATEGORY_CODE依然为PRIMARY,这说明一个分类账的category_code有可能是事前定义好的,而不是在与法人实体关联的时候才决定的,所以不能确定分类账之间到底有层次关系……
对以上的sql进行精简,也可以得出相应的关系来:
- select lg.ledger_id, --分类帐
- cfgdet.object_id legal_entity_id, --法人实体
- lg.currency_code,
- lg.chart_of_accounts_id,
- rs.primary_ledger_id
- from gl_ledger_config_details primdet,
- gl_ledgers lg,
- gl_ledger_relationships rs,
- gl_ledger_configurations cfg,
- gl_ledger_config_details cfgdet
- where rs.application_id = 101 --101为总账GL应用
- and ((rs.target_ledger_category_code = 'SECONDARY' and
- rs.relationship_type_code <> 'NONE') or
- (rs.target_ledger_category_code = 'PRIMARY' and
- rs.relationship_type_code = 'NONE') or
- (rs.target_ledger_category_code = 'ALC' and
- rs.relationship_type_code in ('JOURNAL', 'SUBLEDGER')))
- and lg.ledger_id = rs.target_ledger_id
- and lg.ledger_category_code = rs.target_ledger_category_code
- and nvl(lg.complete_flag, 'Y') = 'Y'
- and primdet.object_id = rs.primary_ledger_id
- and primdet.object_type_code = 'PRIMARY'
- and primdet.setup_step_code = 'NONE'
- and cfg.configuration_id = primdet.configuration_id
- and cfgdet.configuration_id(+) = cfg.configuration_id
- and cfgdet.object_type_code(+) = 'LEGAL_ENTITY';
- select lg.ledger_id, --分类帐
- cfgdet.object_id legal_entity_id, --法人实体
- lg.currency_code,
- lg.chart_of_accounts_id,
- rs.primary_ledger_id
- from gl_ledger_config_details primdet,
- gl_ledgers lg,
- gl_ledger_relationships rs,
- gl_ledger_configurations cfg,
- gl_ledger_config_details cfgdet
- where rs.application_id = 101 --101为总账GL应用
- and ((rs.target_ledger_category_code = 'SECONDARY' and
- rs.relationship_type_code <> 'NONE') or
- (rs.target_ledger_category_code = 'PRIMARY' and
- rs.relationship_type_code = 'NONE') or
- (rs.target_ledger_category_code = 'ALC' and
- rs.relationship_type_code in ('JOURNAL', 'SUBLEDGER')))
- and lg.ledger_id = rs.target_ledger_id
- and lg.ledger_category_code = rs.target_ledger_category_code
- and nvl(lg.complete_flag, 'Y') = 'Y'
- and primdet.object_id = rs.primary_ledger_id
- and primdet.object_type_code = 'PRIMARY'
- and primdet.setup_step_code = 'NONE'
- and cfg.configuration_id = primdet.configuration_id
- and cfgdet.configuration_id(+) = cfg.configuration_id
- and cfgdet.object_type_code(+) = 'LEGAL_ENTITY';
Oracle EBS中分类账和法人实体 的关系(有sql语句实例)的更多相关文章
- oracle 数据库中,应用程序里的连接探測语句的正确使用
oracle 数据库中,应用程序里的连接探測语句的正确使用 本文为原创文章.转载请注明出处:http://blog.csdn.net/msdnchina/article/details/3851376 ...
- oracle查看执行最慢与查询次数最多的sql语句及其执行速度很慢的问题分析
oracle查看执行最慢与查询次数最多的sql语句 注:本文来源 于<oracle查看执行最慢与查询次数最多的sql语句> 前言 在ORACLE数据库应用调优中,一个SQL的执行次数/频率 ...
- 从数据库中查询所有表及所有字段的SQL语句
从数据库中查询所有表及所有字段的SQL语句 由于一个小项目的需要,近日完成一个从数据库中查询所有表及所有字段的方法,其实用两条SQL语句就可以完成. Sql Server版:列出当前DB中所有表:se ...
- (转载)总结一下SQL语句中引号(')、quotedstr()、('')、format()在SQL语句中的用法
总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中的用法 总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中 ...
- 总结一下SQL语句中引号(')、quotedstr()、('')、format()在SQL语句中的用法
总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中的用法 日期:2005年6月1日 作者:seasky212 总结一下SQL语句中引号(').quoted ...
- (转载)总结一下SQL语句中引号(')、quotedstr()、('')、format()在SQL语句中的用法
总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中的用法以及SQL语句中日期格式的表示(#).('')在Delphi中进行字符变量连接相加时单引号用('' ...
- log4j向oracle中插入一条系统当前时间的sql语句
配置log4j,要向oracle插入一条系统当前时间的sql语句,按网上查找的总是出现各种各样的报错,最后总结出的写法是: ### shezhi### log4j.rootLogger = debug ...
- Oracle 行转列pivot 、列转行unpivot 的Sql语句总结
这个比较简单,用||或concat函数可以实现 select concat(id,username) str from app_user select id||username str from ap ...
- Oracle、DB2、SQLSERVER、Mysql、Access分页SQL语句梳理
最近把平时在项目中常用到的数据库分页sql总结了下.大家可以贴出分页更高效的sql语句.sqlserver分页 第一种分页方法 需用到的参数: pageSize 每页显示多少条数据 pageNumbe ...
随机推荐
- Ora创建job定时执行某存储过程
--创建job任务,每天晚上8点执行存储过程:por_postrecords-- declare job number; begin sys.dbms_job.submit(job =>job, ...
- leetcode第八题--String to Integer (atoi)
Problem: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible inp ...
- ylb:SQLServer常用系统函数-字符串函数、配置函数、系统统计函数
原文:ylb:SQLServer常用系统函数-字符串函数.配置函数.系统统计函数 ylbtech-SQL Server:SQL Server-SQLServer常用系统函数 -- ========== ...
- HDU 4812 D Tree 树分区+逆+hash新位置
意甲冠军: 特定n点树 K 以下n号码是正确的点 以下n-1行给出了树的侧. 问: 所以,如果有在正确的道路点图的路径 % mod = K 如果输出路径的两端存在. 多条路径则输出字典序最小的一条. ...
- BackgroundWorker组件使用总结
首先在窗体拖入一个BackgroundWorker组件,根据功能需要设置BackgroundWorker的属性 WorkerSupportsCancellation = true; 允许取消后台正在执 ...
- 喜大本\\ u0026普,微软的开源
词汇表--喜大本\\ u0026普:爱过.有趣的游戏,庆祝.奔走相告.简而言之<reload=1">微软宣布.NET开发环境开源>是个好消息. 前言及历史回想 就我个人来说 ...
- 解决设置redmineblacklog的按钮无效问题
安装了redemin+backlog后,想要设置backlog, 先用管理员登录,然后访问网页: http://localhost/settings/plugin/redmine_backlogs 发 ...
- iOS基础 - 单元测试
单元测试(unit testing):对软件中最小可测试单元进行检查和验证.一般面向过程的语言中,基本单元为函数,面向对象的语言中,基本单元通常是类,其实对于一个手机上的app来说基本单元也可以是一个 ...
- 关于C#时间格式化中的“f”
示例: DateTime.Now.ToString("yyyyMMddHHmmssfff") 上面的示例就是将日期格式化到毫秒级.那么问题来了,格式化到微秒级.纳秒级怎么整?f又是 ...
- oracle数据库对date字段类型存在空值进行排序的处理方法
oracle数据库对date字段类型存在空值进行排序的处理方法 oracle 数据库,如果表中有一个字段类型为date,且该字段类型存在空值,并且需要排序, 解决方法为使用oracl ...