数据以报表形式展现的实现方法研究

背景:系统的信息业务数据往往我们需要将其显示出来,通常我们用的方式是利用报表的形式将数据打印出来,这样的好处是可以生成形式多样的格式例如pdf,html等等,但是我们也可以使用htp的形式将数据打印出来,而不用提交一个Request,下面将对两种方式分别进行说明

一.Request形式

1..report生成xml数据源,或者用plsql输出,看个人喜好,都可以实现

例如生成的TRNORD5632.xml

<?xml version="1.0" encoding="GBK"?>
<!-- Generated by Oracle Reports version 10.1.2.0.2 -->
<TRNORD5632>
  <LIST_G_HEAD_DES>
    <G_HEAD_DES>
      <ORDER_NUMBER>2</ORDER_NUMBER>
      <ORDER_DATE>10-SEP-13</ORDER_DATE>
      <VENDOR_NUMBER>V00001</VENDOR_NUMBER>
      <VENDOR_NAME>HAND Corporation</VENDOR_NAME>
      <CONTACT_NAME>Scott</CONTACT_NAME>
      <TELEPHONE>021-38953345</TELEPHONE>
      <HEAD_DES>2</HEAD_DES>
      <LIST_G_ITEM_NUMBER>
        <G_ITEM_NUMBER>
          <LINE_NUMBER>2</LINE_NUMBER>
          <ITEM_NUMBER>01002001</ITEM_NUMBER>
          <ITEM_NAME>Mouse</ITEM_NAME>
          <QUANTITY>1</QUANTITY>
          <UNIT_PRICE>200</UNIT_PRICE>
          <AMOUNT>200</AMOUNT>
          <ACCOUNT_ID>01-000-2990-0000-000</ACCOUNT_ID>
          <ACCOUNT_DES>Operations-No Department-Suspense-No Sub Account-No Product</ACCOUNT_DES>
          <LINE_DES>2</LINE_DES>
        </G_ITEM_NUMBER>
      </LIST_G_ITEM_NUMBER>
      <PRINT_DATE>10-SEP-13</PRINT_DATE>
      <SUM_AMOUNT>200</SUM_AMOUNT>
    </G_HEAD_DES>
  </LIST_G_HEAD_DES>
</TRNORD5632>

2利用“1”中生成的数据源开发rtf模板,具体开发语法方法可以参考我的博客 BI Publisher(rtf)模板开发语法大全 。http://blog.csdn.net/cai_xingyun/article/details/17094863

3.修改report程序

(1)必须有参数:P_CONC_REQUEST_ID

(2)必须在before report 中调用:SRW.USER_EXIT('FND SRWINIT');

(3)必须在after report中调用:SRW.USER_EXIT('FND SRWEXIT');

修改后直接保存成rdf文件就行(不用编译;也编译不过)

 

4.上传rdf文件到对应的服务器例如$CUX_TOP/reports/ZHS

 

5.定义可执行:APPLICATION DEVELOPER--》并发》可执行

数据以报表形式展现的实现方法研究_第1张图片数据以报表形式展现的实现方法研究_第2张图片

6.定义并发程序:APPLICATION DEVELOPER--》并发》程序

数据以报表形式展现的实现方法研究_第3张图片

如果report有参数则点击:参数Parameters

主要选项

数据以报表形式展现的实现方法研究_第4张图片

参数界面内容设置

 

数据以报表形式展现的实现方法研究_第5张图片

注意:

数据以报表形式展现的实现方法研究_第6张图片

7.把报表分配给请求组

1)先查找我们要挂报表的职责,并记住该职责的请求组   系统管理员->安全性责任à定义;查找出需要的责任;记住请求组

数据以报表形式展现的实现方法研究_第7张图片

(2)分配给请求组

系统管理员->安全性责任à请求      查找出上一步记住的请求组名;把前面定义好的并发程序挂在请求组下

数据以报表形式展现的实现方法研究_第8张图片

8.注册数据和模板

声明注意

数据以报表形式展现的实现方法研究_第9张图片

(1).    切换责任到:XML Publisher Administrator

(2).    定义数据: XML Publisher Administratorà主页à数据定义;点创建数据定义

数据以报表形式展现的实现方法研究_第10张图片

(3).    定义模板XML Publisher Administratorà主页à模板;点创建模板

数据以报表形式展现的实现方法研究_第11张图片

9.切换到相应责任下提交请求,输入请求参数等就可以查看输出

二,在FORM中调用请求输出数据

程序单元

procedure print_report(p_ord_num in NUMBER,p_date_end in date,p_date_start in date) is
            L_REQUEST_ID NUMBER;
            L_BL_RESULT  BOOLEAN;
            v_layout     BOOLEAN;
            X_PHASE      VARCHAR2(100);
            X_STATUS     VARCHAR2(100);
            X_DEV_PHASE  VARCHAR2(100);
            X_DEV_STATUS VARCHAR2(100);
            X_MESSAGE    VARCHAR2(100);
   BEGIN


  /*

           --

          -- Name

          --   add_layout

          -- Purpose

          --   Called before submission to add layout options for request output.

          --

          -- Arguments

          --    Template_APPL_Name            - Template Application Short name.

          --    Template_code                 - Template code

          --    Template_Language             - Template File language (iso value)

          --    Template_Territory            - Template File Territory (iso value)

          --    Output Format                 - Output Format

          --添加输出模板,FND_REQUEST.add_layout (template_appl_name in varchar2,

                                 template_code     in varchar2,

                                 template_language in varchar2,

                                 template_territory in varchar2,

                                 output_format     in varchar2) return boolean

        */

      v_layout:=FND_REQUEST.ADD_LAYOUT('PO','TRNORD5632_4',Null, Null,'PDF');  




  /*

          --

          -- Name

          --   submit_request

          -- Purpose

          --   Submits concurrent request to be processed by a concurrent manager

          --

          -- Arguments

          --   application    - Short name of application under which the program

          --            - is registered

          --   program        - concurrent program name for which the request has

          --            - to be submitted

          --   description    - Optional. Will be displayed along with user

          --            - concurrent program name

          --   start_time    - Optional. Time at which the request has to start

          --            - running

          --   sub_request    - Optional. Set to TRUE if the request is submitted

          --               - from another running request and has to be treated

          --            - as a sub request. Default is FALSE

          --   argument1..100    - Optional. Arguments for the concurrent request

          --  提交并发请求

          --FND_REQUEST.SUBMIT_REQUEST(application IN varchar2 default NULL,

                                      program IN varchar2 default NULL,

                                      description IN varchar2 default NULL,

                                      start_time IN varchar2 default NULL,

                                      sub_request IN boolean default FALSE

                                      argument1,

                                      argument2, ..., argument99,

                                      argument100) return number;
        */  

      L_REQUEST_ID := FND_REQUEST.SUBMIT_REQUEST('PO',
                                                           'TRNORD5632_4',
                                                            '',
                                                            '',
                                                            FALSE,
                                                            P_DATE_END,
                                                            P_DATE_START,
                                                            P_ORD_NUM,
                                                            CHR(0),'','','','','','',
                                                            '','','','','','','','','','',
                                                            '','','','','','','','','','',
                                                            '','','','','','','','','','',
                                                             '','','','','','','','','','',
                                                            '','','','','','','','','','',
                                                             '','','','','','','','','','',
                                                             '','','','','','','','','','',
                                                              '','','','','','','','','','',
                                                             '','','','','','','','','','');
           
           
           
           FND_MESSAGE.DEBUG('L_REQUEST_ID  '|| L_REQUEST_ID);                                                                                                                                                                                                                                            
           COMMIT;   
           IF L_REQUEST_ID IS NULL OR L_REQUEST_ID = 0 THEN
              RETURN;
           END IF;


 /*

          --

          -- Name

          --   WAIT_FOR_REQUEST

          -- Purpose

          --   Waits for the request completion, returns phase/status and

          --   completion text to the caller. Calls sleep between db checks.

          -- Arguments (input)

          --   request_id    - Request ID to wait on

          --   interval         - time b/w checks. Number of seconds to sleep

          --            - (default 60 seconds)

          --   max_wait        - Max amount of time to wait (in seconds)

          --            - for request's completion

          -- Arguments (output)

          --               User version of      phase and status

          --               Developer version of phase and status

          --               Completion text if any

          --   phase         - Request phase ( from meaning in fnd_lookups )

          --   status        - Request status( for display purposes          )

          --   dev_phase    - Request phase as a constant string so that it

          --            - can be used for comparisons )

          --   dev_status    - Request status as a constatnt string

          --   message        - Completion message if request has completed

          --

          --等待并发请求完成,并返回分析/状态和完成信息,FND_CONCURRENT.WAIT_FOR_REQUEST(request_id IN number default NULL,

                                                                                          interval IN number default 60,

                                                                                          max_wait IN number default 0,

                                                                                          phase OUT varchar2,

                                                                                          status OUT varchar2,

                                                                                          dev_phase OUT varchar2,

                                                                                          dev_status OUT varchar2,

                                                                                          message OUT varchar2) return boolean;

                */

           L_BL_RESULT := FND_CONCURRENT.WAIT_FOR_REQUEST(L_REQUEST_ID,1,0,X_PHASE, X_STATUS,X_DEV_PHASE,X_DEV_STATUS,X_MESSAGE);
           IF X_DEV_PHASE = 'COMPLETE' AND X_DEV_STATUS = 'NORMAL' THEN
              editor_pkg.report(L_REQUEST_ID,'Y'); --使输出的报表pdf文件在浏览器中显示。
           ELSE               
                    fnd_file.put_line(1,RPAD('x_phase',20,' ') || '=' || X_PHASE);
                    fnd_file.put_line(1,RPAD('x_status=',20,' ') || '=' || X_STATUS);
                    fnd_file.put_line(1,RPAD('x_dev_phase=', 20, ' ') || '=' || X_DEV_PHASE);
                    fnd_file.put_line(1,RPAD('x_dev_status=',20,' ') || '=' || X_DEV_STATUS);
                    fnd_file.put_line(1,RPAD('x_message=',20,' ') || '=' || X_MESSAGE);
                    fnd_file.put_line(1,'Warning : Starting journal print report failure! It did not running in 120 seconds, its request_id is ' ||
                                            TO_CHAR(L_REQUEST_ID) || ' please check it.');            
                END IF;
   end print_report;


在触发器中调用即可

 

三.HTP形式展现数据,直接输出在浏览器中

1.开发程序包

CREATE OR REPLACE PACKAGE TEST_PKG IS
PROCEDURE POIMP_PRN (p_IMPORT_REQUEST_ID number);
PROCEDURE PRIMP_PRN (p_IMPORT_REQUEST_ID number);
End TEST_PKG;
/
CREATE OR REPLACE PACKAGE BODY TEST_PKG IS
PROCEDURE POIMP_PRN (p_IMPORT_REQUEST_ID number) is


V_Page_Width NUMBER := 1500 ;
V_Font_Size NUMBER := 2 ;
V_Title_Size NUMBER := 3;
v_name varchar2(100) ;
v_org_id number;
v_internal_address_line varchar2(100);
v_count number;
v_err varchar2(10000);
v_ITEM_CHECK varchar2(30);
Logo_Url Constant Varchar2(100) := 'http://host:port/OA_HTML/cmlogo.gif';
Begin
Htp.Tableopen(Cattributes => 'cellspacing=0 cellpadding=3 border=0 width=' ||
V_Page_Width || ' bgcolor="#000000"',
Calign => 'center');
Htp.Tablerowopen(Cattributes => 'bgcolor="#ffffff"');
Htp.Tabledata(Cvalue => '<img src=" ' || Logo_Url || '">',
Cattributes => 'width="20%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Title_Size || '"> <b>' ||
'采购订单导入-采购清单' || '</b>',
Cattributes => 'width="60%"',
Calign => 'center');
Htp.Tablerowclose;
Htp.Tableclose;
Htp.p('<p>');
Htp.Htmlopen;
Htp.Title(' 采购订单导入-物料采购清单');
Htp.p('<head>');
Htp.p('<META. http-equiv=Content-Type content="text/html; charset=gb2312" >');
Htp.p('<STYLE>');
Htp.p('</STYLE>');
Htp.p('</head>');
Htp.Bodyopen;
---------------------

fnd_client_info.set_org_context (v_org_id);

Htp.Tableopen(Cattributes => 'cellspacing=0 cellpadding=3 border=1 width=' ||
V_Page_Width || ' bgcolor="#ffffff"',
Calign => 'center');
Htp.Tablerowopen(Cattributes => 'bgcolor="#ffffff"');

For c_header in Cur_header Loop

Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '合同名称',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || c_header.CONTRACT_NAME ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');

Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '合同总金额',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || c_header.CONTRACT_AMOUNT ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '合同编号',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || c_header.CONTRACT_NUMBER ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tablerowclose;
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || 'xx公司名称',
Cattributes => 'width="4%"',
Calign => 'center');


Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || v_name ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');

Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || 'xx公司代码',
Cattributes => 'width="4%"',
Calign => 'center');


Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || v_internal_address_line ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');

Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '合同日期',
Cattributes => 'width="4%"',
Calign => 'center');


Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || c_header.CONTRACT_date ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');

Htp.Tablerowclose;

Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '供应商名称',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || c_header.vendor_name ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '供应商编码',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || c_header.vendor_code ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '供应商地点',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || c_header.vendor_site_code ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');

Htp.Tablerowclose;
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '收货地点',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || c_header.SHIP_TO_LOCATION ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '收单地点',
Cattributes => 'width="4%"',
Calign => 'center');

Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || c_header.BILL_TO_LOCATION ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '币种',
Cattributes => 'width="4%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || c_header.CURRENCY_CODE ||
Chr(38) || 'nbsp',
Cattributes => 'width="4%"',
Calign => 'center');

Htp.Tablerowclose;
End Loop;

Htp.Tableclose;
------------
---------------------
Htp.Tableopen(Cattributes => 'cellspacing=0 cellpadding=3 border=1 width=' ||
V_Page_Width || ' bgcolor="#ffffff"',
Calign => 'center');
Htp.Tablerowopen(Cattributes => 'bgcolor="#ffffff"');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '行号',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '站号',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '物料编码',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '物料描述',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '物料分类',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '单位',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '数量',
Cattributes => 'width="1%"',
Calign => 'center');

Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '目录单价',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '合同单价',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '库存组织',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '需求日期',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '接收地点',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '项目编码',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '任务编码',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '行类型',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '支出类型',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '支出组织',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '支出日期',
Cattributes => 'width="1%"',
Calign => 'center');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' || '错误信息或提示',
Cattributes => 'width="1%"',
Calign => 'center');
------------
Htp.Tableopen(Cattributes => 'cellspacing=0 cellpadding=3 border=1 width=' ||
V_Page_Width || ' bgcolor="#ffffff"',
Calign => 'center');
For C_LINE in Cur_line Loop
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.LINE_NUMBER || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.SITE_NUMBER || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.ITEM_NUM || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.ITEM_DESCRIPTION || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.ITEM_ATTRIBUTE || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.UNIT_OF_MEASURE || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.QUANTITY || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.LIST_PRICE_PER_UNIT || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.UNIT_PRICE || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.ORGANIZATION_CODE || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.NEED_BY_DATE || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');

Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.DELIVER_TO_LOCATION || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.PROJECT_NUMBER || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.TASK_NUMBER || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.LINE_TYPE || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.EXPENDITURE_TYPE || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.EXPENDITURE_ORGANIZATION || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
C_LINE.EXPENDITURE_ITEM_DATE || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');


--Error code
v_err := null;

For C_err in Cur_err Loop

if C_err.line_number = C_line.line_number then
v_err := C_err.error_message || ';' || v_err ;
end if;

End loop;


If ITEM_CHECK = 'Y' then
If c_line.item_num is not null then

select count(*) into v_count
from mtl_system_items_b
where organization_id = c_line.organization_id
and segment1 = c_line.item_num;

End if;

If v_count > 0 then
select count(*) into v_count
from mtl_system_items_b
where organization_id = c_line.organization_id
and segment1 = c_line.item_num
and description = c_line.item_description
;

If v_count = 0 then
v_err := '物料描述不一致' || ';' || v_err ;
End if;
End if;
End if;

Htp.Tabledata(Cvalue => '<font size="' || V_Font_Size || '"> ' ||
v_err || Chr(38) ||
'nbsp',
Cattributes => 'width="1%"',
Calign => 'left');
Htp.Tablerowclose;
End loop;

Htp.Tableclose;
Htp.Tablerowclose;
Htp.Tableclose;
----------------------


Htp.Bodyclose;
Htp.Htmlclose;

End POIMP_PRN;

End TEST_PKG;


2.在System administrator职责   ->Security->Web PL/SQL界面注册Package

3.Form中调用

DECLARE
v_command VARCHAR2 (2000);
BEGIN

v_command := fnd_profile.VALUE ('APPS_WEB_AGENT');
v_command := v_command || '/TEST_PKG.POIMP_PRN?p_IMPORT_REQUEST_ID=' || :Test.Import_id;
/*
--v_command := v_command || '&p_Doc_Comb =' || v_doc_comb;
v_command := v_command || '&p_Doc_id =' || :HEADER.REQUEST_HEADER_ID;
v_command := v_command || '&p_Doc_type =' || :HEADER.DOC_TYPE_NAME;
v_command := v_command || '&p_Date_From =' || Null;
v_command := v_command || '&p_Date_To =' || Null;
v_command := v_command || '&p_Create_By =' || :REQ_HEADER.CREATED_BY;
v_command := v_command || '&p_Print_Person =' || V_PRN_PERSON;
*/
web.show_document (v_command, '_blank');

-- FND_MESSAGE.SET_STRING('O');
-- FND_MESSAGE.HINT;
END;


 

 

 

 

 

 

 

 

 

 

 

 


 

 

你可能感兴趣的:(form,report,报表,ebs,HTP)