oracle print report directly

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
NiceMan331Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Mark GeerlingsConnect With a Mentor Database AdministratorCommented:
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
 
Wasim Akram ShaikCommented:
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
 
NiceMan331Author Commented:
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Mark GeerlingsDatabase AdministratorCommented:
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
 
NiceMan331Author Commented:
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
 
Mark GeerlingsDatabase AdministratorCommented:
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
 
NiceMan331Author Commented:
ok
waiting for you
0
 
NiceMan331Author Commented:
i will try it tomorrow
thanx
0
 
NiceMan331Author Commented:
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
 
NiceMan331Author Commented:
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
 
Mark GeerlingsDatabase AdministratorCommented:
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
 
NiceMan331Author Commented:
2- is there additional choices to select no of copies , and page ranges ?
0
 
Mark GeerlingsDatabase AdministratorCommented:
Number of copies ? I think so.  Reports6 supports a parameter named: "COPIES".
Page ranges?  I doubt it.
0
 
NiceMan331Author Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.