Here's a sample TDL program to get the Voucher details for a specific Ledger using the WALK COLLECTION statement
;;Adds a new option to Gateway of Tally
[#Menu : Gateway of Tally]
Add : Item : Before : @@locQuit : Walk Collection - Example3 : Call : MyWalkCollectionExample3
;;This is a new Collection definition which is based on Tally Internal Object named VOUCHER.
;;It is filtered using the CHILDOF attribute. In other words, only those Vouchers which contain
;;the specifed Ledger are available in the collection.
[Collection : MyVouchers]
Type : Vouchers : Ledger
ChildOf : ##MyLedger
Fetch : *, LedgerEntries.*
;;Function to display the Voucher details for a specified ledger
[Function : MyWalkCollectionExample3]
Variable : MyLedger : String
00 : SET FILE LOG ON
01 : LOG : "***************************"
;; ********** TO DO - CHANGE THE LEDGER NAME HERE ******
;;******************************************************
;; Assign value to the variable MyLedger
02 : SET : MyLedger : "ABC Softwares"
;; Loop through the Voucher table and display the vouchers
05 : WALK COLLECTION : MyVouchers
10 : LOG : $$String:$Date + "," + $VoucherTypeName + "," + $VoucherNumber
;; Loop through the ledgers and display the Ledger-name and amount
15 : WALK COLLECTION : LedgerEntries
20 : LOG : "=>" + $LedgerName + "," + $$String:$Amount
25 : END WALK
30 : END WALK
90 : SET FILE LOG OFF
100 : Exec Command : Notepad : "TDLFunc.Log"