Skip to content

Instantly share code, notes, and snippets.

@damithsj
Created January 30, 2023 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damithsj/70fccd01d46a7ac6de60a4f587ef1b20 to your computer and use it in GitHub Desktop.
Save damithsj/70fccd01d46a7ac6de60a4f587ef1b20 to your computer and use it in GitHub Desktop.
Simple Create and Print Report IFS Commands
DECLARE
report_id_ VARCHAR2(100) := 'SHOP_ORD_WI_REP'; -- Report ID
report_attr_ VARCHAR2(2000);
parameter_attr_ VARCHAR2(2000);
distribution_list_ VARCHAR2(2000):= '';
result_key_ NUMBER;
printer_id_ VARCHAR2(100);
print_job_attr_ VARCHAR2(2000);
job_contents_attr_ VARCHAR2(2000);
print_job_id_ NUMBER;
instance_attr_ VARCHAR2(32000);
lang_code_ VARCHAR2(2);
printer_id_list_ VARCHAR2(32000);
BEGIN
------------------------------------------------------
-- (1) Create Archive instance
------------------------------------------------------
-- Create the report attr
CLIENT_SYS.Add_To_Attr('REPORT_ID', report_id_, report_attr_);
-- Add report parameters
CLIENT_SYS.Add_To_Attr('ORDER_NO', 'SO001' , parameter_attr_);
CLIENT_SYS.Add_To_Attr('RELEASE_NO', '1' , parameter_attr_);
CLIENT_SYS.Add_To_Attr('SEQUENCE_NO', '1' , parameter_attr_);
-- Create Archive instance.
-- It will return the result key
Archive_API.New_Instance(result_key_, report_attr_, parameter_attr_);
------------------------------------------------------
-- (2) Create Print Job and contents
------------------------------------------------------
-- Get the user default printer.
printer_id_ := Printer_Connection_API.Get_Default_Printer(Fnd_Session_API.Get_Fnd_User, report_id_);
Client_SYS.Add_To_Attr('PRINTER_ID', printer_id_, print_job_attr_);
-- Create Print job
Print_Job_API.New(print_job_id_, print_job_attr_);
Client_SYS.Add_To_Attr('RESULT_KEY', result_key_, job_contents_attr_);
Client_SYS.Add_To_Attr('PRINT_JOB_ID',print_job_id_,job_contents_attr_);
PRINT_JOB_CONTENTS_API.New_Instance(job_contents_attr_);
------------------------------------------------------
-- (3) Print!
------------------------------------------------------
Print_Job_API.Print(print_job_id_);
END;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment