We can create custom view to org specific. If we set org then fetch data for a specific org.
Step1:- Create table custom schema
create table XXC05_TEST_ORG(org_id number,po_header_id number,agent_id number,type_loolup_code varchar2(20));
Step2:- Create VIEW in APPS schema
CREATE OR REPLACE VIEW XXC05_ORG AS SELECT * FROM nn.XXC05_TEST_ORG;
Note:- nn is a schema name in which we create table.
Step3:- Execute belo code
begin
dbms_rls.add_policy(OBJECT_SCHEMA => 'APPS',OBJECT_NAME => 'XXC05_ORG',POLICY_NAME => 'ORG_SEC',POLICY_FUNCTION =>'MO_GLOBAL.ORG_SECURITY');
end;
or
begin
dbms_rls.add_policy(NULL,'XXC05_ORG','ORG_SEC',NULL,'MO_GLOBAL.ORG_SECURITY',NULL,FALSE,TRUE,FALsE,NULL,FALSE,NULL,NULL);
end;
or
begin
dbms_rls.add_policy(NULL,'XXC05_ORG','ORG_SEC',NULL,'MO_GLOBAL.ORG_SECURITY');
end;
Step4:- Insert data in custom view.
insert into XXC05_ORG(
SELECT org_id,
po_header_id,
agent_id,
type_lookup_code
FROM po_headers_all
WHERE org_id in (916,204,201)
);
Step5:- Commit
Step6:- Now custom view is org specific view. First we set org then fetch data.
No comments:
Post a Comment