当前位置:网站首页>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
边栏推荐
- php中计算树状结构数据中的合计
- ssm+mysql实现进销存系统
- Recursion (maze problem, Queen 8 problem)
- SQL injection closure judgment
- Oracle EBS数据库监控-Zabbix+zabbix-agent2+orabbix
- php中根据数字月份返回月份的英文缩写
- 2021-07-05c /cad secondary development create arc (4)
- Anti shake and throttling of JS
- CRP实施方法论
- How to debug wechat built-in browser applications (enterprise number, official account, subscription number)
猜你喜欢

flex九宫格布局

SSM学生成绩信息管理系统

CVE-2015-1635(MS15-034 )远程代码执行漏洞复现

In depth study of JVM bottom layer (V): class loading mechanism

Solve the problem of bindchange event jitter of swiper component of wechat applet

PHP Session原理简析

Proteus -- RS-232 dual computer communication

DNS attack details

在php的开发环境中如何调取WebService?

sqli-labs通关汇总-page1
随机推荐
JS to determine whether there is a value in the object in the array
js删除字符串的最后一个字符
ARP attack
Oracle EBS interface development - quick generation of JSON format data
JS create a custom JSON array
flex九宫格布局
Explain in detail the process of realizing Chinese text classification by CNN
JS delete the last bit of the string
php中判断版本号是否连续
ORACLE EBS ADI 开发步骤
Sqli labs customs clearance summary-page3
SQLI-LABS通关(less1)
IDEA2020中PySpark的两表关联(字段名相同)
SQLI-LABS通关(less6-less14)
sqli-labs通关汇总-page2
Explanation and application of annotation and reflection
Code execution sequence with and without resolve in promise
Sqli-labs customs clearance (less2-less5)
ssm垃圾分类管理系统
Sqli-labs customs clearance (less1)