Question

How to Print Pdf report automatically


Userlevel 3
Badge +7

Hello, 

I need to get Pdf report sent to the default Printer .when the shipment’s status change to Closed .

 

Thanks,

 

 


14 replies

Userlevel 3
Badge +8

Hi @jzouaoui ,

Can you explain bit further? Do you want to get a pdf of already printed or generated report which set for the default printer or do you need to generate a new report when changing the shipment status?

 

Thanks,

Kavindu

Userlevel 3
Badge +7

Hello Kavin, 

I have an existing shipment report (name  :Dispatch_rep) .I want to get a pdf(Dispatch_rep) already printed to the default printer  . when the shipment status is Closed. 

 

Thank you.

Userlevel 3
Badge +8

Hi @jzouaoui ,

In your case we may have to save the result key value of the printed report in shipment window or some where else, using a custom or customized field. Then we can re-view that report from report archive in the moment of closing the shipment.  That’s the solution I can think of. 

 

Thanks..

Userlevel 3
Badge +7

But i need to send it automatically to the Printer . without opening to preview  the shipment Report . 

Scenario : when the shipment status changes ,the report Shipment will be send to the printer .

Thank you.

Userlevel 3
Badge +8

Hello,

@jzouaoui did you find the solution? I’m looking for the same functionality.

Best regards

Bartłomiej Pobocha

Userlevel 3
Badge +7

Non :( 

Userlevel 3
Badge +10

@jzouaoui I think you can use “Scheduled report” optionality to print reports automatically.

Userlevel 3
Badge +8

@ashen_malaka_ranasinghe for me it is impossible, because of error:
 

report hasn’t any parameters:

is there any other option?

Userlevel 1
Badge +7

Hı, 

You must write custom Event , when table of Logocal unit rowstate updated.

Userlevel 3
Badge +8

@alpamuk what function I need to execute in event?

Userlevel 3
Badge +8

below script connect PDF to existing report archive ADDITIONAL_INV_Q_R_CODE_REP, but I think it can be used for any other reports:

DECLARE

   result_key_ NUMBER := 179065;

   print_ATTR_ VARCHAR2(200);

   PRINT_JOB_ID_ NUMBER;

   LAYOUT_NAME_ VARCHAR2(200);

BEGIN

   CLIENT_SYS.CLEAR_ATTR(print_ATTR_);

   CLIENT_SYS.ADD_TO_ATTR('PRINTER_ID','PDF_PRINTER',PRINT_ATTR_);--printer_id_ := Printer_Connection_API.Get_Default_Printer(Fnd_Session_API.Get_Fnd_User, 'ADDITIONAL_INV_Q_R_CODE_REP');

   PRINT_JOB_API.NEW(PRINT_JOB_ID_, print_ATTR_);

   LAYOUT_NAME_ := REPORT_LAYOUT_DEFINITION_API.GET_DEFAULT_LAYOUT('ADDITIONAL_INV_Q_R_CODE_REP');

   CLIENT_SYS.CLEAR_ATTR(print_ATTR_);

   CLIENT_SYS.ADD_TO_ATTR('PRINT_JOB_ID',PRINT_JOB_ID_,print_ATTR_);

   CLIENT_SYS.ADD_TO_ATTR('RESULT_KEY',result_key_,print_ATTR_);

   CLIENT_SYS.ADD_TO_ATTR('LAYOUT_NAME',LAYOUT_NAME_,print_ATTR_);

   CLIENT_SYS.ADD_TO_ATTR('OPTIONS','COPIES(1)',print_ATTR_);

   CLIENT_SYS.ADD_TO_ATTR('LANG_CODE','en',print_ATTR_);

   CLIENT_SYS.ADD_TO_ATTR('LOCALE_LANGUAGE','en',print_ATTR_);

   CLIENT_SYS.ADD_TO_ATTR('LOCALE_COUNTRY','US',print_ATTR_);

   PRINT_JOB_CONTENTS_API.NEW_INSTANCE(print_ATTR_);

   PRINT_JOB_API.PRINT(PRINT_JOB_ID_);

END;  

Userlevel 3
Badge +7

@bartlomiej.pobocha  i would thank you about the reply and i have a question Please . Where did you get the result Key number ?

Userlevel 3
Badge +8

Hello @jzouaoui, from archive_tab:
 

 

Userlevel 2
Badge +6

@jzouaoui You can use a custom event to print the PDF automatically

Reply