Infor LN & BaanFree generatorPDF, Excel, Word exportInfor LN

Infor LN SQL Query Generator for Oracle and SQL Server

Infor LN and Baan keep each company's data in physical tables named from the package, module, table number and company. This generator builds that name for you and gives you safe, read-only SQL for the common checks.

Fill in

The schema that owns the LN tables in your database. Check with your DBA.

Logical table name without the leading t and without the company number.

Three digit LN company number appended to the physical table name.

Column used to join header to lines and to filter.

Generated code
Download:

Filtered select on the header table

SELECT *
FROM baandb.ttdsls400100
WHERE t_orno BETWEEN 100000 AND 100999
ORDER BY t_orno;

Header joined to lines

SELECT h.t_orno, l.*
FROM baandb.ttdsls400100 h
JOIN baandb.ttdsls401100 l
  ON l.t_orno = h.t_orno
WHERE h.t_orno BETWEEN 100000 AND 100999
ORDER BY h.t_orno;

Row counts for reconciliation

SELECT COUNT(*) AS header_rows
FROM baandb.ttdsls400100;

SELECT COUNT(*) AS line_rows
FROM baandb.ttdsls401100;

Lines without a header (orphan check)

SELECT l.t_orno
FROM baandb.ttdsls401100 l
LEFT JOIN baandb.ttdsls400100 h
  ON h.t_orno = l.t_orno
WHERE h.t_orno IS NULL;

Use read-only database accounts and run heavy queries on a replica or off hours. Column names beginning t_ and the table naming pattern t + package + module + number + company are standard in LN, but confirm column names for your table in the data dictionary. Item codes are often stored with leading blanks, so use TRIM when comparing. Never write to LN tables with SQL: use sessions, DAL or the supported APIs.

Ask LN questions without writing SQL

An optional walkthrough of a read-only, role-aware question layer over your LN data.

Optional. The tool and every export work without this. No spam.

How to use the generator

Enter the schema that owns the LN tables, the logical table names for header and lines, your company number and the key range you care about. The four blocks update live: a filtered select, a header to line join, row counts and an orphan check. Copy the block you need into your SQL client, or export the whole set. Always start with a narrow key range, because LN tables can hold millions of rows and an unfiltered join will punish a shared database.

How LN physical table names work

A logical table such as tdsls400 belongs to package td, module sls, table number 400. In the database it becomes t, then the logical name, then the three digit company number, for example ttdsls400100. Columns follow the pattern t_ plus the field name, such as t_orno for the order number. Because the company number is part of the table name, the same query pattern runs against any company by changing one field.

  • Logical name: package (2 letters), module (3 letters), table number (3 digits)
  • Physical name: t + logical name + company number
  • Column name: t_ + field name
  • Check the data dictionary for exact columns before relying on them

Reading the results

Header and line counts should be in a sensible ratio for your business, and the orphan check should return no rows. Orphans usually point to a failed conversion load or a partially deleted record. Compare counts before and after a migration load, and keep the numbers in your cutover log. If a join returns far more rows than expected, a key is probably not unique on its own and needs a second column, for example a position number.

Common mistakes

The most common errors are querying the wrong company number, forgetting that item codes carry leading blanks, and running reports against the production database in office hours. A second trap is trusting SQL to show business meaning: enumerated fields are stored as numbers, and the text lives in the domain definition. Use SQL for data checks and reconciliation, and use LN sessions or DAL for anything that changes data.

Frequently Asked Questions

Can I use these queries on both Oracle and SQL Server?

The statements use standard SQL: SELECT, JOIN, BETWEEN and COUNT. They run on both databases once you set the right schema or owner. If your LN installation uses a different database, check identifier quoting and schema rules with your DBA before running them.

Is it safe to write to LN tables with SQL?

No. Direct updates bypass DAL checks, audit trails and referential logic, and can corrupt data in ways that sessions cannot repair. Use read-only SQL for analysis and use sessions, exchange schemes or supported APIs for any change.

Why does my item filter return nothing?

Item codes in LN are often stored with leading blanks to fill the segment width. A plain equality test on the visible code misses them. Apply TRIM to the column or match with the padded value, and verify with a known item first.

How do I find the right table name?

Open the session in LN, use the about or table information option to see the tables it uses, or search the data dictionary by field name. Then plug the logical name into this generator.

If your team writes the same LN queries every week, we can put a governed question layer over the data so people ask in plain language and see the SQL it ran.