ITPub博客

首页 > 数据库 > Oracle > Call Customer.PLL

Call Customer.PLL

原创 Oracle 作者:zlmself 时间:2015-09-25 17:55:01 0 删除 编辑

需求:PO发放界面,原有的菜单【查看文档】,标准输出的报表及数据源XML无法明细到Distribution。

解决思路:客制明细报表,并挂请求,PO发放界面,利用个性化,新增一个菜单项【查看文档-客制】,该菜单项来执行请求并将请求结果自动呈现给用户。

  Form 个性化中,内置的Action提供一种名为:“调用自定义程序库”,其实就是CUSTOM.pll,这个文件。

 当项目中不允许需改标准Form,且利用个性化又无法达到需求目的的时候,CUSTOM.pll,就是个很好的帮手。灵活性很大,但是也有缺点。缺点后面再说。

1.下载CUSTOM.pll文件。

用FTP工具,切换到路径$AU_TOP/resource/目录下,并下载CUSTOM.pll.


2.编辑CUSTOM.pll,新增自己的CODE。

用Form Builder打开CUSTOM.pll文件

此处需要注意的是,CUSTOM.pll其实就是一个package,Event就是自定义程序库的入口程序,其Event_Name的参数就是,个性化的中设置的变元。

建议呢!每个自定义代码都加上加上作者的注释,包括作者、用途、及时间。

Add new code


  1.  Procedure Run_Blanket_Release_Pdf Is  
  2.     v_Po_Header_Id      Number(30) := Name_In('PO_RELEASES.PO_HEADER_ID');  
  3.     v_Release_Id        Number(30) := Name_In('PO_RELEASES.PO_RELEASE_ID');  
  4.     v_Org_Id            Number(30) := Name_In('PO_RELEASES.ORG_ID');  
  5.     l_Request_Id        Number;  
  6.     l_Bl_Result         Boolean;  
  7.     v_Layout            Boolean;  
  8.     x_Phase             Varchar2(100);  
  9.     x_Status            Varchar2(100);  
  10.     x_Dev_Phase         Varchar2(100);  
  11.     x_Dev_Status        Varchar2(100);  
  12.     x_Message           Varchar2(100);  
  13.     v_Template          Varchar2(100);  
  14.     v_Organization_Code Varchar2(10);  
  15.   Begin  
  16.     If v_Org_Id Is Not Null Then  
  17.       Begin  
  18.         Select Organization_Code  
  19.           Into v_Organization_Code  
  20.           From Org_Organization_Definitions t  
  21.          Where t.Operating_Unit = v_Org_Id;  
  22.       Exception  
  23.         When Others Then  
  24.           Fnd_Message.Set_String('异常错误,报表输出失败!');  
  25.           Fnd_Message.Error;  
  26.           Return;  
  27.       End;  
  28.     End If;  
  29.   
  30.     If v_Organization_Code = 'SZ' Then  
  31.       v_Template := 'CUXPOR046_BLK_REL_SZ';  
  32.     Else  
  33.       v_Template := 'CUXPOR046_BLK_REL_TS';  
  34.     End If;  
  35.     
  36.     v_Layout := Fnd_Request.Add_Layout('PO'  
  37.                                       ,v_Template  
  38.                                       ,Null  
  39.                                       ,Null  
  40.                                       ,'PDF');  
  41.     
  42.     l_Request_Id := Fnd_Request.Submit_Request('PO'  
  43.                                               ,'CUXPOR046_BLK'  
  44.                                               ,''  
  45.                                               ,''  
  46.                                               ,False  
  47.                                               ,v_Po_Header_Id  
  48.                                               ,v_Release_Id  
  49.                                               ,''  
  50.                                               ,Chr(0)  
  51.                                               ,''  
  52.                                               ,''  
  53.                                               ,''  
  54.                                               ,''  
  55.                                               ,''  
  56.                                               ,''  
  57.                                               ,''  
  58.                                               ,''  
  59.                                               ,''  
  60.                                               ,''  
  61.                                               ,''  
  62.                                               ,''  
  63.                                               ,''  
  64.                                               ,''  
  65.                                               ,''  
  66.                                               ,''  
  67.                                               ,''  
  68.                                               ,''  
  69.                                               ,''  
  70.                                               ,''  
  71.                                               ,''  
  72.                                               ,''  
  73.                                               ,''  
  74.                                               ,''  
  75.                                               ,''  
  76.                                               ,''  
  77.                                               ,''  
  78.                                               ,''  
  79.                                               ,''  
  80.                                               ,''  
  81.                                               ,''  
  82.                                               ,''  
  83.                                               ,''  
  84.                                               ,''  
  85.                                               ,''  
  86.                                               ,''  
  87.                                               ,''  
  88.                                               ,''  
  89.                                               ,''  
  90.                                               ,''  
  91.                                               ,''  
  92.                                               ,''  
  93.                                               ,''  
  94.                                               ,''  
  95.                                               ,''  
  96.                                               ,''  
  97.                                               ,''  
  98.                                               ,''  
  99.                                               ,''  
  100.                                               ,''  
  101.                                               ,''  
  102.                                               ,''  
  103.                                               ,''  
  104.                                               ,''  
  105.                                               ,''  
  106.                                               ,''  
  107.                                               ,''  
  108.                                               ,''  
  109.                                               ,''  
  110.                                               ,''  
  111.                                               ,''  
  112.                                               ,''  
  113.                                               ,''  
  114.                                               ,''  
  115.                                               ,''  
  116.                                               ,''  
  117.                                               ,''  
  118.                                               ,''  
  119.                                               ,''  
  120.                                               ,''  
  121.                                               ,''  
  122.                                               ,''  
  123.                                               ,''  
  124.                                               ,''  
  125.                                               ,''  
  126.                                               ,''  
  127.                                               ,''  
  128.                                               ,''  
  129.                                               ,''  
  130.                                               ,''  
  131.                                               ,''  
  132.                                               ,''  
  133.                                               ,''  
  134.                                               ,''  
  135.                                               ,''  
  136.                                               ,''  
  137.                                               ,''  
  138.                                               ,''  
  139.                                               ,''  
  140.                                               ,''  
  141.                                               ,''  
  142.                                               ,''  
  143.                                               ,''  
  144.                                               ,''  
  145.                                               ,''  
  146.                                               ,'');  
  147.     
  148.     Commit;  
  149.     If l_Request_Id Is Null Or  
  150.        l_Request_Id = 0 Then  
  151.       Return;  
  152.     End If;  
  153.       
  154.     fnd_message.set_string('请求提交成功,请稍等!请求ID:'||l_Request_Id);  
  155.     fnd_message.show;  
  156.       
  157.         --更改鼠标式样:漏斗鼠标(忙状态)  
  158.         SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'BUSY');    
  159.         --显示进度条窗口,并设置进度为0    
  160.         APP_WINDOW.PROGRESS(0);  
  161.       
  162.     l_Bl_Result := Fnd_Concurrent.Wait_For_Request(l_Request_Id  
  163.                                                   ,1  
  164.                                                   ,0  
  165.                                                   ,x_Phase  
  166.                                                   ,x_Status  
  167.                                                   ,x_Dev_Phase  
  168.                                                   ,x_Dev_Status  
  169.                                                   ,x_Message);  
  170.     If x_Dev_Phase = 'COMPLETE' And  
  171.        x_Dev_Status = 'NORMAL' Then  
  172.       Editor_Pkg.Report(l_Request_Id  
  173.                        ,'Y'); --使输出的报表pdf文件在浏览器中显示。  
  174.     Else  
  175.       Fnd_File.Put_Line(1  
  176.                        ,Rpad('x_phase'  
  177.                             ,20  
  178.                             ,' ') || '=' || x_Phase);  
  179.       Fnd_File.Put_Line(1  
  180.                        ,Rpad('x_status='  
  181.                             ,20  
  182.                             ,' ') || '=' || x_Status);  
  183.       Fnd_File.Put_Line(1  
  184.                        ,Rpad('x_dev_phase='  
  185.                             ,20  
  186.                             ,' ') || '=' || x_Dev_Phase);  
  187.       Fnd_File.Put_Line(1  
  188.                        ,Rpad('x_dev_status='  
  189.                             ,20  
  190.                             ,' ') || '=' || x_Dev_Status);  
  191.       Fnd_File.Put_Line(1  
  192.                        ,Rpad('x_message='  
  193.                             ,20  
  194.                             ,' ') || '=' || x_Message);  
  195.       Fnd_File.Put_Line(1  
  196.                        ,'Warning : Starting journal print report failure! It did not running in 120 seconds, its request_id is ' ||  
  197.                         To_Char(l_Request_Id) || ' please check it.');  
  198.     End If;  
  199.         SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');    
  200.         APP_WINDOW.PROGRESS(1); --显示进度条窗口,并设置进度为1(100%)    
  201.   End Run_Blanket_Release_Pdf;  



pll里面代码可以自由发挥了,其实跟写Form一样。


如果需要带入参数,可以用 Name_In来取Form上面的值,如:


  1. v_Po_Header_Id      Number(30) := Name_In('PO_RELEASES.PO_HEADER_ID');  


由于我的代码中使用到 Editor_Pkg.Report过程,这个过程是在FNDCONC.pll中,所以我们需要把FNDCOC库添加到CUSTOM下面才可以使用。

如果本地resource没有,我们要从服务器上下载,也是在$AU_TOP/resource/目录下。

下载后,附加动作如


3.上传并编译CUSTOM.pll

将编辑好的CUSTOM.pll文件保存,并上传至$AU_TOP/resource/目录下,覆盖。

编译pll.

cd $AU_TOP/resource/

frmcmp_batch module_type=LIBRARY module=CUSTOM userid=apps/apps


以上所用版本为R12。

如果是11i,编译命令如下:

f60gen module_type=LIBRARY module=CUSTOM userid=apps/apps

4.设置个性化

在 PO发放界面的个性化上面新增2个规则

1.新增菜单项

先设置规则,及条件,如图:

2.设置菜单项执行动作

规则、条件


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/269025/viewspace-1809370/,如需转载,请注明出处,否则将追究法律责任。

上一篇: Create item
请登录后发表评论 登录
全部评论

注册时间:2008-08-22

  • 博文量
    24
  • 访问量
    26086