Infor LN Report Script Template Generator
This generator writes a report script for an Infor LN 10.x report: declaration, before.program and after.program, header and detail layout sections, a condition that suppresses a detail line and a running total. Report scripts are the classic way to add logic to an LN report when the program script cannot be changed.
Fill in
Header and declaration
|****************************************************************************** |* Report script for tdsls440101000 |* Author: AJ |****************************************************************************** declaration: table ttdsls401 double total.qoor long lines.printed
Program sections
before.program: | runs once before the first layout is printed total.qoor = 0 lines.printed = 0 after.program: | runs once after the last layout | for example write a log line with lines.printed
Layout sections
header.1: before.layout: | runs before the page header layout is printed detail.1: before.layout: | suppress this line when the condition holds if tdsls401.qoor = 0 then lattr.print = false endif after.layout: | runs only after the line was printed total.qoor = total.qoor + tdsls401.qoor lines.printed = lines.printed + 1
Edit the script in Reports (ttadv3530m000); it compiles with the report. Layout names such as header.1 and detail.1 must match the layouts defined in your report. To print the running total variable on a footer layout, add it as a report field; check in the Report Script Features part of the Infor ES Programmer's Guide how your Tools version exposes script variables and which predefined lattr variables it supports.
Rationalise your LN custom reports
Send us your list of custom reports and scripts, and we will flag which can move to Report Designer and which still need scripts.
Optional. The tool and every export work without this. No spam.
How to use it
Enter the report code, the main table the report prints, the quantity field you want totalled and the condition under which a detail line should not print. Open the report in Reports (ttadv3530m000) in your own VRC, open its script, paste the blocks and compile the report: the script compiles with it. The layout section names in the script must match the layouts of the report, so check whether your report uses detail.1 or a higher number and whether it has a header layout. Remove sections you do not use.
Report script structure
Infor describes report scripts as event sections written like 4GL program scripts, with their own sections and some special functions. Program sections such as declaration, before.program and after.program run once. Report sections correspond to layouts, such as header and detail, and each can run code before the layout and after it. Text field sections handle text fields. Report scripts let you run extra queries, calculate and aggregate complex print expressions, update database rows, add fields from tables the program script does not read, and change predefined variables such as whether a layout prints.
- before.layout: set values or suppress the layout
- after.layout: totals and counters that must only include printed lines
- lattr.print = false: the layout is not printed this time
Worked example
With the defaults the script skips sales order lines with an ordered quantity of zero. In detail.1 before.layout it sets lattr.print to false for those lines, so after.layout does not run for them and the running total of tdsls401.qoor counts only lines that appear on paper. Because the total is accumulated after printing, it always matches the printed lines, which is the usual cause of totals that disagree with the visible detail when people accumulate in before.layout instead.
Report scripts or Report Designer
Report scripts change behaviour at the source and travel with the report in your VRC, so they suit logic every user of that report needs. For layout changes, personal variants and modern output, LN 10.x offers Report Designer, with its own development guide. If all you need is a different look or an extra field already in the data, use Report Designer and avoid a script. If you need suppression rules, extra queries or calculated totals, a report script is still the direct tool.
Frequently Asked Questions
How do I suppress a line in an Infor LN report?
In the report script, in the before.layout section of that layout, set lattr.print to false when your condition holds. The layout is not printed for that record and its after.layout section does not run. Confirm the predefined variable list for your Tools version in the Programmer's Guide.
Where do I edit an LN report script?
In Reports (ttadv3530m000). Select the report in your customer VRC, open the script and edit it. The script is compiled automatically when you compile the report, so there is no separate compile step in Program Scripts / Libraries.
Is there an Infor LN Report Designer development guide?
Yes, Infor publishes a Report Designer development guide for LN 10.x on docs.infor.com. It covers designing and personalising report layouts. Report scripts are covered separately in the Report Script Features part of the Infor ES Programmer's Guide.
Why does my report total not match the printed lines?
Usually because the total is accumulated in before.layout, which runs even for lines that are then suppressed, or because the condition is evaluated in a different layout. Accumulate in after.layout of the detail layout so only printed lines count.
If your users mostly want answers that today need a custom report, we can let them ask LN in plain English on your own servers, with the query shown.
Related Tools
Infor LN 4GL Embedded SQL Select Generator
Fill in a table, columns and a where clause and get a Baan / Infor LN embedded SQL select loop with host variables, index ordering and selectempty and selecterror handling.
Developer ToolsInfor LN DAL Script Template Generator
Generate a Data Access Layer (DAL) script skeleton for an LN table with object hooks, a field check hook, a mandatory hook and error message handling.
Infor LN & BaanInfor LN 4GL Session Script Template
Generate a clean Baan / Infor LN 4GL session script skeleton with declaration, field, choice and table I/O sections.
More Developer Tools tools
See all- Infor LN DAL and User Exit Hook Functions Reference
- Infor LN User Exit (UE) DLL Template Generator
- Infor LN ION API OAuth 2.0 REST Call Generator (Python)
- Infor LN Inbound Process.SalesOrder BOD XML Template
- SAP Sales Order ABAP SELECT Generator (VBAK, VBAP, VBFA)
- SAP Sales Order Create BAPI ABAP Generator (BAPI_SALESORDER_CREATEFROMDAT2)
- SAP ABAP Open Items SELECT Generator
- SAP ACDOCA SQL Query Generator
- SAP QM Inspection Lot ABAP SELECT Generator
Keep exploring
Free tools
- Infor LN 4GL Session Script TemplateGenerate a clean Baan / Infor LN 4GL session script skeleton with declaration, field, choice and table I/O sections.
- Infor LN DAL Script Template GeneratorGenerate a Data Access Layer (DAL) script skeleton for an LN table with object hooks, a field check hook, a mandatory hook and error message handling.
- Infor LN Session Test Script TemplateUAT test script for an LN process or session with prerequisites, numbered steps, expected results and tester sign-off.
ERP fixes and how-tos
- Infor LN Report Designer: How to Build and Personalize ReportsHow reports are built and personalized in Infor LN: LN Studio's report designer, copying standard reports to a customer VRC, layouts, scripts and a safe workflow.
- Infor LN 10.7 Pick Note Configuration in Warehouse OutboundConfigure pick notes in Infor LN 10.7 warehouse outbound: the parameters, outbound procedures, document layout and the checks that stop picking documents printing.
- Infor LN Reports Stuck in the Print Queue: Device and Spooler FixInfor LN reports sit in the print queue and never print when a device goes offline. Check the device definition, the spooler, and fix the queue fast.
Guides
- Infor LN Printing and Report Design GuideDesign Infor LN reports and configure printing. Report session development, document output, label printing, and Crystal Reports integration for LN.
- Infor LN Report Development: Complete GuideCreate and customize Infor LN reports using BShell report sessions, Crystal Reports integration, and Infor Document Output Management for BAAN/LN systems.
- Infor LN BShell Customization GuideMaster Infor LN BShell customization. 4GL programming patterns, session scripting, DLL extensions, and upgrade-safe customization techniques.
Integrations
- How to add AI agents to Infor LNHow to add AI agents to Infor LN: a tool layer over ION API and BODs, read-only reporting first, approval before writes, and fully on-prem model hosting.
- How to use ChatGPT with Infor LNHow to use ChatGPT with Infor LN: exporting data versus live access through ION API, custom GPT actions, enterprise data controls, and when a private model fits better.