I was able to get this to work thanks to some code posted on this community site. That is greatly appreciated. Here are the steps I took to get it to run:
1. Created a label that used the ARRIVAL_REPORT_REP view
2. added new report to Arrival Report Report Definition
3. Created a custom action in our custom api using the following code:
PROCEDURE Print_Arrival_PO_Label__ (
source_ref1_ IN varchar2,
source_ref2_ IN varchar2,
source_ref3_ IN varchar2,
source_ref4_ IN varchar2,
receipt_no_ IN number)
IS
layout_name_ VARCHAR(2000):='PoRecLabel.rpt';
report_id_ VARCHAR2(2000):= 'ARRIVAL_REPORT_REP';
report_attr_ VARCHAR2(2000):= '';
parameter_attr_ VARCHAR2(2000):= '';
distribution_list_ VARCHAR2(2000):= '';
instance_attr_ VARCHAR2(2000):= '';
print_job_id_ VARCHAR2(2000):= '';
printer_attr_ VARCHAR2(2000):= '';
printer_id_ VARCHAR2(2000):= 'ZEBRA_RECEIVING';
result_key_ VARCHAR2(2000):= '';
attr_ VARCHAR2(2000):= '';
BEGIN
--get attributes needed from (create new schedule report)
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.add_to_attr('LANG_CODE', 'en', report_attr_);
client_sys.clear_attr(parameter_attr_);
client_sys.add_to_attr('SOURCE_REF1', source_ref1_, parameter_attr_);
client_sys.add_to_attr('SOURCE_REF2',source_ref2_, parameter_attr_);
client_sys.add_to_attr('SOURCE_REF3',source_ref3_, parameter_attr_);
client_sys.add_to_attr('SOURCE_REF4',source_ref4_, parameter_attr_);
client_sys.add_to_attr('SOURCE_REF_TYPE_DB','PURCHASE_ORDER', parameter_attr_);
client_sys.add_to_attr('RECEIPT_NO',receipt_no_, parameter_attr_);
client_sys.clear_attr(attr_);
client_sys.add_to_attr('PRINTER_ID', printer_id_, attr_);
archive_api.new_client_report(result_key_, report_attr_, parameter_attr_, distribution_list_, printer_attr_ );
archive_api.get_info(instance_attr_, parameter_attr_,result_key_);
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_);
COMMIT;
END Print_Arrival_PO_Label__;
4. Created an event RECEIPT_INFO_MODIFIED to trigger the custom action to fire every time a new arrival report is printed to generate the label result key sql provided:
DECLARE
a_ VARCHAR2(32000) := NULL;
BEGIN
CLIENT_SYS.Clear_Attr(a_);
CLIENT_SYS.Add_To_Attr('SOURCE_REF1_', '&NEW:SOURCE_REF1' , a_);
CLIENT_SYS.Add_To_Attr('SOURCE_REF2_', '&NEW:SOURCE_REF2' , a_);
CLIENT_SYS.Add_To_Attr('SOURCE_REF3_', '&NEW:SOURCE_REF3' , a_);
CLIENT_SYS.Add_To_Attr('SOURCE_REF4_', '&NEW:SOURCE_REF4' , a_);
CLIENT_SYS.Add_To_Attr('RECEIPT_NO_', '&NEW:RECEIPT_NO' , a_);
Transaction_SYS.Deferred_Call('XXX_Custom_Event_Util_Api.Print_Arrival_PO_Label__','PARAMETER', a_ , 'Print Arrival PO Label');
END;
5. setup a report rule to print the label to the zebra printer anytime that report title is printed.
6. Make sure the zebra printer is added to Print Agent