1.创建表时,对_ALL表创建同义词
-- Create Multi Org Synonym
CREATE OR REPLACE SYNONYM CUX_WF_DEF_HEADER FOR CUX.CUX_WF_DEF_HEADER_ALL;
2.对表添加VPD
-- Create Multi Org VPD Policy
BEGIN
dbms_rls.add_policy(object_name => 'CUX_WF_DEF_HEADER',
policy_name => 'ORG_SEC',
policy_function => 'MO_GLOBAL.ORG_SECURITY',
policy_type => dbms_rls.shared_context_sensitive);
END;
删除
dbms_rls.drop_policy(object_schema => 'APPS',
object_name => 'CUX_WF_DEF_HEADER',
policy_name => 'ORG_SEC');
3.对CUX应用进行注册
BEGIN
fnd_mo_product_init_pkg.register_application
(p_appl_short_name => 'CUX',
p_owner => 'HAND_CXY',
p_status => 'Y'
);
END;
4.对视图进行注册
BEGIN
dbms_rls.add_policy(object_name=>'CUX_MOAC_TEST_V',
policy_name => 'ORG_SEC',
policy_function => 'MO_GLOBAL.org_security',
policy_type => dbms_rls.shared_context_sensitive);
END;
(如果不想注册了
BEGIN
dbms_rls.drop_policy(object_schema => 'APPS',
object_name => 'CUX_MOAC_TEST',
policy_name => 'ORG_SEC');
END;
)
5.在form的WHEN-NEW-FORM-INSTANCE触发器中加入
mo_global.init(p_application_short_name);
比如mo_global.init('CUX');
6.在FORM中选择OU字段的WHEN-VALIDATE-ITEM触发器上加入代码,比如:
IF :control_block.org_id IS NOT NULL THEN
mo_global.set_policy_context('S',:control_block.org_id);
ELSE
mo_global.set_policy_context('M',NULL);
END IF;