Infor LN 4GL Script Template (Baan 4GL Skeleton)
Baan and Infor LN session scripts follow a fixed structure of named sections: declaration, program events, field events, choice events, table I/O and functions. This generator fills a clean skeleton with your session, table and field names so you do not retype the boilerplate for each new customization.
Fill in
Header and declaration
|****************************************************************************** |* tccuz1500m000 4GL script |* Purpose: Validate item group on save |* Author : AJ Date: 2026-10-20 |* Change : initial version |****************************************************************************** declaration: table ttcibd001 | main table string descr(80) long retval extern domain tcmcs.str80 msg.text
Program and form events
before.program: | one-time initialization, read parameters retval = 0 after.program: | cleanup, release resources after.form.read: | runs after the form is built after.update.db.commit: | runs after a commit of an update
Field and choice sections
field.tcibd001.citg:
when.field.changes:
| react to a change
descr = "citg changed"
check.input:
| validate the entered value
if isspace(tcibd001.citg) then
set.input.error("")
| replace with a message code from your message table
endif
choice.update.db:
on.choice:
| runs before the record is updated
after.choice:
| runs after the standard actionTable I/O and functions
main.table.io:
before.write:
| last chance to change or reject the record
after.write:
| follow-up logic
functions:
function extern long tcibd001.check.sample(long mode)
{
| Validate item group on save
return(0)
}This is a structural skeleton. Section names, available events and function signatures vary by Baan or LN version and by whether you work in a 4GL session script or a DAL script. Prefer a DAL script for rules that must hold for every entry path, and test in a non-production company. Replace message handling with your own message codes.
Customization inventory for your LN estate
Optional: discuss how to catalog and explain your 4GL and DAL customizations before an upgrade.
Optional. The tool and every export work without this. No spam.
How to use the generator
Enter the session code, the main table and the field you want to react to. The output is split into blocks: header and declaration, program and form events, field and choice sections, and table I/O with functions. Copy the blocks into the script editor of the session in the Tools application development environment, then delete the sections you do not need. Keeping only the events you use makes the script easier to read and to upgrade later.
How the sections behave
Declaration holds tables, variables and external references. before.program and after.program run once per session start and end. Field sections such as when.field.changes and check.input react to a user editing a field, and choice sections wrap standard actions like update.db with before and after code. main.table.io intercepts reads and writes of the main table. Functions hold reusable code. Which event fires first can matter, so test the order in your version.
- Use check.input for validation, when.field.changes for dependent values
- Use choice sections to extend a standard action
- Keep logic in functions, not scattered over events
Common mistakes and upgrade notes
Putting business rules only in a session script means a different entry path, such as an import or a BDE, skips them. Rules that must always hold belong in the table's DAL. Hard-coded text instead of message codes breaks translation. Customizations placed in standard sessions rather than a customer VRC are overwritten at the next upgrade, and long-lived scripts without a change header are hard to reconcile. Document each change and keep the diff against the standard script.
Frequently Asked Questions
What is a 4GL script in Baan and Infor LN?
It is the script attached to a session that controls its behavior through named sections such as declaration, field events, choice events and table I/O. It is written in the Baan 3GL/4GL language in the Tools application development environment.
Should I use a 4GL session script or a DAL script?
Use a session script for behavior tied to one screen. Use a DAL script on the table for rules that must hold however data enters, including imports and integrations. Many customizations need both, with the data rule in the DAL.
Will customizations survive an LN upgrade?
Only if they live in your own customer VRC and are documented. Changes in standard components can be overwritten. Review each customization before an upgrade and retire any that standard functionality now covers.
Does this template work for Baan IV?
The section idea is shared, but exact event names, available functions and syntax details differ by version. Use it as a starting structure and check against a working script in your own environment.
If you are inventorying legacy 4GL and DAL customizations ahead of an upgrade or migration, we can discuss how an AI assistant reads and documents them on-prem.
Related Tools
Infor LN DAL Hook Review Checklist
Review checklist for LN data access layer (DAL) scripts: hook choice, validation, error handling, performance and upgrade safety.
Infor LN & BaanInfor LN Table Name and SQL Query Builder
Turn an LN logical table such as tcibd001 into the physical SQL table name with company suffix and a ready SELECT statement.
Infor LN & BaanInfor LN Session and Module Code Reference
Searchable list of the Infor LN / Baan package and module codes (tisfc, tdsls, whinh and others) with what each one covers.
Infor LN & BaanInfor LN Regression Test Effort Calculator
Estimate test hours, defects and calendar weeks for an LN upgrade or change, and see how adding testers shortens the schedule.
More Infor LN & Baan tools
See all- Infor LN Production Order Status and Lifecycle Reference
- Infor LN Company and Enterprise Unit Design Worksheet
- Infor LN Warehousing Order Origins and Types Reference
- Infor LN and Baan Customization Inventory Worksheet
- Baan to Infor LN Data Conversion Mapping Worksheet
- Infor LN User Role and Authorization Matrix Worksheet
- Infor LN Change Request Form Template
- Infor LN Session Test Script Template
- Infor LN Cutover Runbook Template
New to Infor LN and Baan? Start with the Infor LN and Baan guide and toolkit, or plan with Training Path Builder, Upgrade Path Planner, ERP Table and Field Explorer.
Keep exploring
Free tools
- Infor LN Session Test Script TemplateUAT test script for an LN process or session with prerequisites, numbered steps, expected results and tester sign-off.
- Infor LN Report Script Template GeneratorGenerate a 4GL report script for an LN report with program sections, layout sections, a suppress condition and a running total.
- Infor LN Session and Module Code ReferenceSearchable list of the Infor LN / Baan package and module codes (tisfc, tdsls, whinh and others) with what each one covers.
ERP fixes and how-tos
- Infor LN DAL Out of Sync After a Custom Field: Cause and FixInfor LN throws a DAL out of sync error after a custom field is added. Here is why table admin and DAL regeneration must run together, and the fix.
- How to create a custom session in Infor LN StudioBuild a custom maintenance or overview session in Infor LN Studio from a table, wire up authorization and menus, and deploy it safely through your VRCs.
- Cannot Find Session Info in Baan and Infor LN: Causes and FixFix the cannot find session info error in Baan and Infor LN: session missing from the VRC or runtime dictionary, package mismatch, and how to reconvert.
Guides
- Infor LN BShell Customization GuideMaster Infor LN BShell customization. 4GL programming patterns, session scripting, DLL extensions, and upgrade-safe customization techniques.
- BAAN to Infor LN: Backward Compatibility and Migration StrategiesNavigate BAAN backward compatibility in Infor LN. Legacy 4GL code migration, session mapping, table structure changes, and BaanIV to LN transition strategies.
- Infor LN Session Programming GuideComplete guide to Infor LN session programming. Session architecture, form design, data handling, and business logic implementation for LN developers.