Infor LN & BaanFree generatorPDF, Excel, Word exportInfor LN

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

Generated code
Download:

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 action

Table 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.