{"id":198,"date":"2007-06-11T12:50:53","date_gmt":"2007-06-11T10:50:53","guid":{"rendered":"http:\/\/oracle.malin.pl\/?p=198"},"modified":"2013-03-25T14:47:41","modified_gmt":"2013-03-25T12:47:41","slug":"ustawienie-zmiana-kontekstu-organizacji","status":"publish","type":"post","link":"http:\/\/oracle.malin.pl\/?p=198","title":{"rendered":"ustawienie \/ zmiana kontekstu organizacji"},"content":{"rendered":"<p>Aby zobaczy\u0107 dane w niekt\u00f3rych widokach w bazie danych, nale\u017cy ustawi\u0107 odpowiedni kontekst organizacji.<\/p>\n<p>Jest to element funkcjonalno\u015bci Muli-org.<\/p>\n<h2>R12<\/h2>\n<p>1) If you <strong>know the security_profile_id<\/strong> for that responsibility and user, you could call:<\/p>\n<pre>mo_global.set_org_access(null, &lt;sp_id&gt;, 'PA');<\/pre>\n<p>Security profiles are stored in PER_SECURITY_PROFILES, and the final parameter is the application short name of the application associated with the responsibility you would be using.<\/p>\n<p>&nbsp;<\/p>\n<p>2) To set the operating unit context to a<strong> single operating unit<\/strong>, you could simply use:<\/p>\n<pre>mo_global.set_policy_context(\u2018S\u2019,&lt;org_id&gt;);<\/pre>\n<p>However, it is generally preferable to use the following wrapper functions from <strong>MO_GLOBAL<\/strong> which will call the appropriate utilities to maintain the various elements of the multi-org context:<\/p>\n<p>Procedure: <strong>SET_POLICY_CONTEXT<\/strong>(p_access_mode varchar2, p_org_id number)<br \/>\nThis procedure will set the access mode, and when applicable the current operating unit context.<\/p>\n<p>Procedure: <strong>SET_ORG_ACCESS<\/strong>(p_org_id_char varchar2, p_sp_id_char varchar2, p_appl_short_name varchar2)<br \/>\nThis procedure determines if the application specified has multi-org access control enabled, by querying FND_MO_PRODUCT_INIT for the application short name. If this is enabled, and a security profile is specified (p_sp_id_char), then all orgs the user has access to will be populated in MO_GLOB_ORG_ACCESS_TMP. If there are more than one such org, the access method will be set to &#8222;Multiple&#8221;. Otherwise if no security profile id is specified, it will use the value of p_org_id to set the current operating unit value and set the access mode to &#8222;Single&#8221;.<\/p>\n<p>Procedure: <strong>INIT<\/strong>(p_appl_short_name varchar2)<br \/>\nThe procedure used by the applications when starting a new session. Based on the profile options &#8222;MO: Operating Unit&#8221; (ORG_ID) and &#8222;MO: Security Profile&#8221; (XLA_MO_SECURITY_PROFILE_LEVEL), this procedure calls set_org_access to establish the multi-org context for the session. To call this from withing SQL, the profile option context should have been initialized for the session.<\/p>\n<p>Function: <strong>GET_CURRENT_ORG_ID<\/strong><br \/>\nReturns the current operating unit setting. This should be null if the access mode is not 'S&#8217;<\/p>\n<p>Function: <strong>GET_ACCESS_MODE<\/strong><br \/>\nReturns the current access mode value.<\/p>\n<h2>11i<\/h2>\n<pre lang=\"PLSQL\">-- zmiana kontekstu organizacji --\r\n\r\nbegin\r\n\r\n  apps.fnd_client_info.SET_ORG_CONTEXT('107');\r\n\r\nend;\r\n\r\n--ID organizacji mo\u017cna odczyta\u0107 z:\r\nselect * from hr_operating_units\r\nselect * from org_organization_definitions\r\n\r\ndeclare\r\n  auser_name           varchar2(50) := 'LUSER';\r\n  aresponsibility_name varchar2(150) := 'XX-Dystrybucja';\r\n  l_req_id             number;\r\n  auser_id             number;\r\n  aresponsibility_id   number;\r\n  aapplication_id      number;\r\nbegin\r\n  execute immediate 'ALTER SESSION SET NLS_LANGUAGE = POLISH';\r\n  select user_id into auser_id from fnd_user where user_name = auser_name;\r\n  select responsibility_id, application_id\r\n    into aresponsibility_id, aapplication_id\r\n    from fnd_responsibility_tl\r\n   where language = userenv('lang')\r\n     and upper(responsibility_name) like upper(aresponsibility_name);\r\n  fnd_global.apps_initialize(auser_id, aresponsibility_id, aapplication_id);\r\n  begin\r\n    insert into fnd_sessions values (userenv('sessionid'), trunc(sysdate));\r\n  exception\r\n    when others then\r\n      null;\r\n  end;\r\n  commit;\r\nend;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Aby zobaczy\u0107 dane w niekt\u00f3rych widokach w bazie danych, nale\u017cy ustawi\u0107 odpowiedni kontekst organizacji. Jest to element funkcjonalno\u015bci Muli-org. R12 1) If you know the security_profile_id for that responsibility and user, you could call: mo_global.set_org_access(null, &lt;sp_id&gt;, 'PA&#8217;); Security profiles are &hellip; <a href=\"http:\/\/oracle.malin.pl\/?p=198\">Czytaj dalej <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[40,88],"tags":[225,170,226],"_links":{"self":[{"href":"http:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/posts\/198"}],"collection":[{"href":"http:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"http:\/\/oracle.malin.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=198"}],"version-history":[{"count":8,"href":"http:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/posts\/198\/revisions"}],"predecessor-version":[{"id":393,"href":"http:\/\/oracle.malin.pl\/index.php?rest_route=\/wp\/v2\/posts\/198\/revisions\/393"}],"wp:attachment":[{"href":"http:\/\/oracle.malin.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/oracle.malin.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=198"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/oracle.malin.pl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}