当前位置:网站首页>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
边栏推荐
- js删除字符串的最后一个字符
- Analysis of MapReduce and yarn principles
- ORACLE APEX 21.2安装及一键部署
- Only the background of famous universities and factories can programmers have a way out? Netizen: two, big factory background is OK
- 数仓模型事实表模型设计
- RMAN incremental recovery example (1) - without unbacked archive logs
- php中时间戳转换为毫秒以及格式化时间
- In depth study of JVM bottom layer (IV): class file structure
- In depth study of JVM bottom layer (II): hotspot virtual machine object
- Recursion (maze problem, Queen 8 problem)
猜你喜欢
随机推荐
ORACLE EBS中消息队列fnd_msg_pub、fnd_message在PL/SQL中的应用
Go common compilation fails
2021-07-05C#/CAD二次开发创建圆弧(4)
Analysis of MapReduce and yarn principles
工具种草福利帖
Code execution sequence with and without resolve in promise
php中计算两个日期之前相差多少天、月、年
SSM学生成绩信息管理系统
How to debug wechat built-in browser applications (enterprise number, official account, subscription number)
2021-07-17c /cad secondary development creation circle (5)
Sqli-labs customs clearance (less1)
In depth study of JVM bottom layer (II): hotspot virtual machine object
SQLI-LABS通关(less6-less14)
Pyspark build temporary report error
SQLI-LABS通关(less1)
Check log4j problems using stain analysis
Queue (linear structure)
Build FRP for intranet penetration
js创建一个自定义json数组
js判断数组中对象是否存在某个值