ebs多ou和多帐套客户化实现
(一) 多ou总结
1. form多ou实现
1) 创建一个table,以cux_ap_check_header_all为例
2) 创建table的两个synonym(一个不含_all,一个以_all结尾):cux_ap_check_header和cux_ap_check_header_all
3) 给不含_all的synonym:cux_ap_check_header加上组织屏蔽的策略函数
dbms_rls.add_policy(object_name => 'cux_ap_check_header',
policy_name => 'org_sec',
policy_function => 'mo_global.org_security',
policy_type => dbms_rls.shared_context_sensitive);
4) 在不含_all的synonym的基础上创建视图: cux_ap_check_header_v
5) 进入form时(pre-form触发器)添加代码:
mo_global.init(&p_appl_shortname);--p_appl_shortname为应用简称
6) 当选择某个ou时(一般在when_validate_item触发器)中添加代码:mo_global.set_policy_context('s',&p_org_id);--p_org_id为ou的id
2. report多ou实现
1) 给并发程序设置业务实体模式:单个,多个和空(默认)。一般设置为‘单个’
业务实体模式对应表fnd_concurrent_programs中的multi_org_category字段
2) 得到当前ou的值。
使用:mo_global.get_current_org_id或者fnd_global.org_id
3) 在报表的参数和报表的逻辑中加上ou的限制
3. gl数据的多ou实现
1) 得到当前ou的值。
使用:mo_global.get_current_org_id或者fnd_global.org_id
2) 根据ou的值得到部门段的值:
declare
l_segment1 varchar2(150);--部门段
begin
select o3.attribute5
into l_segment1
from hr_all_organization_units o,
hr_all_organization_units_tl otl,
hr_organization_information o2,
hr_organization_information o3
where o.organization_id = o2.organization_id
and o.organization_id = o3.organization_id
and o2.org_information_context = 'class'
and o3.org_information_context = 'operating unit information'
and o2.org_information1 = 'operating_unit'
and o2.org_information2 = 'y'
and o.organization_id = otl.organization_id
and o.organization_id = &p_org_id –ou id
and otl.language = userenv('lang');
end;
3) 将步骤2得到的值作为限制条件:
select gl_code_combinations gcc where gcc.segment1 = l_segment1;
4. interface多ou总结
1) 给并发程序设置业务实体模式:单个,多个和空(默认)。业务实体模式对应表fnd_concurrent_programs中的multi_org_category字段
2) 如果接口的导入程序中ou作为一个参数,则应该将所有的ou作一次循环。
5. 多ou实现扩展知识
1) 给客户化应用注册和取消moac的控制
fnd_mo_product_init_pkg.register_application(注册应用)
fnd_mo_product_init_pkg.remove_application(取消应用)
查看支持moac的应用sql:
select * from fnd_mo_product_init;
2) 给数据库对象注册和取消策略-policy
dbms_rls.add_policy(注册策略)
dbms_rls.drop_policy(取消策略)
3) 多ou 涉及到的表
a) 查看数据库对象是否增加了策略-policy
select * from dba_policies;
b) 查看当前session所能访问的ou
select * from mo_glob_org_access_tmp;
c) 查看当前session应用上下文(context)的值(说明:ou的值保存在context中)
select * from dba_context dc where dc.namespace like 'multi%';
moac使用的应用程序上下文:multi_org,multi_org2
(二) 多帐套总结
1. 客户化开发中的多帐套屏蔽
1) 得到当前ou的值。
使用:mo_global.get_current_org_id或者fnd_global.org_id
2) 根据组织id得到帐套id和公司名称。sql语句为:
declare
l_org_information3 varchar2(150);--帐套id
l_company_desc varchar2(150);--公司中文描述
begin
select o3.org_information3,o3.attribute3
into l_org_information3,l_company_desc
from hr_all_organization_units o,
hr_all_organization_units_tl otl,
hr_organization_information o2,
hr_organization_information o3
where o.organization_id = o2.organization_id
and o.organization_id = o3.organization_id
and o2.org_information_context || '' = 'class'
and o3.org_information_context = 'operating unit information'
and o2.org_information1 = 'operating_unit'
and o2.org_information2 = 'y'
and o.organization_id = otl.organization_id
and otl.language = userenv('lang')
and o.organization_id = &p_org_id;--ou id
end;
3) 得到本位币,sql语句为:
declare
l_local_currency_code varchar2(15);--本位币
begin
select gsob.currency_code
into l_local_currency_code
from gl_sets_of_books gsob, hr_operating_units hou
where gsob.set_of_books_id = hou.set_of_books_id
and hou.organization_id = &p_org_id;--ou id
end;
4) 在程序中加上帐套和本位币的限制
2. 多帐套实现扩展
1) 得到帐套的sql语句为:
select * from gl_ledgers;
2) 得到法人的sql语句为:
select * from xle_entity_profiles;