====== Print Documents Automatically with Notification Listener ======
It is possible to automatize document printing with the help of the [[implementation:wms:edi_module#notification_listener|SBO Notification Listener]].
==== 1. List of documents====
List of documents that can be printed automatically with the standard solution
^ Document type ^ Object type code ^ Default report ^ Supported transactions ^ PMX_NOTQ Column ^
| pick list | PMX_PLHE | DefaultPickList.rpt | A U D L | DocEntry |
| sales order | 17 | | A C U L | DocEntry |
| purchase order | 22 | DefaultPurchaseOrder.rpt | A C U L* \\ *//*See: section 4// | DocEntry |
==== 2. Set the report====
=== 2.1. Customize the report ===
For reports, the Notification Listener will use the //Column// and //Key// values from the PMX_NOTQ table as the Crystal Report parameters. In order to print with the Notification Listener, change the input parameter of the report to the //Column// value.
{{ :implementation:howto:autoprint_notq.png|PMX_NOTQ}}
Open the default report in Crystal Reports. Go to Field Explorer and expand the Parameter Fields. Rename the parameter to //‘DocEntry’// (Column value).
{{ :implementation:howto:autoprint_rename.png |Rename}}
In the example we set the Notification Listener to print newly created pick lists automatically. The //Column// value in the PMX_NOTQ table is //‘DocEntry’// therefore in Crystal Reports we rename the standard ‘@pickListDocEntry’ to ‘DocEntry’.
Save it as a new report. Make sure that you save it to the folder that is defined for the reports on the [[implementation:wms:reports|‘Reports’ tab]] of the organizational structure.
In the example we save the report as //‘DefaultPickListForSBONotification.rpt’//.
=== 2.2. Define the report in the organizational structure ===
In order to use the pick list in other flows properly, create a separate entry for this report on the [[implementation:wms:reports|‘Reports’ tab]] of the organizational structure.
{{ :implementation:howto:autoprint_reportstab.png |Reports tab}}
==== 3. Configure the Notification Listener ====
Open the config file of the Notification Listener. Uncomment the following transaction line:
Adjust the following values in the transaction line:
* objectType: add the code of the object type. //See the list of the document types for the corresponding object type value.//
* transactionType: specify the transaction type. Possible values:
* 'A'=add
* 'U'=update
* 'L'=close
* 'D'=delete
* 'C'=cancel
* '*'=all \\ // Please note: Not every transaction type works for an object. Please see the table that contains the supported transaction types for each object//
* Printer: Add the printer code from the organizational structure as the value of the "PrinterDevice" parameter.
* Report path: Add the custom report as the value of the "ReportPath" parameter.
In our example we set the Notification Listener to automatically print newly generated pick lists. \\
Therefore the object type is “PMX_PLHE’ and the transaction type is ‘A’. The code of the printer is ‘Printer02’ and the report name is ‘DefaultPickListForSboNotification.rpt’. \\
//Please note that when a pick list is created, its status is ‘Not Ready’. When creating a similar setting than in the example, be aware that the Notification Listener will print the pick list in the non-ready state.//
When the Notification Listener is running the report is automatically printed after the transaction.
==== 4. Automatically print report for closed purchase orders on goods receipt ====
There is a special transaction line in the config file of the Notification Listener to print the purchase orders after a goods receipt. \\
Create a new report as described above.
In the configuration file of the Notification Listener, find and uncomment the following transaction line:
Adjust the printer and the report path as described above.