Documente Academic
Documente Profesional
Documente Cultură
PACKAGE "FND_CLIENT_INFO" as
/* $Header: AFCINFOS.pls 120.1.12000000.3 2007/04/17 14:05:14 pdeluna ship $ */
--
-- This package-level pragma means that the initialization section of this
--
-- Arguments
-- application_id
-- responsibility_id
-- user_id
-- security_group_id
-- org_id
--
procedure setup_client_info(application_id in number,
responsibility_id in number,
user_id in number,
security_group_id in number,
org_id in number);
--
-- Name
-- setup_client_info
-- Purpose
-- Sets up the operating unit context and the Multi-Currency context
-- in the client info area based on the current application,
-- responsibility, user, and security_group.
-- security_group_id
--
procedure setup_client_info(application_id in number,
responsibility_id in number,
user_id in number,
security_group_id in number);
--
-- Name
-- set_org_context
-- Purpose
-- Sets up the operating unit context in the client info area
--
-- Arguments
-- Name
-- set_currency_context
-- Purpose
-- Sets up the client info area for Multi-Currency reporting
--
-- Arguments
-- context - context information up to 10 bytes
--
procedure set_currency_context (context in varchar2);
--
-- Name
-- set_security_group_context
-- Purpose
-- Sets up the the security group context in the client info area
--
-- Arguments
-- context - security_group_id; can be up to 10 bytes long
--
procedure set_security_group_context (context in varchar2);
--
-- Name
-- org_security
-- Purpose
-- Called by oracle server during parsing sql statment
--
-- Arguments
-- obj_schema - schema of the object
-- obj_name - name of the object
--
FUNCTION org_security(
obj_schema VARCHAR2
, obj_name VARCHAR2
)
RETURN VARCHAR2;
end fnd_client_info;
PACKAGE BODY "FND_CLIENT_INFO" as
/* $Header: AFCINFOB.pls 120.2.12000000.6 2007/12/06 01:59:49 pdeluna ship $ */
--
-- Private Functions and Procedures
--
procedure generic_error(routine in varchar2,
errcode in number,
errmsg in varchar2) is
begin
fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
fnd_message.set_token('ROUTINE', routine);
fnd_message.set_token('ERRNO', errcode);
fnd_message.set_token('REASON', dbms_utility.format_error_stack);
-- dbms_output.put_line(fnd_message.get);
fnd_message.raise_error;
end;
--
-- Public Functions and Procedures
--
--
-- Name
-- setup_client_info
-- Purpose
-- Sets up the operating unit context and the Multi-Currency context
-- in the client info area based on the current application,
-- responsibility, user, security_group and organization.
--
-- Arguments
-- application_id
-- responsibility_id
-- user_id
-- security_group_id
-- org_id
--
procedure setup_client_info(application_id in number,
responsibility_id in number,
user_id in number,
security_group_id in number,
org_id in number) is
org_id_char varchar2(240);
org_id_defined boolean;
sp_id_char varchar2(240);
sp_id_defined boolean;
is_multi_org varchar2(1);
no_morg_profile_value exception;
reporting_sob_id_char varchar2(240);
reporting_sob_id_defined boolean;
is_multi_currency varchar2(1);
no_mcur_profile_value exception;
security_profile_id_char varchar2(240);
-- security_profile_id_defined boolean;
l_security_profile_id NUMBER;
l_morg_profile_name varchar2(240);
begin
/* Bug 5646892: APPSPERFR12:FND:EXTRA FND_PROFILE.GET_SPECIFIC CALL IN
FND_CLIENT_INFO.SETUP_CLIENT_INFO
FND_GLOBAL will now pass in the org_id context, i.e. FND_GLOBAL.org_id.
There is no need for setup_client_info to get the ORG_ID value again.
*/
--
-- setup_client_info was that it did not check the value, but rather whether a
-- value was defined.
if (org_id is NULL) or (org_id = -1) then
-- If not R12, then check if the instance is multiorg-enabled.
if fnd_release.major_version < 12 then
-- Check FND_PRODUCT_GROUPS for multi-org/currency flags
make sure that org_id is, indeed, not set. Need to make sure before
the error is raised. This should not undo the fix for 5646892
completely and is needed.
*/
fnd_profile.get_specific('ORG_ID', user_id, responsibility_id,
application_id, org_id_char, org_id_defined);
-- If org_id is really not defined, then raise the exception, as
-- planned.
if (not org_id_defined) then
select user_profile_option_name
into l_morg_profile_name
from fnd_profile_options_vl
where profile_option_name = 'ORG_ID';
raise no_morg_profile_value;
end if;
end if;
else
org_id_char := to_char(org_id);
end if;
fnd_client_info.set_org_context(org_id_char);
--
--
fnd_profile.get_specific('MRC_REPORTING_SOB_ID',
user_id, responsibility_id, application_id,
reporting_sob_id_char, reporting_sob_id_defined
);
--
-- If MRC_REPORTING_SOB_ID profile option defined for this responsibility,
fnd_client_info.set_security_group_context(to_char(security_group_id));
exception
when no_morg_profile_value then
fnd_message.set_name('FND', 'FND-ORG_ID PROFILE CANNOT READ');
fnd_message.set_token('OPTION', l_morg_profile_name);
-- dbms_output.put_line(fnd_message.get);
fnd_message.raise_error;
-- generic_error('FND_CLIENT_INFO.SETUP_CLIENT_INFO', -20000,
-- 'MultiOrg enabled but ORG_ID profile not defined');
when no_mcur_profile_value then
generic_error('FND_CLIENT_INFO.SETUP_CLIENT_INFO', -20000,
'MultiCurrency enabled but MRC_REPORTING_SOB_ID profile not defined');
-- setup_client_info
-- Purpose
-- Sets up the operating unit context and the Multi-Currency context
-- in the client info area based on the current application,
-- responsibility, user, and security_group.
-- This is an overloaded version for backwards compatibility.
--
-- Arguments
-- application_id
-- responsibility_id
-- user_id
-- security_group_id
--
-- org argument.
setup_client_info(application_id, responsibility_id, user_id,
security_group_id, fnd_global.org_id);
end setup_client_info;
--
-- Name
-- set_org_context
-- Purpose
-- Sets up the operating unit context in the client info area
--
-- Arguments
local_context varchar2(30);
begin
-- check for multibyte characters
if length(context) <> lengthb(context) then
raise bad_characters;
end if;
-- check for input string too long
if lengthb(context) > 10 then
raise context_too_long;
end if;
-- set local_context to first ten chars of context
-- set to a single space if context was null
local_context := substrb(nvl(context,' '),1,10);
-- pad local_context on the right with blanks to exactly 10 bytes
-- Do not use RPAD(), because it may not work as expected with a
-- MultiByte character set
while lengthb(local_context) < 10 loop
local_context := local_context || ' ';
end loop;
-- Get current CLIENT_INFO value in context_area variable
dbms_application_info.read_client_info(context_area);
-- pad context_area on the right with blanks to exactly 64 bytes
end loop;
-- load new value into context_area
context_area := local_context ||
substrb(context_area,11,54);
-- save context_area variable to CLIENT_INFO
dbms_application_info.set_client_info(context_area);
exception
when context_too_long then
fnd_message.set_name('FND', 'CLIENT_INFO_ARG_TOO_LONG');
fnd_message.set_token('ROUTINE', 'SET_ORG_CONTEXT');
fnd_message.set_token('BAD_ARG', context);
-- dbms_output.put_line(fnd_message.get);
fnd_message.raise_error;
when bad_characters then
generic_error('FND_CLIENT_INFO.SET_ORG_CONTEXT', -20000,
begin
-- check for multibyte characters
if length(context) <> lengthb(context) then
raise bad_characters;
end if;
-- check for input string too long
if lengthb(context) > 10 then
raise context_too_long;
end if;
-- set local_context to first ten chars of context
-- set to a single space if context was null
local_context := substrb(nvl(context,' '),1,10);
-- pad local_context on the right with blanks to exactly 10 bytes
fnd_message.set_name('FND', 'CLIENT_INFO_ARG_TOO_LONG');
fnd_message.set_token('ROUTINE', 'SET_CURRENCY_CONTEXT');
fnd_message.set_token('BAD_ARG', context);
-- dbms_output.put_line(fnd_message.get);
fnd_message.raise_error;
when bad_characters then
generic_error('FND_CLIENT_INFO.SET_CURRENCY_CONTEXT', -20000,
begin
-- check for multibyte characters
if length(context) <> lengthb(context) then
raise bad_characters;
end if;
-- check for input string too long
if lengthb(context) > 10 then
raise context_too_long;
end if;
-- set local_context to first ten chars of context
-- set to a single space if context was null
local_context := substrb(nvl(context,' '),1,10);
-- pad local_context on the right with blanks to exactly 10 bytes
fnd_message.set_token('BAD_ARG', context);
-- dbms_output.put_line(fnd_message.get);
fnd_message.raise_error;
when bad_characters then
generic_error('FND_CLIENT_INFO.SET_SECURITY_GROUP_CONTEXT', -20000,
'Only single-byte characters are valid input');
when others then
generic_error('FND_CLIENT_INFO.SET_SECURITY_GROUP_CONTEXT',
sqlcode, sqlerrm);
end set_security_group_context;
--
-- Name
-- org_security
-- Purpose
-- Called by oracle server during parsing sql statment
--
-- Arguments
-- obj_schema - schema of the object
-- obj_name - name of the object
--
FUNCTION org_security(
obj_schema VARCHAR2
, obj_name VARCHAR2
)
RETURN VARCHAR2
IS
-- AOL suggested that all product-specific logic should be moved to
-- product-specific packages. Hence, the org_security logic is moved
-- to the new package MO_GLOBAL.
--
-- However, FND_CLIENT_INFO.org_security is referenced in many CRM
fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
fnd_message.set_token('ERRNO', to_char(sqlcode));
fnd_message.set_token('REASON', dbms_utility.format_error_stack);
fnd_message.set_token('ROUTINE', 'ORG_SECURITY');
app_exception.raise_exception;
END org_security;
end fnd_client_info;