Solved

How to silently print a report and check-in that to document management


Userlevel 3
Badge +7

Hi,

I am working the purchase order screen and introduced a new command. When the user click this command a report should generate for the purchase order and automatically check-in that to document management. (Here print dialog is not opening)

How to achieve this in the server side?

Regards,
Tharindu

icon

Best answer by tharindukshan 31 March 2021, 08:01

View original

This topic has been closed for comments

12 replies

Userlevel 7
Badge +30

Hi Tharindu,

I think you can do this with the report rule engine. And someone discussed this, or something similar, here:

https://community.ifs.com/topic/show?tid=5723&fid=43

/Mathias

 

Userlevel 3
Badge +7

Hi Mathias,

It does the job with the Print Dialog screen. In my case the printing should happen without the print dialog.
How to trigger the same thing in that case ?

Regards,
Tharindu

Userlevel 7
Badge +30

I don’t know that, sorry.

 

Userlevel 7
Badge +15

As Mathias said you can use a Report Rule called’ Check in to Docman” to check in the generated PDF report to document management. It’s doesn’t matter if you print it through the Print Dialog or not. You need to print to a Logical Printer. If the print job is successfully completed then the rule is triggered and checked in to docman. There are lots of places in the IFS Application where printing is done directly without showing the Print Dialog.

Userlevel 7
Badge +15

In the “Inventory Part Barcodes Analysis” page select a row and select “Print Barcode Label” button at the top or from the menu. You will be asked to print without preview or not. If you select “Yes” to print without preview, it will directly put a print job. If you follow that you can find the code on how to do so, and with the Report Rule, you can checkin to docman.

Userlevel 7
Badge +20

Hi @tharindukshan ,

 

Following thread has some good examples on how to create a print job and print.

 Batch print Work Instructions for Shop Orders, IFS9 | IFS Community

 

Check-in the pdf to docman:

If the report rules does not work in favor, you can create an event action in PDF_REPORT_CREATED and do the coding. 

Attached script is something I prepared for a similar requirement and it has the code you’ll need to create a docman object, check-in report pdf and create a doc reference in Inventory part. Hope it will be useful. It’s prepared for APPS10 but most probably will work in APPS9 without a complain. Not sure about cloud version.

 

Cheers!

Damith

Userlevel 3
Badge +7

Thank you @Mathias Dahl @ChanakaAmarasekara & @dsj for the support.
With all your help and this post I was able to achieve the result I expected. :)

Regards,

Tharindu

Userlevel 7
Badge +30

Thank you @Mathias Dahl @ChanakaAmarasekara & @dsj for the support.
With all your help and this post I was able to achieve the result I expected. :)

That’s great to hear! Would it be possible to share some of the details here? For example, if you used a report rule engine, can you share the rules? Others might be very interested in trying out the same thing.

Thanks!

 

 

Userlevel 3
Badge +7

Hi @Mathias Dahl 

Here you go😊

1.  We use the report rule to attach the generated PDF to the Document Management

   

2 . Then We use the server method to print the report to a logical printer as it’ll trigger the                       reporting rule

PROCEDURE C_Silent_Print_Po (
order_no_ IN VARCHAR2)
IS
layout_name_ VARCHAR2(2000):= 'PurchaseOrderPrintRep.rdl';
report_id_ VARCHAR2(2000):= 'PURCHASE_ORDER_PRINT_REP';
report_attr_ VARCHAR2(2000):= '';
parameter_attr_ VARCHAR2(2000):= '';
instance_attr_ VARCHAR2(2000):= '';
print_attr_ VARCHAR2(2000):= '';
attr_ VARCHAR2(2000):= '';
distribution_list_ VARCHAR2(2000):= '';
print_job_id_ VARCHAR2(2000):= '';
printer_id_ VARCHAR2(2000):= 'No Printout,SERVER,NO_PRINTOUT';
result_key_ VARCHAR2(2000):= '';
BEGIN
Client_SYS.Clear_Attr(report_attr_);
Client_SYS.Add_To_Attr('REPORT_ID', report_id_, report_attr_);
Client_SYS.Add_To_Attr('LAYOUT_NAME', layout_name_, report_attr_);

Client_SYS.Clear_Attr(parameter_attr_);
Client_SYS.Add_To_Attr('ORDER_NO_LIST', order_no_, parameter_attr_);

Client_SYS.Clear_Attr(print_attr_);
Archive_API.New_Client_Report(result_key_, report_attr_, parameter_attr_, distribution_list_,
print_attr_);

Archive_API.Get_Info(instance_attr_,parameter_attr_,result_key_);

Client_SYS.Clear_Attr(attr_);
Client_SYS.Add_To_Attr('PRINTER_ID', printer_id_, attr_);

Print_Job_API.New(print_job_id_,attr_);
Client_SYS.Add_To_Attr('PRINT_JOB_ID', print_job_id_, instance_attr_);
client_SYS.Add_To_Attr('RESULT_KEY', result_key_, instance_attr_);

Print_Job_Contents_API.New_Instance(instance_attr_);
Print_Job_API.Print(print_job_id_);
END C_Silent_Print_Po;

 

Userlevel 7
Badge +30

Thanks! What is calling that server method? A custom event? A custom menu?

 

Userlevel 3
Badge +7

Hi @Mathias Dahl ,

In my case I’m calling that method through a command in Aurena.

Userlevel 7
Badge +30

Hi @Mathias Dahl ,

In my case I’m calling that method through a command in Aurena.

Thanks!