Solved

Print a delivery note by code

  • 27 April 2023
  • 3 replies
  • 202 views

Badge +3
  • Do Gooder (Customer)
  • 2 replies

Hi everybody,

I am using IFS v9 and I need to print a particular delivery note via pl/sql.
I have tried the following code (which I am not sure will work)

set SERVEROUTPUT ON

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
IFSAPP.Client_SYS.Clear_Attr(report_attr_);
IFSAPP.Client_SYS.Clear_Attr(parameter_attr_);
IFSAPP.Client_SYS.Add_To_Attr('REPORT_ID', 'SHIPMENT_DELIVERY_NOTE_REP', report_attr_);
IFSAPP.Client_SYS.Add_To_Attr('DELNOTE_NO', 200, parameter_attr_);
printer_id_ := IFSAPP.Printer_Connection_API.Get_Default_Printer('IFSAPP', 'SHIPMENT_DELIVERY_NOTE_REP');
DBMS_OUTPUT.PUT_LINE('printer_id : ' || printer_id_ );
IFSAPP.Client_SYS.Clear_Attr(attr_);
IFSAPP.Client_SYS.Add_To_Attr('PRINTER_ID', printer_id_, attr_);
IFSAPP.Print_Job_API.New(print_job_id_, attr_);
IFSAPP.Archive_API.New_Instance(result_key_, report_attr_, parameter_attr_);
DBMS_OUTPUT.PUT_LINE('RESULT_KEY : ' || result_key_ );
IFSAPP.Client_SYS.Clear_Attr(attr_);
IFSAPP.Client_SYS.Add_To_Attr('PRINT_JOB_ID', print_job_id_, attr_);
IFSAPP.Client_SYS.Add_To_Attr('RESULT_KEY', result_key_, attr_);
IFSAPP.Client_SYS.Add_To_Attr('OPTIONS', 'COPIES(1)', attr_);
IFSAPP.Print_Job_Contents_API.New_Instance(attr_);
IF (print_job_id_ IS NOT NULL) THEN
IFSAPP.Print_Job_API.Print(print_job_id_);
END IF;
END;

and I get the following error.

ORA-20111: UserAllowedSite.RECNOTEXIST: Site  is not allowed for User TBO

What should I do to solve it ?
Thank you for your help.

icon

Best answer by Tonio 10 May 2023, 17:12

View original

3 replies

Userlevel 6
Badge +17

Hi @Tonio,

Add the site to user ID :TBO in the below screen for which you are executing the query 

 

Regards,

Mithun K V

Badge +3

Hi @EqeMithuV

Thank you for this first response, I no longer have a blockage.
However, the editing seems to be triggered but nothing happens.

I added traces

printer_id_ : No Printout,SERVER,NO_PRINTOUT
print_job_id_ : 56589
result_key_ : 57890
ApplicationMessage JMS Trigger: application_message_id [370232] queue [BATCH2] execution_mode [insequence] restricted_queue_thread_no [] priority []
Batch_Processor_Jms_API.Send_Jms_Message: Dbms_AQ.Enqueue completed in [0] sec
Released print job [56589] on printer [NO_PRINTOUT] using application message [370232]

and when testing the existence of the result_key 57890 in the SHIPMENT_DELIVERY_NOTE_REP view, there is nothing with this value; the previous and next value exist.

If anyone has a solution to fix this or generate the delivery note output in another way, I'm a taker.

Thanks

Badge +3

Eureka !

The initial code is good, stupidly, it just lacks a Commit to validate the procedure.

Thanks to everyone who took the time to read my request.

Reply