OM: Good informational package in OM: OE_MSG_PUB

Last week I started to working on an order import pragram. A sample program in our live system does similar thing but it has no price adjustment etc. To have more information when importing the order, I tried the oe_debug_pub using following code:

 

        IF g_debug_flag = 'Y' THEN
          oe_debug_pub.initialize;
          oe_debug_pub.debug_on;
          l_debug_file := oe_debug_pub.set_debug_mode('CONC');
          oe_debug_pub.setdebuglevel(5);
          --wsh_util_core.Enable_Concurrent_Log_Print;
          --wsh_util_core.Set_Log_Level(4);
        END IF;
        

         process_order;

 

        IF g_debug_flag = 'Y' THEN
          l_msg_count := oe_debug_pub.countdebug;
          FOR i IN 1..l_msg_count LOOP
            oe_debug_pub.getnext(l_err_msg);
            log(l_err_msg);
          END LOOP;
        END IF;

 

 

But the output msg is really ugly and maybe only readable to Oracle Dev guys or support guys. After going through the code in OE_ORDER_PVT etc, I noticed when there are some validation exceptions, it will use OE_MSG_PUB.add like following:

 

FND_MESSAGE.SET_NAME('ONT','OE_API_INV_PARENT_INDEX');
FND_MESSAGE.SET_TOKEN('ENTITY_NAME','Header_Adj_Attribs');
FND_MESSAGE.SET_TOKEN('ENTITY_INDEX',I);
FND_MESSAGE.SET_TOKEN('PARENT_INDEX',p_x_header_adj_att_tbl(I).adj_index);
OE_MSG_PUB.Add;

This set the message and tokens in message, then it will add the message to OE_MSG_PUB message stack. So I tried to use following in my code:

 

        IF x_msg_count > 0 THEN
          FOR i IN 1..x_msg_count LOOP  --here x_msg_count  is the x_msg_count  in process_order api
            l_err_msg := oe_msg_pub.get(p_msg_index => i, p_encoded => 'F');
            log(l_err_msg);
          END LOOP;
        END IF;

Well, in my log file , it display neatly the exception message I want , just similar to those displayed in "Order Import Child Req1 (Order Import)" child request spawned by "Order Import" program. And most importantly, it's readable and user friendly.

 

Later, I remember that I used this in processing constraint API, defaulting rule  and workflow program to add msg into OM message stack and it can display message in custom API even in front end UI.

 

So to be informational in OM, never forget to use OE_MSG_PUB.ADDOrder Import

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值