Problem: You need to track whether a sale was shipped by Air, Road, or Rail.
Solution TDL Code:
[System: UDF] Add : Voucher Type : Sales : VoucherEntry : Field : Vch_transport[Voucher Type: Sales] Set : VoucherEntryField = TransportField
[Field: TransportField] Use : Field.Default Name : Vch_transport Caption : "Mode of Transport" Type : String Table : "Air", "Road", "Rail" Storage : Vch_transport_storage
[Storage: Vch_transport_storage] Persistant : Yes Type : String
Result: When you open a sales voucher in Tally ERP 9, a new dropdown appears asking for "Mode of Transport". This data gets saved with the voucher and can be printed. tdl for tally erp 9
Let’s look at two real-world scenarios where TDL solves problems.
Before you write your first line of code, you need to understand the hierarchy. TDL is not a linear script like Python; it is a collection of Objects.
The four primary objects in TDL are:
The TDL Execution Flow:
Tally ERP 9 has a built-in debugger.
Tally Definition Language (TDL) is a metadata-driven, XML-like scripting language used exclusively within the Tally ecosystem. Think of it as a "skin and logic" modifier. TDL files (usually with .txt or .tdl extensions) are loaded into Tally ERP 9 at runtime. Problem: You need to track whether a sale
When Tally ERP 9 starts, it reads its internal object definitions. But if you load a TDL file, Tally overrides or extends those definitions based on your instructions. This means you can:
The most important thing to know: No TDL code runs unless explicitly loaded. Tally ERP 9 will work perfectly without it, but TDL unlocks its true adaptive potential.
Verdict: TDL is the "secret sauce" that transforms Tally.ERP 9 from a rigid accounting software into a flexible, industry-specific business management solution. While it requires technical expertise to master, it is arguably the single biggest reason for Tally's dominance in the Indian market.
Create StockMRP.tdl:
[Report: Stock Item MRP] Title : "Stock Items with MRP" Type : Report Collection : Coll_StockItems[Collection: Coll_StockItems] Type : StockItem Fetch : Name, MRP, OpeningBalance
[Part: Part_StockItemMRP] Line : Line_ItemMRP Result: When you open a sales voucher in
[Line: Line_ItemMRP] Fields : Fld_Name, Fld_MRP
[Field: Fld_Name] Use : Name Field Set as : $Name
[Field: Fld_MRP] Use : Numeric Field Set as : $MRP Title : "MRP"
After loading, you’ll find the report under Gateway of Tally → Display → Stock Item MRP.