Question

Unable to print multiple copies of an order report

  • 8 April 2022
  • 9 replies
  • 365 views

Userlevel 2
Badge +7

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;


9 replies

Userlevel 7
Badge +18

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

Userlevel 2
Badge +7

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

Userlevel 7
Badge +18

Hi @Mounika 

What is the IFS Application version you are using? APPS10?

Userlevel 2
Badge +7

@Kelum Pradeep Kumara 

Yes, I am using  APPS10 UPD10

Userlevel 2
Badge +7

@Kelum Pradeep Kumara Did you try running the above script with Client_SYS.Add_To_Attr('COPIES',  2, attr_); ? Were you able to see two records in Report Archive?

Userlevel 6
Badge +14

Hi @Mounika ,

This looks like bug. Copies it not saved to the xml file:

 

A workaround could be to first print to ‘no_printout’, wait for it to complete, change the printer and print again. That would give you 2 copies.

  

PRAGMA AUTONOMOUS_TRANSACTION;

...

print_job_api.Set_Printer_Id(print_job_id_,'NO_PRINTOUT');
print_Job_API.Print(print_job_id_);
commit;
DBMS_LOCK.Sleep(5); --replace with loop on print job status
print_job_api.Set_Printer_Id(print_job_id_,printer_id_);
print_Job_API.Print(print_job_id_);
commit;

I have not tried it.

 

Userlevel 2
Badge +7

@Kelum Pradeep Kumara The workaround was the first solution that came to the mind, but this will not meet our requirement. Raised a case to IFS long back but there is no reply from them. IFS should give us the feasibility to be able to print multiple copies. Let’s wait and see what IFS has to say.

Badge +2

We are facing the same issue with one of our order reports. Did you get any update from IFS for the case you raised @Mounika ?

Userlevel 2
Badge +7

Hi @DINSLK,

IFS said that if we use .NET print agent then there should not be any problem. But we have downgraded to Java version of print agent. So IFS could not investigate the issue.

If your client is on .NET print agent, may be IFS can help you if you raise a case to them.

 

Note: IFS said that if we provide the no of copies in the print dialog when printing a report from RMB of any screen, then there would not be 2 pdfs in the report archive. Instead the printer will directly print the number of copies you have provided.

Reply