Solved

oracle print report directly

Posted on 2014-03-27
14
557 Views
Last Modified: 2014-04-03
hi
i have one form , having 4 text items , to fill in the 4 parameters required to run a report
here is the when button pressed trigger
declare
	X PARAMLIST;

BEGIN  	

	 X := CREATE_PARAMETER_LIST('T1');
	 add_parameter(x, 'ParamForm', TEXT_PARAMETER,'no');
	  
 	
       

	-- add_parameter(x, 'ParamForm', TEXT_PARAMETER,'yes');
  ADD_PARAMETER(X,'uac',TEXT_PARAMETER,:BASIC_BLOCK.UP_ACC);
  ADD_PARAMETER(X,'wdate1',TEXT_PARAMETER,:BASIC_BLOCK.D_from);
  ADD_PARAMETER(X,'wdate2',TEXT_PARAMETER,:BASIC_BLOCK.D_TO);
  ADD_PARAMETER(X,'wyear',TEXT_PARAMETER,:BASIC_BLOCK.T_YEAR);
 
        
           RUN_PRODUCT(REPORTS,'E:\MyOracle\Projects\GL_INt\gl6001_6.rep',SYNCHRONOUS,RUNTIME,FILESYSTEM,X);
          DESTROY_PARAMETER_LIST('T1');	
END;

Open in new window


every time i have to change the field :BASIC_BLOCK.UP_ACC  TO SELECT ANOTHER VALUE then run the report
i want to save time , the values of UP_ACC i can find it from one table
so , could i use cursor to loop in that table , then let the command send the report directly to the printer , then next value , print , then next , print , till the end of the cursor
0
Comment
Question by:NiceMan331
  • 8
  • 5
14 Comments
 
LVL 16

Expert Comment

by:Wasim Akram Shaik
ID: 39960854
I assume that your form has a provision to provide one input at a time,

why don't you increase the input parameter limit in the first place, that would suffice your requirement without any modifications.
0
 

Author Comment

by:NiceMan331
ID: 39961472
actually the report built to run one parameter for field up_acc
to increase the fields as per what you adviced , the report should be adjust to group by above up_acc . then in form we can select from up_acc to up_acc
but i can't adjust the report right now , i don't know how to group it above , then i have no extra time to do it , the easier way for me now is to find a way to print the report to printer directly ,
0
 
LVL 34

Expert Comment

by:Mark Geerlings
ID: 39962107
It looks to me like the best option would be to change the report to use the cursor loop and process each record it finds.  

If, for some reason, you don't want to (or can't?) change the report now, you could change your form block to be based on a table (or view) then have the form block execute the query.  Then, move the logic that you have now in a when-button-pressed trigger to a post-query trigger.  (This will cause a lot more server, database and network load, than if you could change the report to run the query and process multiple records in just one call Oracle Reports.  But, this is a way to save some user time.)
0
 

Author Comment

by:NiceMan331
ID: 39962327
Ok , i likes to change the form to be based on query , but is there any way to send the report directly to the printer ? Instead of preview
0
 
LVL 34

Expert Comment

by:Mark Geerlings
ID: 39962604
Yes, there is another parameter that you can add to your parameter_list and pass to the report that will cause the output to be printed directly, and not displayed in the previewer.  I don't remember what that parameter_name is, or the value that it needs, but I remember that was possible in Forms6/Reports6.  I'll see if I get a chance to check one of our old forms today to see what that value was, but I'm getting close to the end of my work day here.
0
 

Author Comment

by:NiceMan331
ID: 39962635
ok
waiting for you
0
 
LVL 34

Accepted Solution

by:
Mark Geerlings earned 500 total points
ID: 39962710
Try adding these two parameters to your paramlist:
DESTYPE=PRINTER
DESNAME=[a valid printer on your system]

like this:

ADD_PARAMETER(X,'DESTYPE',TEXT_PARAMETER,'PRINTER');
ADD_PARAMETER(X,'DESNAME',TEXT_PARAMETER,'MyPrinter');

(Maybe 'DESTYPE' and 'DESNAME' need to be specified without the single quotes - I'm not sure.  I just checked the Reports6i "Help" file, I didn't actually find a working example.)
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:NiceMan331
ID: 39963835
i will try it tomorrow
thanx
0
 

Author Comment

by:NiceMan331
ID: 39965935
yes , it is ok now , it sent to the printer directly
now i will adjust the code to use cursor to loop all accounts
to check if sent all to the printer
0
 

Author Comment

by:NiceMan331
ID: 39966026
i have in the form 2 radio groups to select report name
another 2 radio groups to select printing mode , preview or printer

declare
	X PARAMLIST;
  CURSOR C_ACC IS
  SELECT ACC_NO FROM ACC_MASTER_FILE WHERE A_TYPE = 1;
  v_acc  C_ACC%rowtype;
  
BEGIN  	

X := CREATE_PARAMETER_LIST('T1');
if :BASIC_BLOCK.PRINT_REP = 1 then    -- select  1st report from option group


	 
	 add_parameter(x, 'ParamForm', TEXT_PARAMETER,'no');
	  
IF :BASIC_BLOCK.RAD_PRNT_MOD = 1 THEN   	-- select to print preview
       


  ADD_PARAMETER(X,'uac',TEXT_PARAMETER,:BASIC_BLOCK.UP_ACC);
 ADD_PARAMETER(X,'wdate1',TEXT_PARAMETER,:BASIC_BLOCK.D_from);
  ADD_PARAMETER(X,'wdate2',TEXT_PARAMETER,:BASIC_BLOCK.D_TO);
  ADD_PARAMETER(X,'wyear',TEXT_PARAMETER,:BASIC_BLOCK.T_YEAR);
  RUN_PRODUCT(REPORTS,'E:\MyOracle\Projects\GL_INt\gl6001_6.rep',SYNCHRONOUS,RUNTIME,FILESYSTEM,X);
ELSE IF :BASIC_BLOCK.RAD_PRNT_MOD = 2 THEN   	-- select printer
	
     
                	 ADD_PARAMETER(X,'DESTYPE',TEXT_PARAMETER,'PRINTER');
ADD_PARAMETER(X,'DESNAME',TEXT_PARAMETER,'HP LaserJet P2015 Series PCL 6');
 ADD_PARAMETER(X,'wdate1',TEXT_PARAMETER,:BASIC_BLOCK.D_from);
  ADD_PARAMETER(X,'wdate2',TEXT_PARAMETER,:BASIC_BLOCK.D_TO);
  ADD_PARAMETER(X,'wyear',TEXT_PARAMETER,:BASIC_BLOCK.T_YEAR);
  
	OPEN C_ACC;
	 loop
        	
         fetch C_ACC into v_acc;
         
         exit when C_ACC%notfound;
       
  

  ADD_PARAMETER(X,'uac',TEXT_PARAMETER,v_acc.ACC_NO);
  RUN_PRODUCT(REPORTS,'E:\MyOracle\Projects\GL_INt\gl6001_6.rep',SYNCHRONOUS,RUNTIME,FILESYSTEM,X);
	
  	  end loop;
     	
       CLOSE C_ACC;
end if;
end if;
end if;        
           
         
if :BASIC_BLOCK.PRINT_REP = 2 then   -- select another report
	
		 add_parameter(x, 'ParamForm', TEXT_PARAMETER,'yes');
  ADD_PARAMETER(X,'P3',TEXT_PARAMETER,15121);
 
         RUN_PRODUCT(REPORTS,'E:\MyOracle\Projects\GL_INt\Acct_Stat_Amt.rep',SYNCHRONOUS,RUNTIME,FILESYSTEM,X);
end if;


	
	 DESTROY_PARAMETER_LIST('T1');	
END;

Open in new window


the problem is , when selecting to print to the printer
it say parameter
ADD_PARAMETER(X,'uac',TEXT_PARAMETER,v_acc.ACC_NO);
already exist ,
shall i destroy the parametr lists withing the loop ?
2- is there additional choices to select no of copies , and page ranges ?
0
 
LVL 34

Expert Comment

by:Mark Geerlings
ID: 39966462
You cannot add the same parameter again to your parameter list inside a cursor loop.  So, your options are either:
1. Find a way to get this job by calling the report only once.
2. Destroy and recreate the parameter list inside your cursor loop.
0
 

Author Comment

by:NiceMan331
ID: 39967142
2- is there additional choices to select no of copies , and page ranges ?
0
 
LVL 34

Expert Comment

by:Mark Geerlings
ID: 39967160
Number of copies ? I think so.  Reports6 supports a parameter named: "COPIES".
Page ranges?  I doubt it.
0
 

Author Closing Comment

by:NiceMan331
ID: 39975130
sorry for delay , but i lost the internet connection in my office
i wish you try to fond a way for determine page ranges
thanx
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
percentage remaining 6 40
null value 15 69
query in Oracle forms Builder 2 27
Oracle -- identify blocking session 24 22
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now