7. Custom printing
7.1. Custom Layout Printing
Report printing can be customized in Produmex Scan by using the customization technology described in: Customization Technology for Produmex Scan. A report can be printed with user queries in the following cases:
- The report is defined in SAP Business One, or
- The report is located in a folder Produmex Service Broker can access.
7.1.1. Import the report
Use the HanaReportSettingTool to configure the correct connection of the report file in HANA environment. You can read more about the tool in the UserGuide
Import the report in SAP Business One with the Report and Layout Import Wizard. Select ‘Inventory > Inventory Reports’ as the location.
7.1.2. Examples
Example 1:
Add customization on the Done
button event for the Create GR PO screen
Create the user Query in the Query Manager. The name of the user query must be the name of the Produmex Scan event.
Include the report ID and the report parameters in the user query.
Query name: BXMobileWH9_CreateGoodsReceiptPOQuantitiesNormalScreen_OK_clicked
Example query:
SQL
SELECT 'RCRI0012' "PrintLayout$", SUBSTRING ($[TextItem], 1 , CHARINDEX ('*', $[TextItem]) - 2 ) "Print_ItemCode", SUBSTRING ($[TextItem], CHARINDEX ('*', $[TextItem]) + 2, LEN ($[TextItem])- CHARINDEX ('*', $[TextItem])) "Print_Item_ItemName", '' "Print_SerialNumber", '' "Print_BatchNumber", $[DataRepeater.SelectedUIOnHandQuantity] "Print_Quantity", 'PDFCreator' "PrintPrinter$", 'Document PRINTING' "Message$", 'I' "MessageType$"
HANA
SELECT 'RCRI0012' "PrintLayout$", SUBSTRING ($[TextItem] , 1 , LOCATE ($[TextItem], '*') - 2 ) "Print_ItemCode", SUBSTRING ($[TextItem], LOCATE ($[TextItem], '*') + 2, LENGTH ($[TextItem])- LOCATE ($[TextItem], '*') ) "Print_Item_ItemName", '' "Print_SerialNumber", '' "Print_BatchNumber", $[DataRepeater.SelectedUIOnHandQuantity] "Print_Quantity", 'PDFCreator' "PrintPrinter$", 'Document PRINTING' "Message$", 'I' "MessageType$" FROM DUMMY
The user query does the following:
Sets the parameters of the selected report to the values entered on the screen and sends it to the defined printer. Then displays the ‘Document printing’ message.
Report parameters in the example:
- Item code and name
- On hand quantity
- Batch number
- Serial number
Adjust the example query.
- Replace the PrintLayout$ value with the Report ID (in the example the report ID is RCRI0012).
- Replace the PrintPrinter$ value with your printer name (in the example the printer name is PDFCreator).
The label will be printed with the printer set in the user query regardless of the default printer of the employee.
By default only one label is printed. Adjust the value of the labels with the PrintCopies$ parameter.
The label is printed after the ‘Done’ button is pressed on the Create GR PO Quantities screen.
Example 2: Print label for the delivery selected on the Delivery field after the report ID is added on the Packing screen
Add a new custom ‘Label’ field. Insert the following record to the Customization Fields user table:
Field Name | Labels | Screen |
---|---|---|
RPTCode | Label | PackingScreen |
Create two new user queries in the Query Manager.
The first query will trigger the printing if the Label field is not empty. Link this user query to the RPTCode field validation event.
After the report ID is added to the field, a confirmation message will pop up. Press the Yes
button to print the label.
Query name: BXMobileWH9_PackingScreen_RPTCode_validate
IF $[RPTCode]<>'' AND $[TextDeliveryDocNum]<>'' SELECT 'Print labels: ' + $[RPTCode] AS 'Message$', 'YM' AS 'MessageType$'
The second query will define the printer and the report parameter values.
Link this user query to the validation_after event of the custom Label field. The query will run if the user presses the ‘Yes’ button on the confirmation message screen.
Query name: BXMobileWH9_PackingScreen_RPTCode_validate_after
IF $[RPTCode]<>'' AND $[TextDeliveryDocNum]<>'' SELECT $[RPTCode] AS PrintLayout$, (SELECT DocEntry FROM ODLN WHERE DocNum=$[TextDeliveryDocNum]) AS [Print_DocKey@], 'PDFCreator' AS PrintPrinter$, 'Report print: '+ $[RPTCode] AS 'Message$', 'I' AS 'MessageType$'
Replace the PrintPrinter$ value with your printer name (in the example the printer name is PDFCreator).
7.2. Advanced printing configurations for Produmex Scan
With the advanced printing configurations printing issues caused by incorrect server/database connection settings in Crystal Reports can be solved.
To add the advanced printing configurations, run the following query on the database:
SQL
INSERT INTO "VALI002"."@BXPCONFIG" ("Code", "Name", "U_BXPDescr", "U_BXPValue", "U_BXPVType", "U_BXPRowVr") VALUES('BXMPRAO', 'BXMPRAO', 'Crystal Reports connection parameters', '54', 1, NULL)
A new record will be inserted to the BXPCONFIG table. With this record the following parameters can be set:
- PRINTERADVANCEDOPTIONS_SETTABLELOGON = 1;
- PRINTERADVANCEDOPTIONS_SETTABLECONNECTION = 2;
- PRINTERADVANCEDOPTIONS_SETSUBREPORTS = 4;
- PRINTERADVANCEDOPTIONS_DISSOCIATESIZE = 8;
- PRINTERADVANCEDOPTIONS_USEPRINTERSETTINGS = 16;
- PRINTERADVANCEDOPTIONS_USECONNECTIONCLONE = 32;
- PRINTERADVANCEDOPTIONS_USESETTINGWITHNAME = 64;
The value of BXMPRAO is the sum of the value of the enabled parameters.
The default and recommended value is 54. It means that the Settable connection (2), the Set sub reports (4), the Use printer settings (16) and the Use connection clone (32) parameters are enabled (2+4+16+32=54) by default.
Do not change the default value. If the issue persists, please contact Produmex support.
Enabled settings:
- Settable connection (2): Creates a new connection structure with the actual parameters.
- Set sub reports (4): Applies the (1) and (2) setting to the sub reports as well.
- Use printer settings (16): Uses a non-standard access to printer settings.
- Use connection clone (32): Uses a clone of the connection structure.
Other settings that can be enabled:
- Settable log on (1): Resets the server/database connection to the actual in the tables of the existing structure. This setting is not taken into account if the Settable connection (2) setting is also enabled.
- Dissociate size (8): Enables the ‘Dissociate Formatting Page Size and Printer Paper Size’ option.
- Use setting with name (64): Uses both the standard and non-standard access to the printer settings.
Known cases:
* The error message 'Not supported within subreports'
Set the value to 1