当前位置:网站首页>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 create a custom JSON array
- JS countdown case
- Underlying mechanism mvcc
- UEditor .Net版本任意文件上传漏洞复现
- Sqli labs customs clearance summary-page2
- Take you to master the formatter of visual studio code
- Pyspark build temporary report error
- Common prototype methods of JS array
- Redis -- cache breakdown, penetration, avalanche
- ORACLE EBS DATAGUARD 搭建
猜你喜欢
Cve-2015-1635 (ms15-034) Remote Code Execution Vulnerability recurrence
ORACLE EBS中消息队列fnd_msg_pub、fnd_message在PL/SQL中的应用
SQLI-LABS通关(less2-less5)
Ceaspectuss shipping company shipping artificial intelligence products, anytime, anywhere container inspection and reporting to achieve cloud yard, shipping company intelligent digital container contr
[Zhang San learns C language] - deeply understand data storage
MapReduce concepts and cases (Shang Silicon Valley Learning Notes)
sqli-labs通关汇总-page4
Check log4j problems using stain analysis
Basic knowledge of software testing
User login function: simple but difficult
随机推荐
[daily question] - Huawei machine test 01
CAD secondary development object
php中获取汉字拼音大写首字母
js把一个数组分割成每三个一组
ORACLE APEX 21.2安裝及一鍵部署
Network security -- intrusion detection of emergency response
TCP attack
Pyspark build temporary report error
Differences between ts and JS
Uniapp introduces local fonts
Code execution sequence with and without resolve in promise
[Zhang San learns C language] - deeply understand data storage
Oracle APEX 21.2 installation et déploiement en une seule touche
User login function: simple but difficult
ORACLE EBS DATAGUARD 搭建
Oracle段顾问、怎么处理行链接行迁移、降低高水位
MapReduce concepts and cases (Shang Silicon Valley Learning Notes)
js判断对象是否为空
2021-07-17c /cad secondary development creation circle (5)
JS divides an array into groups of three