当前位置:网站首页>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
边栏推荐
猜你喜欢

SQLI-LABS通关(less1)

IDEA2020中测试PySpark的运行出错

DNS攻击详解

SSM学生成绩信息管理系统

CVE-2015-1635(MS15-034 )遠程代碼執行漏洞複現

Explanation and application of annotation and reflection

PHP Session原理简析

In depth study of JVM bottom layer (3): garbage collector and memory allocation strategy

Sqli-labs customs clearance (less18-less20)

外币记账及重估总账余额表变化(下)
随机推荐
oracle apex ajax process + dy 校验
TCP攻击
php中判断版本号是否连续
Oracle EBS database monitoring -zabbix+zabbix-agent2+orabbix
SSM学生成绩信息管理系统
Explanation of suffix of Oracle EBS standard table
ORACLE APEX 21.2安装及一键部署
Queue (linear structure)
CAD secondary development object
ssm垃圾分类管理系统
sqli-labs通关汇总-page4
Thinkphp5中一个字段对应多个模糊查询
PXC high availability cluster summary
Oracle 11g sysaux table space full processing and the difference between move and shrink
Oracle段顾问、怎么处理行链接行迁移、降低高水位
Proteus -- RS-232 dual computer communication
Sentry construction and use
TCP attack
JS countdown case
Oracle apex 21.2 installation and one click deployment