当前位置:网站首页>Message queue fnd in Oracle EBS_ msg_ pub、fnd_ Application of message in pl/sql
Message queue fnd in Oracle EBS_ msg_ pub、fnd_ Application of message in pl/sql
2022-07-02 07:11:00 【Virtuous time】
EBS Integrated in FND_MSG It is easy to handle in form A very convenient pop-up window 、 Beyond prompt message , Writing PL/SQL When the package , It can also be easily borrowed to collect error information . And this is based on session Of , Different from customized log Log table .
Principle and usage instructions
picture 1(IBY_UNIQ_ACCOUNT):
picture 2(AFDICT- DATABASE STATS):
The sample code :
DECLARE
x_msg_count NUMBER;
x_msg_data VARCHAR2(3000);
v_msg_index_out NUMBER;
v_data VARCHAR2(1000);
BEGIN
fnd_msg_pub.Initialize;-- perhaps fnd_message.CLEAR;
fnd_message.set_name('IBY', 'IBY_UNIQ_ACCOUNT'); -- Set the message name
fnd_msg_pub.add; -- Add to Global Area
fnd_message.set_name('FND', 'AFDICT- DATABASE STATS'); -- Set the message name
fnd_message.set_token('UPDATES', 'Steven123'); -- Set the value of the variable in the message content
fnd_message.set_token('INSERTS', 'Steven321'); -- Set the value of the variable in the message content
fnd_msg_pub.add; -- Add to Global Area
-- When x_msg_count by 1 when , Direct output x_msg_data, Otherwise, you need to cycle the output
fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => x_msg_data);
dbms_output.put_line('x_msg_count:' || x_msg_count);
dbms_output.put_line('x_msg_data:' || x_msg_data);
FOR k IN 1 .. x_msg_count
LOOP
fnd_msg_pub.get(p_msg_index => k,
p_encoded => fnd_api.g_false,
p_data => v_data,
p_msg_index_out => v_msg_index_out);
dbms_output.put_line('(' || v_msg_index_out || ')->' || v_data);
END LOOP;
fnd_msg_pub.delete_msg();
END;
Output information :
x_msg_count:2
x_msg_data:
(1)-> External bank account already exists
(2)-> Updated Steven123 Information , And inserted Steven321 Information .
You can see that from the top fnd_message.set_name(APPLICATION => , NAME => ); The first parameter in this process is to fill in the application abbreviation , The first 2 Fill in the predefined error message code .
fnd_message.set_token(‘UPDATES’, ‘Steven123’) Is to define the message &XXX Replace with the actual value .
Secondary encapsulation of stored procedures
The following stored procedure is usually used for output :
PROCEDURE log_message_list_p IS
l_msg_index NUMBER;
l_msg_data VARCHAR2(2000);
------------------------------- Output messages in the message queue -----------------------
BEGIN
IF (fnd_msg_pub.count_msg > 0) THEN
log_p('Error Message Stack :');
log_p('----------------------------------------');
FOR i IN 1 .. fnd_msg_pub.count_msg LOOP
fnd_msg_pub.get(p_msg_index => i,
p_encoded => fnd_api.g_false,
p_data => l_msg_data,
p_msg_index_out => l_msg_index);
log_p(l_msg_data);
END LOOP;
log_p('format_error_stack:' || chr(10) ||
dbms_utility.format_error_stack);
log_p('format_call_stack:' || chr(10) ||
dbms_utility.format_call_stack);
log_p('format_error_backtrace:' || chr(10) ||
dbms_utility.format_error_backtrace);
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END log_message_list_p;
Application in request
If used EBS Words in the request , It can also be used in this way :
PROCEDURE main_p(errbuf OUT VARCHAR2,
retcode OUT VARCHAR2,
p_period_num_from IN VARCHAR2,
p_period_num_to IN VARCHAR2) IS
l_return_status VARCHAR2(30);
l_msg_data VARCHAR2(2000);
l_msg_count NUMBER;
------------------------------ Call the output program ------------------
BEGIN
retcode := '0';
--............................
-- Business processing logic code XXXXX
-- Call standard API
--...........................
EXCEPTION
WHEN fnd_api.g_exc_error THEN
log_message_list_p;
retcode := '1';
fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
p_count => l_msg_count,
p_data => l_msg_data);
IF l_msg_count > 1 THEN
l_msg_data := fnd_msg_pub.get_detail(p_msg_index => fnd_msg_pub.g_first,
p_encoded => fnd_api.g_false);
END IF;
errbuf := l_msg_data;
WHEN fnd_api.g_exc_unexpected_error THEN
log_message_list_p;
retcode := '2';
fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
p_count => l_msg_count,
p_data => l_msg_data);
IF l_msg_count > 1 THEN
l_msg_data := fnd_msg_pub.get_detail(p_msg_index => fnd_msg_pub.g_first,
p_encoded => fnd_api.g_false);
END IF;
errbuf := l_msg_data;
WHEN OTHERS THEN
log_p(dbms_utility.format_error_stack ||
dbms_utility.format_error_backtrace);
fnd_msg_pub.add_exc_msg(p_pkg_name => g_pkg_name,
p_procedure_name => 'MAIN_P',
p_error_text => substrb(SQLERRM, 1, 240));
log_message_list_p;
retcode := '2';
errbuf := SQLERRM;
END main_p;
Reference material
http://blog.itpub.net/25684327/viewspace-694126/
https://imdjkoch.wordpress.com/tag/fnd_message-set_token/
https://docs.oracle.com/cd/E18727_01/doc.121/e12897/T302934T462354.htm
边栏推荐
- CSRF attack
- Flex Jiugongge layout
- Build FRP for intranet penetration
- How to debug wechat built-in browser applications (enterprise number, official account, subscription number)
- ARP攻击
- Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
- SQLI-LABS通关(less15-less17)
- ssm+mysql实现进销存系统
- sqli-labs通关汇总-page4
- Sqli labs customs clearance summary-page3
猜你喜欢
随机推荐
MapReduce与YARN原理解析
Sqli Labs clearance summary - page 2
在php的开发环境中如何调取WebService?
TCP攻击
Sqli-labs customs clearance (less18-less20)
ORACLE EBS接口开发-json格式数据快捷生成
Cloud picture says | distributed transaction management DTM: the little helper behind "buy buy buy"
js判断对象是否为空
js判断数组中对象是否存在某个值
图解Kubernetes中的etcd的访问
Oracle apex 21.2 installation and one click deployment
ssm超市订单管理系统
SSM学生成绩信息管理系统
Brief analysis of PHP session principle
ORACLE EBS中消息队列fnd_msg_pub、fnd_message在PL/SQL中的应用
js删除字符串的最后一个字符
Common prototype methods of JS array
ORACLE EBS ADI 开发步骤
Underlying mechanism mvcc
CSRF攻击