Friday 1 April 2011

Oracle reports: how to disable print button

In oracle reports runtime previewer we have menu options and buttons for print and also for sending email. Sometimes there are situations when we dont like to give this option of print to the user and want to use some other method of printing as per requirement.

When we call reports runtime software to view any report module by run_product builtin giving report name as input parameter, we also pass parameter list as an input parameter to this builtin. With the help of these parameters we tell the reports runtime software about how the previewer should behave.

From oracle forms we call reports as:

Run_Product(REPORTS, 'repot_name', ASYNCHRONOUS, RUNTIME, FILESYSTEM, PL_ID, NULL);

by default print option is enabled in Previewer and your screen's top-left corner will look like:







If we want to disable print option in runtime previewer of oralce reports runtime software, we will assign the value "YES" to the parameter of 'DISABLEPRINT' and add this to parameter list as PL_ID in above command. we will re-write the above command as:

declare
  pl_id ParameterList;
begin
  pl_id := Get_Parameter_List('tmpdata');
  if not id_null(pl_id) then
    Destroy_Parameter_List(pl_id);
  end if;
  Add_Parameter(pl_id, 'DISABLEPRINT', TEXT_PARAMETER, 'YES');
  Run_Product(REPORTS, 'repot_name', ASYNCHRONOUS, RUNTIME, FILESYSTEM, PL_ID, NULL);
end;

After using the above command top-left corner of you Previwer should look like:

 In this print button is disabled along with page setup button.