Home » Developer & Programmer » Forms » How to print report directly in oracle forms 10g (Oracle forms 10g)
How to print report directly in oracle forms 10g [message #648603] Fri, 26 February 2016 04:57 Go to next message
tariq_arl_it
Messages: 1
Registered: February 2016
Location: pakistan
Junior Member
--Can somebody please help me with this code.... Im using oracle forms 10g and want to send print to client side printer... please its urgent and would be grateful for any sort of help; when I run this code it says 'Unable to run report'... this procedure runs against the trigger when button pressed.


PROCEDURE direct_print (p_rep_name in varchar2,
p_output_type in varchar2 default 'pdf',
p_rep_para in varchar2) is


v_rep VARCHAR2(100);
rep_status VARCHAR2(50);
repServerHost arl_setup_codes.value%type;
repServerPort arl_setup_codes.value%type;
repServerName VARCHAR2(50);
v_report_Address VARCHAR2(500);
v_report_Server arl_setup_codes.value%type;
LC$REP VARCHAR2 (100);
LC$REP_STATUS VARCHAR2 (20);
LC$LN$ADOBE_PATH VARCHAR2 (500);
LN$PROCESS_ID WEBUTIL_HOST.PROCESS_ID;
REPID REPORT_OBJECT;
LC$FILE_PATH VARCHAR2 (1024);
LC$TEMP_PATH CONSTANT VARCHAR2 (256)
:= '\\121.100.101.151\ARL_APP10g\aclubs\' ;
--\\121.100.101.151\ARL_APP10g\aclubs\201601041126381003.pdf
BEGIN


LC$FILE_PATH := LC$TEMP_PATH || p_rep_para||'.pdf';


SELECT a.VALUE, b.VALUE, c.VALUE
INTO repServerHost, repServerPort, repServerName
FROM arl_setup_codes a, arl_setup_codes b, arl_setup_codes c
WHERE a.CODE_TYPE = 'REP_SERV'
AND a.CODE_TYPE = b.CODE_TYPE
AND a.CODE_TYPE = c.CODE_TYPE
AND a.CODE = 'APP_SERV'
AND b.CODE = 'REP_PORT'
AND c.CODE = 'REP_SERV_N';

v_report_Server := repServerName;
-- v_report_Address := 'http://' || repServerHost || ':' || repServerPort ||'/reports/rwservlet/getjobid';

repid := find_report_object('rpt_obj');


--REPID := FIND_REPORT_OBJECT (IN_OBJ_NAME);

--SET_REPORT_OBJECT_PROPERTY (REPID, REPORT_FILENAME, IN_REP_NAME);
SET_REPORT_OBJECT_PROPERTY(repid, REPORT_FILENAME, p_rep_name||'.rdf');

--SET_REPORT_OBJECT_PROPERTY (REPID, REPORT_SERVER, IN_SERVER_NAME);

SET_REPORT_OBJECT_PROPERTY(repid, REPORT_SERVER, v_report_Server);

SET_REPORT_OBJECT_PROPERTY (REPID, REPORT_EXECUTION_MODE, BATCH);

SET_REPORT_OBJECT_PROPERTY (REPID, REPORT_COMM_MODE, SYNCHRONOUS);

SET_REPORT_OBJECT_PROPERTY (REPID, REPORT_DESTYPE, file);

--File name must be unique otherwise it will override the old file with same name

SET_REPORT_OBJECT_PROPERTY (REPID, REPORT_DESNAME, LC$FILE_PATH);

SET_REPORT_OBJECT_PROPERTY (REPID, REPORT_DESFORMAT, 'pdf');

SET_REPORT_OBJECT_PROPERTY(repid, REPORT_OTHER, p_rep_para);

LC$REP := RUN_REPORT_OBJECT (REPID);

LC$REP_STATUS := REPORT_OBJECT_STATUS (LC$REP);

WHILE LC$REP_STATUS IN ('RUNNING', 'OPENING_REPORT', 'ENQUEUED')
LOOP
LC$REP_STATUS := REPORT_OBJECT_STATUS (LC$REP);
END LOOP;
message('1');
message('1');
IF LC$REP_STATUS = 'FINISHED'
THEN

IF WEBUTIL_FILE_TRANSFER.IS_AS_READABLE (LC$FILE_PATH)
THEN
-- Try to get the correct instaled version of Adobe Reader program

LC$LN$ADOBE_PATH:= 'C:\Program Files\Adobe\Reader 11.0\';
BEGIN
LN$PROCESS_ID :=
WEBUTIL_HOST.
NONBLOCKING (
'"'
|| LC$LN$ADOBE_PATH
|| 'Reader\AcroRd32.exe" /H /P '
|| LC$FILE_PATH);
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;

--sleep for sometime until printing is finished

DBMS_LOCK.SLEEP (3);

-- Teminate Adobe Reader Program Process

IF NOT WEBUTIL_HOST.ID_NULL (LN$PROCESS_ID)
THEN
WEBUTIL_HOST.TERMINATE_PROCESS (LN$PROCESS_ID);

ELSE
MESSAGE (
LC$FILE_PATH || ' is unreadable path at application server');

END IF;




end if;
end if;
END;
Re: How to print report directly in oracle forms 10g [message #648987 is a reply to message #648603] Wed, 09 March 2016 08:43 Go to previous message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
With Forms 10g you can't print directly to a local printer the way you could in Forms 6i or earlier. Forms 10g requires the use of a 3rd party Javabean. Check out this article: A Java Bean to print files to the local printer .
Previous Topic: How to clear form/block in item level triggers?
Next Topic: Mod pl sql on a web form submit button
Goto Forum:
  


Current Time: Sun Jun 13 12:11:33 CDT 2021