Form_通过Custom.pll新增菜单项(案例)

2014-05-31 Created By BaoXinjian

一、摘要


custom.pll 一个每次form启动时都会调用的pll包,因此有些对标准form的客制化可以在custom.pll中实现

个人感觉和form个性化有类似性,区别是form个性化通过设定去设定,而custom.pll通过代码中实现

而且对custom.pll的修改会影响所有的form调用,所以对代码的可控性和效率要求比较高

而Form的个性化,影响的定义有function level 和 form level,所以只对所设定的function或form产生印象,修改存在问题,不会影响所有的form

其他引用了网络定义

  • custom.pll是EBS标准的一个library,当系统启动的时候会加载这个library。
  • 很多时候,我们会需要写一些pll文件,比如控制Form上某些item的属性,如果是控制标准Form的某些属性,那么我们就可以通过Library来实现,而不用去动标准的Form(一般我们建议不去修改标准的Form)。再比如在工具条上增加一些菜单,等等。
  • 当然,所有这些我们都可以通过直接修改custom.pll来实现,但是,我们不建议这么做,我们可以copy custom.pll重命名为:xx_cn_custom.pll (名字自己取),然后把xx_cn_custom.pll加载到custom.pll下 (在custom.pll的event里,加上这段代码即可:xx_cn_custom.event;),这样,系统启动的时候就会通过custom.pll也把xx_cn_custom.pll启动起来,那么,以后有什么客户化的library都可以在xx_cn_custom.pll里面修改了。比如,我客户化了一个叫xx_wip_custom.pll的library,那么我只要在xx_cn_custom.pll的event的procedure里加上:xx_wip_custom.event;就可以了。
  • 这样做的好处就是降低了风险,因为custom.pll是标准的library,不管是调试还是其它的,都会影响到全局,当我们加载xx_cn_custom.pll之后,就会避免这些问题。

 

二、案例


需求:用户要求在EBS 日记账功能菜单项中添加一个按钮

1. 下载Custom.pll文件至本地

2. 新增bxjcustom.pll文件,并添加procedure<bxj_pll_event_event>

3. 将bxj_custom.pll添加至custom.pll

4. 编译custom.pll至server上

 

三、案列测试


Test1. 打开Form后触发Custom.pll

Test2.新增Special

Test3. 点击Button,触发Button下的tigger

 

四、其他


1. 编译错误,先编译sub pll,后编译parater pll

2. 其他修改pll的例子,去form中的值,调用fnd_request打印报表

 1 PROCEDURE event (event_name VARCHAR2)  IS
 2    form_name VARCHAR2 (30) := NAME_IN ('system.current_form');
 3     block_name VARCHAR2 (30) := NAME_IN ('system.cursor_block');
 4 BEGIN
 5     IF event_name = 'CALL_CUSTOM_EVENT' THEN
 6         IF (form_name = 'APXINWKB' AND block_name = 'INV_SUM_FOLDER')    THEN
 7             DECLARE
 8                 l_group_name VARCHAR2 (60) := block_name || '_MULTI';
 9                 l_rec_group_id recordgroup;
10                 l_curr_rec_num NUMBER;
11                 l_num_records NUMBER;
12                 l_invoice_id_str VARCHAR2 (2000);
13                 l_curr_record NUMBER;
14                 l_success BOOLEAN;
15                 l_request_number NUMBER;
16                 e_check_error_exception exception;
17             BEGIN
18                 -- 获取选中的invoice
19                 l_rec_group_id := FIND_GROUP (block_name || '_MULTI');
20                 IF NOT ID_NULL (l_rec_group_id) THEN
21                     l_num_records := GET_GROUP_ROW_COUNT (FIND_GROUP (l_group_name));
22                     IF l_num_records > 0 THEN
23                         l_invoice_id_str := NULL;
24                         -- 对选中的记录进行循环
25                         FOR i IN 1 .. l_num_records LOOP
26                             l_curr_rec_num := GET_GROUP_NUMBER_CELL (l_group_name || '.REC_NUM', i);
27                             GO_RECORD (l_curr_rec_num);
28                             -- 组合invoice id作为请求参数
29                             IF l_invoice_id_str IS NULL THEN
30                                 l_invoice_id_str := NAME_IN (block_name || '.INVOICE_ID');
31                             ELSE
32                                 l_invoice_id_str := l_invoice_id_str || ',' || NAME_IN (block_name || '.INVOICE_ID');
33                             END IF;
34                         END LOOP;
35                     IF l_invoice_id_str IS NOT NULL THEN
36                         l_invoice_id_str := '(' || l_invoice_id_str || ')';
37                         -- 加载模板
38                         l_success := fnd_request.add_layout ('XXBG', 'XXBGREQP','zh','CN','PDF');
39                         IF l_success THEN
40                             -- 设置请求的业务实体
41                             fnd_request.set_org_id (l_org_id);
42                             -- 提交打印付款申请请求
43                             l_request_number := fnd_request.submit_request ('XXBG', 'XXBGREQP',   '','',FALSE,l_invoice_id_str,CHR (0),'','');
44                             IF l_request_number = 0 THEN
45                                 fnd_message.retrieve;
46                                 fnd_message.error;
47                             ELSE
48                                 IF app_form.quietcommit THEN
49                                     fnd_message.set_name ('SQLGL','GL_REQUEST_SUBMITTED');
50                                     fnd_message.set_TOKEN ('REQUEST_ID',TO_CHAR (l_request_number),FALSE);
51                                     fnd_message.show;
52                                 END IF;
53                                 -- 弹出请求窗口
54                                 fnd_function.execute (function_name => 'FND_FNDRSRUN',open_flag => 'Y',session_flag => 'Y',other_params => 'DODT_REQ_ID="'|| TO_CHAR (l_request_number)|| '"');
55                             END IF;
56                         END IF;
57                     END IF;
58                 GO_RECORD (l_curr_record);
59             ELSE
60                 fnd_message.set_name ('', 'Please select one record');
61                 RAISE e_check_error_exception;
62             END IF;
63         END IF;
64              EXCEPTION  WHEN e_check_error_exception THEN
65              fnd_message.error;
66              RAISE form_trigger_failure;
67         END;
68    END IF;
69 END IF;
70 END event; 
View Code

 

Thanks and Regards


posted on 2014-06-19 16:33  东方瀚海  阅读(1124)  评论(1编辑  收藏  举报