PROCEDURE set_global_info(
p_responsibility_id IN NUMBER := fnd_api.g_miss_num
, p_user_id IN NUMBER := fnd_api.g_miss_num
, p_resp_appl_id IN NUMBER := 275
, p_msg_count OUT NUMBER
, p_msg_data OUT VARCHAR2
, p_return_status OUT VARCHAR2
)
IS
l_api_name CONSTANT VARCHAR2(30) := 'Set_Global_Info';
l_value_conversion_error BOOLEAN := FALSE;
l_return_status VARCHAR2(1);
l_dummy VARCHAR2(1);
l_temp_num NUMBER;
CURSOR l_resp_csr
IS
SELECT 'x'
FROM fnd_responsibility
WHERE responsibility_id = p_responsibility_id
AND application_id = p_resp_appl_id;
CURSOR l_user_csr
IS
SELECT 'x'
FROM fnd_user
WHERE user_id = p_user_id;
l_resp_csr_rec l_resp_csr%ROWTYPE;
BEGIN
IF p_responsibility_id IS NULL
OR p_responsibility_id = fnd_api.g_miss_num
THEN
IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error)
THEN
-- Define the Custom message as XX_RESP_ID_REQD with
-- Description as "A valid responsibility is required."
fnd_message.set_name('XX_APPL_NAME', 'XX_RESP_ID_REQD');
fnd_msg_pub.ADD;
END IF;
RAISE fnd_api.g_exc_error;
END IF;
OPEN l_resp_csr;
FETCH l_resp_csr
INTO l_dummy;
IF l_resp_csr%NOTFOUND
THEN
IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error)
THEN
-- Define the Custom message as XX_RESP_ID_INVALID with
-- Description as "The specified responsibility is invalid."
fnd_message.set_name('XX_APPL_NAME', 'XX_RESP_ID_INVALID');
fnd_msg_pub.ADD;
END IF;
CLOSE l_resp_csr;
RAISE fnd_api.g_exc_error;
ELSE
CLOSE l_resp_csr;
END IF;
IF p_user_id IS NULL
OR p_user_id = fnd_api.g_miss_num
THEN
IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error)
THEN
-- Define the Custom message as XX_USER_ID_REQD with
-- Description as "A valid user ID is required."
fnd_message.set_name('XX_APPL_NAME', 'XX_USER_ID_REQD');
fnd_msg_pub.ADD;
END IF;
RAISE fnd_api.g_exc_error;
END IF;
OPEN l_user_csr;
FETCH l_user_csr
INTO l_dummy;
IF l_user_csr%NOTFOUND
THEN
IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error)
THEN
-- Define the Custom message as XX_USER_ID_REQD with
-- Description as "The specified user ID is invalid."
fnd_message.set_name('XX_APPL_NAME', 'XX_USER_ID_INVALID');
fnd_msg_pub.ADD;
END IF;
CLOSE l_user_csr;
RAISE fnd_api.g_exc_error;
ELSE
CLOSE l_user_csr;
END IF;
fnd_global.apps_initialize(user_id => p_user_id
, resp_id => p_responsibility_id
, resp_appl_id => p_resp_appl_id
);
EXCEPTION
WHEN fnd_api.g_exc_error
THEN
p_return_status := fnd_api.g_ret_sts_error;
fnd_msg_pub.count_and_get(p_count => p_msg_count,
p_data => p_msg_data);
WHEN fnd_api.g_exc_unexpected_error
THEN
p_return_status := fnd_api.g_ret_sts_unexp_error;
fnd_msg_pub.count_and_get(p_count => p_msg_count,
p_data => p_msg_data);
WHEN OTHERS
THEN
p_return_status := fnd_api.g_ret_sts_unexp_error;
IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
THEN
fnd_msg_pub.add_exc_msg(p_pkg_name => g_pkg_name, p_procedure_name => l_api_name);
END IF;
fnd_msg_pub.count_and_get(p_count => p_msg_count,
p_data => p_msg_data);
END set_global_info;
p_responsibility_id IN NUMBER := fnd_api.g_miss_num
, p_user_id IN NUMBER := fnd_api.g_miss_num
, p_resp_appl_id IN NUMBER := 275
, p_msg_count OUT NUMBER
, p_msg_data OUT VARCHAR2
, p_return_status OUT VARCHAR2
)
IS
l_api_name CONSTANT VARCHAR2(30) := 'Set_Global_Info';
l_value_conversion_error BOOLEAN := FALSE;
l_return_status VARCHAR2(1);
l_dummy VARCHAR2(1);
l_temp_num NUMBER;
CURSOR l_resp_csr
IS
SELECT 'x'
FROM fnd_responsibility
WHERE responsibility_id = p_responsibility_id
AND application_id = p_resp_appl_id;
CURSOR l_user_csr
IS
SELECT 'x'
FROM fnd_user
WHERE user_id = p_user_id;
l_resp_csr_rec l_resp_csr%ROWTYPE;
BEGIN
IF p_responsibility_id IS NULL
OR p_responsibility_id = fnd_api.g_miss_num
THEN
IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error)
THEN
-- Define the Custom message as XX_RESP_ID_REQD with
-- Description as "A valid responsibility is required."
fnd_message.set_name('XX_APPL_NAME', 'XX_RESP_ID_REQD');
fnd_msg_pub.ADD;
END IF;
RAISE fnd_api.g_exc_error;
END IF;
OPEN l_resp_csr;
FETCH l_resp_csr
INTO l_dummy;
IF l_resp_csr%NOTFOUND
THEN
IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error)
THEN
-- Define the Custom message as XX_RESP_ID_INVALID with
-- Description as "The specified responsibility is invalid."
fnd_message.set_name('XX_APPL_NAME', 'XX_RESP_ID_INVALID');
fnd_msg_pub.ADD;
END IF;
CLOSE l_resp_csr;
RAISE fnd_api.g_exc_error;
ELSE
CLOSE l_resp_csr;
END IF;
IF p_user_id IS NULL
OR p_user_id = fnd_api.g_miss_num
THEN
IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error)
THEN
-- Define the Custom message as XX_USER_ID_REQD with
-- Description as "A valid user ID is required."
fnd_message.set_name('XX_APPL_NAME', 'XX_USER_ID_REQD');
fnd_msg_pub.ADD;
END IF;
RAISE fnd_api.g_exc_error;
END IF;
OPEN l_user_csr;
FETCH l_user_csr
INTO l_dummy;
IF l_user_csr%NOTFOUND
THEN
IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error)
THEN
-- Define the Custom message as XX_USER_ID_REQD with
-- Description as "The specified user ID is invalid."
fnd_message.set_name('XX_APPL_NAME', 'XX_USER_ID_INVALID');
fnd_msg_pub.ADD;
END IF;
CLOSE l_user_csr;
RAISE fnd_api.g_exc_error;
ELSE
CLOSE l_user_csr;
END IF;
fnd_global.apps_initialize(user_id => p_user_id
, resp_id => p_responsibility_id
, resp_appl_id => p_resp_appl_id
);
EXCEPTION
WHEN fnd_api.g_exc_error
THEN
p_return_status := fnd_api.g_ret_sts_error;
fnd_msg_pub.count_and_get(p_count => p_msg_count,
p_data => p_msg_data);
WHEN fnd_api.g_exc_unexpected_error
THEN
p_return_status := fnd_api.g_ret_sts_unexp_error;
fnd_msg_pub.count_and_get(p_count => p_msg_count,
p_data => p_msg_data);
WHEN OTHERS
THEN
p_return_status := fnd_api.g_ret_sts_unexp_error;
IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
THEN
fnd_msg_pub.add_exc_msg(p_pkg_name => g_pkg_name, p_procedure_name => l_api_name);
END IF;
fnd_msg_pub.count_and_get(p_count => p_msg_count,
p_data => p_msg_data);
END set_global_info;
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.