Solved

error with .rpl printout triggered by PL SQL

  • 22 July 2021
  • 2 replies
  • 59 views

Userlevel 2
Badge +6

Hello,

problem with IFS 9 

 

we want to trigger a label printout via event. 

We have created an event that only works when the label template is .rdl

 

If the template is .rpl, it fails with an error : PluginExecute Failed . null 

 

 

if we manually print a label (.rpl template) from the report archive, it works - 

does not only work for the PL SQL event

 

my event: 

 

DECLARE

   report_id_           VARCHAR2(200) := 'INV_LABEL_REP'; --wskazanie raportu

   report_attr_         VARCHAR2(2000);

   parameter_attr_      VARCHAR2(2000);

   message_attr_        VARCHAR2(2000);

   archiving_attr_      VARCHAR2(2000);

   msg_                 VARCHAR2(32000);

   pallet_id_           VARCHAR2(32000):='1597'; 

   layout_name_         VARCHAR2(32000):='test.rpl'; 

   l_plsql_ VARCHAR2(32000);

   parameter_attr_ VARCHAR2(32000);

   a1_ VARCHAR2(1) := Chr(39);

  

 

BEGIN

 

l_plsql_ :=

'

DECLARE

report_id_ VARCHAR2(2000 ):= '':REPORT_ID___'';

parameter_attr_ VARCHAR2(32000) := '':PARAMETER_ATTR___'';

report_attr_ VARCHAR2(32000);

tmp_attr_ VARCHAR2(32000);

printer_id_list_ VARCHAR2(32000);

options_ VARCHAR2(32000);

printer_id_ VARCHAR2(2000);

print_job_id_ NUMBER;

result_key_ NUMBER;

pallet_id_ varchar2(32000):='|| a1_ ||pallet_id_ || a1_ ||';

layout_name_ varchar2(32000):='|| a1_ ||layout_name_ || a1_ ||';

 

BEGIN

 

Client_SYS.Clear_Attr(report_attr_);

Client_SYS.Add_To_Attr(''REPORT_ID'',report_id_,report_attr_);

 

Client_Sys.Clear_Attr(parameter_attr_);

Client_Sys.Add_To_Attr(''PALLET_ID'', pallet_id_, parameter_attr_);

 

Client_Sys.Set_Item_Value(''LAYOUT_NAME'', layout_name_, report_attr_);

printer_id_ := Printer_Connection_API.Get_Default_Printer(Fnd_Session_API.Get_Fnd_User,report_id_);

Client_SYS.Clear_Attr(tmp_attr_);

Client_SYS.Add_To_Attr(''PRINTER_ID'', printer_id_, tmp_attr_);

Print_Job_API.New(print_job_id_, tmp_attr_);

 

Archive_API.New_Instance(result_key_, report_attr_, parameter_attr_);

 

Client_SYS.Clear_Attr(tmp_attr_);

Client_SYS.Add_To_Attr(''PRINT_JOB_ID'', print_job_id_, tmp_attr_);

Client_SYS.Add_To_Attr(''RESULT_KEY'', result_key_, tmp_attr_);

Print_Job_Contents_API.New_Instance(tmp_attr_);

 

Logical_Printer_API.Enumerate_Printer_Id(printer_id_list_);

IF (printer_id_list_ IS NOT NULL) THEN

IF (print_job_id_ IS NOT NULL) THEN

Print_Job_API.Print(print_job_id_);

END IF;

END IF;

 

END;

';

 

l_plsql_ := REPLACE(l_plsql_,':REPORT_ID___',report_id_);

C_Deferred_Call_API.Register(l_plsql_,'Generowanie raportu '||report_id_);

 

END;

 

 

 

 

 

if    layout_name_         VARCHAR2(32000):='test.rpl';  - dont work 

if    layout_name_         VARCHAR2(32000):='test.rdl';  - its work

icon

Best answer by Randini Jayasundara 26 July 2021, 07:00

Hi @DominikaM 

Add below highlighted statement to the tmp_attr_ before calling Print_Job_Contents_API.New_Instance(tmp_attr_) and check.

Client_SYS.Clear_Attr(tmp_attr_);

Client_SYS.Add_To_Attr(''PRINT_JOB_ID'', print_job_id_, tmp_attr_);

Client_SYS.Add_To_Attr(''RESULT_KEY'', result_key_, tmp_attr_);

Client_SYS.Add_To_Attr(''OPTIONS'', ''COPIES(1)'', tmp_attr_);

Print_Job_Contents_API.New_Instance(tmp_attr_);

View original

2 replies

Userlevel 5
Badge +7

Hi @DominikaM 

Add below highlighted statement to the tmp_attr_ before calling Print_Job_Contents_API.New_Instance(tmp_attr_) and check.

Client_SYS.Clear_Attr(tmp_attr_);

Client_SYS.Add_To_Attr(''PRINT_JOB_ID'', print_job_id_, tmp_attr_);

Client_SYS.Add_To_Attr(''RESULT_KEY'', result_key_, tmp_attr_);

Client_SYS.Add_To_Attr(''OPTIONS'', ''COPIES(1)'', tmp_attr_);

Print_Job_Contents_API.New_Instance(tmp_attr_);

Userlevel 2
Badge +6

Hi @DominikaM 

Add below highlighted statement to the tmp_attr_ before calling Print_Job_Contents_API.New_Instance(tmp_attr_) and check.

Client_SYS.Clear_Attr(tmp_attr_);

Client_SYS.Add_To_Attr(''PRINT_JOB_ID'', print_job_id_, tmp_attr_);

Client_SYS.Add_To_Attr(''RESULT_KEY'', result_key_, tmp_attr_);

Client_SYS.Add_To_Attr(''OPTIONS'', ''COPIES(1)'', tmp_attr_);

Print_Job_Contents_API.New_Instance(tmp_attr_);

Thanks, its work! 

Reply