Skip to main content

Hi,

Requirement: We are printing a report using a RMB. When it gets printed, it must print 2 copies.

In general, when we print an order report from any screen using RMB, then the print dialog gives us an option to input the number of copies we need.

When I am trying to perform the same from the backend using below code, only one pdf is getting generated. Does this mean that the COPIES() will not work from backend?

DECLARE
  conf_attr_           VARCHAR2(4000);
  ordrsp_site_         VARCHAR2(5);
  change_online_     VARCHAR2(4000);
  media_code_          VARCHAR2(40);
  report_attr_        VARCHAR2(2000);
  parameter_attr_     VARCHAR2(2000);
  attr_               VARCHAR2(200);
  printer_id_         VARCHAR2(100);
  result_key_         NUMBER;
  print_job_id_       NUMBER;
  delnote_no_         VARCHAR2(15);
  count_              NUMBER := 0;
BEGIN
  Client_SYS.Clear_Attr(report_attr_);
  Client_SYS.Clear_Attr(parameter_attr_);
  Client_SYS.Add_To_Attr('REPORT_ID', 'SHIPMENT_HANDLING_UTILITY_REP', report_attr_);
  Client_SYS.Add_To_Attr('SHIPMENT_ID', 42062, parameter_attr_);
  printer_id_ := Printer_Connection_API.Get_Default_Printer('IFSAPP', 'SHIPMENT_HANDLING_UTILITY_REP');
  Client_SYS.Clear_Attr(attr_);
  Client_SYS.Add_To_Attr('PRINTER_ID', printer_id_, attr_);
  Print_Job_API.New(print_job_id_, attr_);
  Archive_API.New_Instance(result_key_, report_attr_, parameter_attr_);
  Client_SYS.Clear_Attr(attr_);
  Client_SYS.Add_To_Attr('PRINT_JOB_ID', print_job_id_, attr_);
  Client_SYS.Add_To_Attr('RESULT_KEY', result_key_, attr_);
  Client_SYS.Add_To_Attr('OPTIONS',    'COPIES(2)', attr_);
  Print_Job_Contents_API.New_Instance(attr_);
  IF (print_job_id_ IS NOT NULL) THEN
     Print_Job_API.Print(print_job_id_);
  END IF;
END;

Could you please try below, instead of the highlighted line above?
Client_SYS.Add_To_Attr('COPIES',  2, attr_);


@Kelum Pradeep Kumara  I tried as suggested. In the report archive, I could still see  only 1 report.


Reply