Please see my other blog for Oracle EBusiness Suite Posts - EBMentors

Search This Blog

Note: All the posts are based on practical approach avoiding lengthy theory. All have been tested on some development servers. Please don’t test any post on production servers until you are sure.

Tuesday, January 17, 2012

Direct printing to a default client printer in Oracle developer 10g


Purpose:  Steps how to print on a default client printer directly without previewing or displaying the report. (Oracle 10g)
Files Attached: The following files are required and can be downloaded from below.
orarrp.zip      orarrp folder that includes the printing tool.

Form Builder Configuration

1) We need to define the following triggers in the form that calls a report:
- WHEN-BUTTON-PRESSED which has the following code:

/* Here we define the report parameters */
Declare
vcFile varchar2(255);
.
.
.

Begin

Add_Parameter (vp_list, 'paramform', TEXT_PARAMETER, 'no');
Add_Parameter (vp_list, 'P_Sr', TEXT_PARAMETER, vv_random_sr);
Add_Parameter (vp_list, 'P_Emp_Code', TEXT_PARAMETER, :Blk_1.Emp_Code);
Add_Parameter (vp_list, 'P_Emp_Name', TEXT_PARAMETER, :Blk_1.Emp_Name);
.
.
.

/* Here we setup the report printing parameters

vcFile := get_application_property(USERNAME)||TO_CHAR(SYSDATE,'YYYYMMDDHHMISS');

vcFile := vcFile||'.rrpa'; -- will be explained later
report_id:=FIND_REPORT_OBJECT('JOBREP09'); -- report name
           
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE,FILE);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT,'PDF');
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESNAME,'c:\test_area\'||vcFile); -- this folder needs to be created in application server
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER,'rep_dzithq-oas01_ASServer'); -- report server name
:Parameter.ReportHandle := RUN_REPORT_OBJECT(report_id,vp_list);
:Parameter.PrintOutPut := vcFile;

- WHEN-TIMER-EXPIRED which has the following code:
/* This will call command line and run the report from application server direct to a client printer*/
Client_Host ('C:\WINDOWS\system32\cmd /c START '||'\\10.1.0.92\test_area\'||:Parameter.PrintOutPut);
2) Define the following parameters in form builder:
ReportHandle, and PrintOutPut

3) Define the report name in reports area in form builder:
Reports -> JOBREP09 (will be of file type and not printer nor screen).

Client Configuration:
Copy the attached folder named (orarrp) to C:\Program Files

1) Run the file named (orarrp) under the above the folder will create an INI file named (orarrp).

2) If you want to print directly to default client printer, edit the INI file and replace the choose_printer=yes with choose_printer=no.
Keeping the parameter = yes will display a list of client printers (local and netowork) and he must choose from.


Application Server Configuration:
1) All what we need to do is to create a shared folder for all users who can print directly to their default printers. In our case we name it test_area under C:\


No comments: