Integration With Tallyprime
Integration With Tallyprime
Tally can act as an HTTP Server capable of receiving an XML Request and responding with an XML
Response. The entire Tally Data can be made available to the requesting application. It is also
possible for the application to store data into Tally Database directly without using Tally User
Interface.
Open TallyPrime
Configuration Value
To select a company Go to Company > Select, it lists the companies created, select the company
and load it.
Host Localhost:9000
Content-Type text/xml,UTF-8,UTF-16,ASCII
<ENVELOPE>
</ENVELOPE>
Requests
XML request structure depends on the type of Tally request actions export, import, and execute. A
basic XML request will be as follows:
<ENVELOPE>
<HEADER>
</HEADER>
<BODY>
<DESC>
</FUNCPARAMLIST>
</BODY>
</ENVELOPE>
Response
TallyPrime processes requests and send response accordingly. A basic XML request will be as
follows:
<ENVELOPE>
<HEADER>
<VERSION>Version Number</VERSION>
<STATUS>-1/0/1</STATUS>
</HEADER>
<BODY>
<DESC>
</DESC>
</BODY>
</ENVELOPE>
For detailed information about the tags used in request and response, refer here.
URL – As a prerequisite, TallyPrime must be running on one of the port. For example, if the
XML request is sent to TallyPrime on the port 9000 on the local system, the URL
“http://localhost:9000” is specified.
Content-Type: Tally supports the following content types of XML SOAP requests
UTF-8
Unicode Text Format – 8 (UTF–8) is the default response content-type of Tally. Request
made with content type “text/xml” or “UTF–8” will get the Tally response in UTF–8
format.
UTF-16
The request content need to be encoded as Unicode encoding to post to Tally, so that
Tally will respond in Unicode UTF-16 format.
ASCII
ASCII (American Standard Code for Information Interchange). Specify the content type
as ASCII and encode the request content as ASCII encoding to post to Tally, so that Tally
respond in ASCII format.
POST/Body text – Post/body text will be Tally XML request format. Following is a XML request
format to extract the list of ledgers in Tally.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>COLLECTION</TYPE>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
</DESC>
</BODY>
</ENVELOPE>
Set the above parameters and post a request to TallyPrime, it will respond with list of ledgers
present in that company.
Here are some of the sample HTTP Post request codes for reference, Request XML need to be
replaced with the Tally XML request content.
Samples
Sample PHP Request
You can include the following code in PHP script to initiate a request
<?php
$request->setUrl(‘http://localhost:9000/’);
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
echo $response->getBody();
.url(“http://localhost:9000/”)
.post(body)
.addHeader(“content-type”, “text/xml”)
.addHeader(“cache-control”, “no-cache”)
.build();
Sample C# Request
Include the following code in a C# class to initiate a request
var client = new RestClient(“http://localhost:9000/”);
request.AddHeader(“cache-control”, “no-cache”);
request.AddHeader(“content-type”, “text/xml”);
myReq.AllowWriteStreamBuffering = False
myReq.Method = “POST”
myReq.ContentType = “UTF-16”
myReq.ContentLength = buffer.Length
post.Write(buffer, 0, buffer.Length)
post.Close()
response = responsereader.ReadToEnd
Resp_find.Text = response
End If
Accounting Masters
Masters are the most important entity to record transactions in Tally. The accounting masters
primarily consists of Group, Ledger and Voucher Types. The ledger is the actual accounting head to
identify your transactions and generate all accounting reports.
The following table helps to understand the accounting masters and its purpose:
Master Information
Group
Group is a collection of ledgers of the same nature. Account groups are maintained to determine
the hierarchy of Ledger Accounts, which is helpful in determining and presenting meaningful and
compliant reports. Click here for the steps to create a group manually in Tally.
Tally provides the flexibility to the user for organizing the chart of accounts. The following XML
request can be send to Tally to create a group “North Zone Debtors” under predefined group Sundry
Debtors:
<ENVELOPE>
<HEADER>
</HEADER>
<BODY>
<IMPORTDATA>
<REQUESTDESC>
</REQUESTDESC>
<REQUESTDATA>
</GROUP>
</TALLYMESSAGE>
</REQUESTDATA>
</IMPORTDATA>
</BODY>
</ENVELOPE>
Ledger
The Ledgers are commonly known as general ledger in accounting standards. Ledgers provides the
summary of recorded transactions and helps to generate accounting reports. A ledger in Tally must
be created under a group. Click here for the steps to create a ledger manually in Tally.
The following table helps to understand the XML schema with the minimal tags required for
creating a ledger.
<ENVELOPE>
<HEADER>
<TALLYREQUEST>Import Data</TALLYREQUEST>
</HEADER>
<BODY>
<IMPORTDATA>
<REQUESTDESC>
</REQUESTDESC>
<REQUESTDATA>
<NAME>Customer ABC</NAME>
</LEDGER>
</TALLYMESSAGE>
</REQUESTDATA>
</IMPORTDATA>
</BODY>
</ENVELOPE>
<LEDGER Action=”Create”>
<NAME>Customer ABC</NAME>
<PARENT>Sundry Debtors</PARENT>
<MAILINGNAME.LIST TYPE=”String”>
</MAILINGNAME.LIST>
<ADDRESS.LIST TYPE=”String”>
<ADDRESS>Lane</ADDRESS>
<ADDRESS>Locality</ADDRESS>
</ADDRESS.LIST>
<PINCODE>560068</PINCODE>
<COUNTRYNAME>India</COUNTRYNAME>
<LEDSTATENAME>Karnataka</LEDSTATENAME>
<EMAIL>[email protected]</EMAIL>
<EMAILCC>[email protected]</EMAILCC>
<LEDGERPHONE>0888888</LEDGERPHONE>
<LEDGERMOBILE>99999999</LEDGERMOBILE>
</LEDGER>
Similarly, we can create any ledger in Tally by specifying the appropriate group/parent.
Altering a Ledger
An existing ledger in Tally can be altered by sending a XML request. Only the tag <Ledger> has to be
changed as mentioned below in the XML request demonstrated for creating of ledger.
Guidelines
The tool Tally Connector available in TallyPrime Developer can be used for sending XML request
and receiving the XML response for the quick understanding
Ensure the dependent masters are available in Tally before sending XML request for creating the
master/ transactions. Even if the masters are available in Tally ensure that it is created
appropriately under nature of group for example, Sales ledger should be available under group Sales
Accounts, Purchase ledger should be created under group Purchase Accounts.
Third party applications can ensure this by sending XML request and show the appropriate
Tally maintains a unique number (master-ID) for all the masters and transactions. Tally
master-ID can be associated with Third party applications for additional validation, if required.
It is advisable to create one nature of master at once to have better control, for example, Set
of Groups and Set of ledgers needs to be created in two XML requests.
The tax related information has to be sent to Tally to maintain the statutory records in Tally.
Inventory Masters
The Inventory masters are similar to Accounting Masters. Inventory masters are needed to maintain
the stock details of an organization to realize the availability of stock in hand which is part of the
Balance sheet.
The following table describes the type of inventory masters and its purpose:
Master Information
Stock Group
Stock Group in Inventory are similar to Groups in Accounting masters. Stock Groups are useful to
classify the Stock Items. The stock group classification can be made based on some common
features such as brand name, product type, quality, etc. Grouping helps to locate Stock Items easily
and report their details in statements. The stock group can have collection of stock groups (sub
stock groups) as well.
The following XML request can be send to Tally from a third party applications to create a stock
group ‘Electronics’
<ENVELOPE>
<HEADER>
</HEADER>
<BODY>
<IMPORTDATA>
<REQUESTDESC>
</REQUESTDESC>
<REQUESTDATA>
</STOCKGROUP>
</TALLYMESSAGE>
</REQUESTDATA>
</IMPORTDATA>
</BODY>
</ENVELOPE>
Stock Item
Stock Item refers to the goods that an organization manufacture, trade or maintains. A stock item
can be created by providing a Name in Tally. However, the inventory master UOM (Unit of Measure)
is mandatory to define the quantity. It is good to create the dependent masters of the stock items
before creating a stock item.
The following are the XML tags for creating a stock item:
<ENVELOPE>
<HEADER>
<TYPE>Data</TYPE>
</HEADER>
<BODY>
<IMPORTDATA>
<REQUESTDESC>
</REQUESTDESC>
<REQUESTDATA>
</NAME.LIST>
</STOCKITEM>
</TALLYMESSAGE>
</REQUESTDATA>
</IMPORTDATA>
</BODY>
</ENVELOPE>
To create multiple stock items, the tag set <Stockitem> can be repeated as required.
UOM of a stock item cannot be altered when the stock item used in a transaction or in
a master.
Tally responses in the following XML format for the XML request:
Tag Description
Example:
<STANDARDPRICELIST.LIST>
</STANDARDPRICELIST.LIST>
<STANDARDCOSTLIST.LIST>
</STANDARDCOSTLIST.LIST>
Parent To provide stock group name <PARENT>
to stock item name
”Electronics”
</PARENT>
<BATCHNAME>
</BATCHNAME>
NAME.LIST
List Yes It is the header of alias list
Third party applications can store multiple unique aliases using this following XML tags.
<NAME.LIST TYPE=”String”>
<NAME>Stockno12345</NAME>
<NAME>TPA-Item-001</NAME>
</NAME.LIST>
Part No
The Part No. field gets enabled by the option “Use Part Number for stock items?” in Stock item
master configuration. This field is used to enter the catalogue number.
It is the header of
MAILINGNAME.LIST List Yes
part number list
Third party applications can store multiple unique Part numbers using this following XML tags.
<MAILINGNAME.LIST TYPE=”String”>
<MAILINGNAME>TPA-Stockno-00001</MAILINGNAME>
<MAILINGNAME>00001</MAILINGNAME>
</MAILINGNAME.LIST>
Units of Measure
Stock Items are purchased or sold on the basis of quantity. The quantity is measured by Units.
There are two types of UOMs: Simple and Compound. Simple unit is for basic requirement such as
numbers, meters, kilograms, and pieces. Compound units can be used with the combination of two
UOMs, like 1 box of 10 pieces [1 box = 10 pieces], to measure the stock items in two
aspects
Simple UOM
Simple units are nos, pcs, and so on.
Compound UOM
A Compound unit is a relation between two Simple Units. Hence, before you create a Compound
Unit, ensure that you have already created two Simple Units.
For example, To Create Compound unit – Doz (Dozen) of 12 Nos (Numbers), you have to create two
simple units, Doz (Dozen) and Nos (Numbers) and set the conversion factor as 12.
In compound unit creation, <NAME> tag value will not be considered. Tally creates the
name for compound unit based on the conversion factor of Base unit and additional
unit.
<ENVELOPE> <ENVELOPE>
<HEADER> <HEADER>
<TALLYREQUEST>Import <TALLYREQUEST>Import
Data</TALLYREQUEST> Data</TALLYREQUEST>
</HEADER> </HEADER>
<BODY> <BODY>
<IMPORTDATA> <IMPORTDATA>
<REQUESTDESC> <REQUESTDESC>
</REQUESTDESC> </REQUESTDESC>
<REQUESTDATA> <REQUESTDATA>
</BODY>
<DECIMALPLACES>0</DECIMALPLACES> </ENVELOPE>
</UNIT>
</TALLYMESSAGE>
</REQUESTDATA>
</IMPORTDATA>
</BODY>
</ENVELOPE>
Location/Godown
Location/Godown is the place where Stock Items are stored. You can obtain stock reports for each
godown and account for the movement of stock between locations/godowns. Click here for the
steps to create a Godown, manually in Tally.
The following XML request can be send to Tally from a third party applications to create a
Location/Godown ‘Factory’
<ENVELOPE>
<HEADER>
</HEADER>
<BODY>
<IMPORTDATA>
<REQUESTDESC>
</REQUESTDESC>
<REQUESTDATA>
<NAME>Factory</NAME>
</GODOWN>
</TALLYMESSAGE>
</REQUESTDATA>
</IMPORTDATA>
</BODY>
</ENVELOPE>
There is a default godown ‘Main Location’ available in Tally. Incase the feature
‘Maintain multiple godowns?’ is not enabled in Tally, the name of godown can be set to
‘Main Location’, as it is a default value in masters and transactions
Guidelines
The mandatory tags required to import/create the inventory masters in Tally is explained in this
document. To understand other tags, create a sample master with the required features in Tally and
export the same in XML format. Click here for the steps to export the masters from Tally.
Extracting/pulling the Inventory masters from Tally to third party applications is covered under the
section Export Reports/Data from Tally.
Transactions
The Voucher is the document used for recording all type of transactions in accounting standards. It
can be either impact of cash or material between two entities. There are various voucher types
available in Tally to categorize the transactions as Purchase, Sales, Payment, Receipt, Journal etc.
The details of all voucher types are available here.
Sales Transaction
The Sales voucher is considered for explaining the integration of sales vouchers from third party
applications to Tally.
Sales voucher type used to record the sales transactions of an organization. A bill is generated on
sale of goods or services provided or both sales and services. All these requirements fulfilled in
Tally. There are two modes, ‘As voucher’ and ‘As invoice’, available in Tally to record the sales
transactions. Both the mode supports to enter the transactions with or without inventory details.
The mode ‘As Invoice’ prints the voucher in Invoice format and it can be hand it over to the Buyer /
Party for proof of transaction.
The mandatory XML tags for a Sale transaction is given below. However, it has to specified
depends upon the mode of transaction. The structure and hierarchy of each mode explained
below with sample XML requests.
Permissible
Tags Data Type Description
Values
This is opening
tag for voucher
where the
VCHTYPE is to
OBJVIEW
provide voucher
parameter
VOUCHER type name
decides the type
VCHTYPE=”VOUCHERTYPENAME” ACTION is to
of voucher,
ACTION=”Create” Static Values provide action
vchtype informs
OBJVIEW=”Accounting Voucher name
about voucher
View” OBJVIEW is to
type and action
provide the
undertakes the
object view
action to be
performed on
object voucher
Accounting
Voucher View
Invoice Voucher
View
Inventory
Voucher View To identify the
PERSISTEDVIEW String Pay Slip Voucher Voucher
View behaviour.
Consumption
Voucher View
Multi
Consumption
Voucher View
VOUCHERTYPENAME String Name of the To provide
voucher type voucher type
name
Uni date in
To provide date
DATE Date format of
for the voucher
yyyymmdd
To identify
whether the
voucher should
ISINVOICE Logical Boolean
be recorded as
invoice or
voucher.
To provide
ALLLEDGERENTRIES.LIST List Tag ledger details of
the voucher
To provide
LEDGERNAME String Ledger Name
ledger name
To identify
whether the
ISPARTYLEDGER Logical Boolean
ledger is a party
ledger or not
To provide
AMOUNT Amount Amount amount for the
ledger
To provide name
NAME String Text / number for the
bill
To identify the
payment type
Advance
received from
Agst Ref
BILLTYPE String party. This
New Ref
would impact
On Account
bill outstanding
report
To provide bill
AMOUNT Amount Amount
amount
This is closing
/BILLALLOCATIONS.LIST List Tag tag of bill
allocation
This is closing
/ALLLEDGERENTRIES.LIST List Tag tag for ledger
details
This is opening
tag for Inventory
ALLINVENTORYENTRIES.LIST List Tag
Entries of
voucher
To provide stock
STOCKITEMNAME String
item name
To provide billed
BILLEDQTY Quantity Number quantity of the
item
To provide rate
RATE Rate Number for billed
quantity
To provide
AMOUNT Amount amount for the
item
This is the
opening tag to
ACCOUNTINGALLOCATIONS.LIST List Tag provide
accounting
details for item
To provide sales
LEDGERNAME String Text / Tax ledger
name
To provide
AMOUNT Number Amount amount for the
ledger
This is opening
BATCHALLOCATIONS.LIST List Tag #NA tag for Batch
allocations
To provide
godown name.
Incase godown
is not enabled
GODOWNNAME String
but batch is
used the value
has to be Main
Location
To provide batch
name. Incase
batch is not
enabled but
BATCHNAME String godown /
tracking number
is used the
value has to be
Primary Batch
This tag is to
AMOUNT Amount provide amount
for batch
This tag is to
provide actual
quantity sent by
the supplier.
ACTUALQTY Quantity
This would
affect all
inventory
reports
To provide the
BILLEDQTY Quantity
quantity billed
This is a closing
tag for Inventory
/ALLINVENTORYENTRIES.LIST List Tag
Entries of
voucher
This is a closing
/VOUCHER List Tag
tag for voucher
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Import</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Vouchers</ID>
</HEADER>
<BODY>
<DESC>
</DESC>
<DATA>
<TALLYMESSAGE>
<VOUCHER>
<DATE>20160401</DATE>
<VOUCHERTYPENAME>Sales</VOUCHERTYPENAME>
<VOUCHERNUMBER>1</VOUCHERNUMBER>
<ISINVOICE>No</ISINVOICE>
<LEDGERENTRIES.LIST>
<ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
<ISPARTYLEDGER>Yes</ISPARTYLEDGER>
<ISLASTDEEMEDPOSITIVE>Yes</ISLASTDEEMEDPOSITIVE>
<AMOUNT>-215476.00</AMOUNT>
</LEDGERENTRIES.LIST>
<LEDGERENTRIES.LIST>
<LEDGERNAME>Sales</LEDGERNAME>
<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
<AMOUNT>21546.00</AMOUNT>
</LEDGERENTRIES.LIST>
</VOUCHER>
</TALLYMESSAGE>
</DATA>
</BODY>
</ENVELOPE>
Note 1: The inventory details can be added by just adding the below tags under sales
ledger as the inventory details are the break-up of sales ledger.
<INVENTORYALLOCATIONS.LIST>
<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
<AMOUNT>21546.00</AMOUNT>
<BATCHALLOCATIONS.LIST>
<GODOWNNAME>Factory</GODOWNNAME>
<AMOUNT>21546.00</AMOUNT>
</BATCHALLOCATIONS.LIST>
</INVENTORYALLOCATIONS.LIST>
Note 2: As stated earlier, an invoice can be recorded without inventory entries for the
purpose of preparing service bills by changing below mentioned two tags. Such
transactions called as ‘Accounting Invoice’ in Tally.
<ISINVOICE>Yes</ISINVOICE>
Voucher Creation
This below mentioned XML request imports a voucher, As Item Invoice, in TallyPrime. The same can
be viewed in the reports where the sales transactions are captured, For e.g. Day Book, Sales
Register, etc.
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Import</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Vouchers</ID>
</HEADER>
<BODY>
<DESC></DESC>
<DATA>
<TALLYMESSAGE>
<VOUCHER>
<DATE>20160401</DATE>
<VOUCHERTYPENAME>Sales</VOUCHERTYPENAME>
<VOUCHERNUMBER>1</VOUCHERNUMBER>
<ISINVOICE>Yes</ISINVOICE>
<LEDGERENTRIES.LIST>
<ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
<ISPARTYLEDGER>Yes</ISPARTYLEDGER>
<ISLASTDEEMEDPOSITIVE>Yes</ISLASTDEEMEDPOSITIVE>
<AMOUNT>-21546.00</AMOUNT>
<BILLALLOCATIONS.LIST>
<NAME>1</NAME>
<BILLTYPE>New Ref</BILLTYPE>
<AMOUNT>-21546.00</AMOUNT>
</BILLALLOCATIONS.LIST>
</LEDGERENTRIES.LIST>
<LEDGERENTRIES.LIST>
<LEDGERNAME>Packing Charges</LEDGERNAME>
<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
<AMOUNT>900.00</AMOUNT>
</LEDGERENTRIES.LIST>
<LEDGERENTRIES.LIST>
<BASICRATEOFINVOICETAX.LIST TYPE=”Number”>
<BASICRATEOFINVOICETAX> 14</BASICRATEOFINVOICETAX>
</BASICRATEOFINVOICETAX.LIST>
<ROUNDTYPE/>
<LEDGERNAME>VAT</LEDGERNAME>
<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
<AMOUNT>2646.00</AMOUNT>
</LEDGERENTRIES.LIST>
<ALLINVENTORYENTRIES.LIST>
<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
<RATE>15000.00/nos</RATE>
<AMOUNT>15000.00</AMOUNT>
<ACTUALQTY> 1 nos</ACTUALQTY>
<BILLEDQTY> 1 nos</BILLEDQTY>
<BATCHALLOCATIONS.LIST>
<GODOWNNAME>Main Location</GODOWNNAME>
<BATCHNAME>Primary Batch</BATCHNAME>
<DESTINATIONGODOWNNAME>Main Location</DESTINATIONGODOWNNAME>
<AMOUNT>15000.00</AMOUNT>
<ACTUALQTY> 1 nos</ACTUALQTY>
<BILLEDQTY> 1 nos</BILLEDQTY>
</BATCHALLOCATIONS.LIST>
<ACCOUNTINGALLOCATIONS.LIST>
<LEDGERNAME>Sales</LEDGERNAME>
<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
<AMOUNT>15000.00</AMOUNT>
</ACCOUNTINGALLOCATIONS.LIST>
</ALLINVENTORYENTRIES.LIST>
<ALLINVENTORYENTRIES.LIST>
<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
<RATE>3000.00/nos</RATE>
<AMOUNT>3000.00</AMOUNT>
<ACTUALQTY> 1 nos</ACTUALQTY>
<BILLEDQTY> 1 nos</BILLEDQTY>
<BATCHALLOCATIONS.LIST>
<GODOWNNAME>Main Location</GODOWNNAME>
<BATCHNAME>Primary Batch</BATCHNAME>
<DESTINATIONGODOWNNAME>Main Location</DESTINATIONGODOWNNAME>
<AMOUNT>3000.00</AMOUNT>
<ACTUALQTY> 1 nos</ACTUALQTY>
<BILLEDQTY> 1 nos</BILLEDQTY>
</BATCHALLOCATIONS.LIST>
<ACCOUNTINGALLOCATIONS.LIST>
<LEDGERNAME>Sales</LEDGERNAME>
<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
<AMOUNT>3000.00</AMOUNT>
</ACCOUNTINGALLOCATIONS.LIST>
</ALLINVENTORYENTRIES.LIST>
</VOUCHER>
</TALLYMESSAGE>
</DATA>
</BODY>
</ENVELOPE>
XML Response
On processing the above request for importing vouchers, the requested vouchers are created
in Tally and the returns the response as mentioned below:
The above XML Response is a log of vouchers created, altered, combined, ignored or not imported
due to some errors. It also contains information pertaining to last Voucher ID imported.
Voucher Alteration
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Import</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Vouchers</ID>
</HEADER>
<BODY>
<DESC></DESC>
<DATA>
<TALLYMESSAGE>
</VOUCHER>
</TALLYMESSAGE>
</DATA>
</BODY>
</ENVELOPE>
Voucher Cancellation
Voucher cancellation is similar to above Voucher Alteration. For Voucher Cancellation, Action must
be set to “Cancel”
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Import</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Vouchers</ID>
</HEADER>
<BODY>
<DESC></DESC>
<DATA>
<TALLYMESSAGE>
</VOUCHER>
</TALLYMESSAGE>
</DATA>
</BODY>
</ENVELOPE>
Guidelines
To understand or import the values of other than mandatory tags, create the expected voucher entry
in TallyPrime. and export the same in XML format. This is the format of the XML the third party
applications must generate. So, pick up the relevant tags from here and place it as per the hierarchy
in your XML requests.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<STATUS>0</STATUS>
</HEADER>
<BODY>
</BODY>
</ENVELOPE>
Solution: Ensure the specified masters in the XML are created and available in Tally.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<STATUS>0</STATUS>
</HEADER>
<BODY>
<DATA>
<LINEERROR>Voucher totals do not match! Dr: 20,394.00 Dr Cr: 20,395.00 Cr Diff: 1.00 Cr
</LINEERROR>
<CREATED>0</CREATED>
<ALTERED>0</ALTERED>
<DELETED>0</DELETED>
<LASTVCHID>0</LASTVCHID>
<LASTMID>0</LASTMID>
<COMBINED>0</COMBINED>
<IGNORED>0</IGNORED>
<ERRORS>1</ERRORS>
<CANCELLED>0</CANCELLED>
<VCHNUMBER>1</VCHNUMBER>
<DESC></DESC>
</DATA>
</BODY>
</ENVELOPE>
Solution: Ensure the total of debit amounts are equals to the total of credit amounts
Apart from the XML response, the statistics of import execution logs the file Tally.imp
as well, under the folder where the TallyPrime is installed.
Prerequisites to Import Vouchers
Make sure that the necessary masters (Ledger, Stock Item, UOM, etc.) exists in TallyPrime
In case non-base currencies are used, make sure these currencies are available in TallyPrime
The totals of Debit values and Credit values of Voucher should be equal
Reports
This section is intended to illustrate the approaches to get the data and reports from Tally through
XML request/ response.
Tally Data/Objects
Tally database is a true OODBMS(Object Oriented Database Management System). It is possible to
store data as objects and retrieve data as objects. In other traditional OODBMS, data pertaining to
an object is internally converted into disparate files and stored, but in Tally database data for an
object is stored as it is as a block. This allows faster retrieval of data.
Tally File System consists of data files (master, transaction, link masters), Msgfiles (transaction
management) and State Files (concurrency control and exclusivity control). It follows the concept
of embedded and weighted Indexes. In other traditional databases, separate index file is
maintained. In Tally, indexes are built into the data files. This facilitates faster retrieval of data.
By design, Tally database is hierarchical in nature i.e., objects are stored in a tree like structure.
Each node in the tree can be a tree in itself. In this structure, a parent can have multiple children
however every child can have only one parent. A child can further have multiple children. All the
characteristics of a child are inherited from its parent and no child can exist without a parent.
Reports
Tally creates the books of accounts and the financial statements based on the vouchers entered for
the particular period. The information is designed to allow a user to get the maximum benefit of the
data that is entered. A user gets a holistic picture of the data and he able to present information
using different options. The purpose of compiling data is to present it in comprehensible
accounting reports. On entering the vouchers, TallyPrime uses the same data and provides you with
the management control intelligences in addition to all books and statements.
Tags used for sending a request to export data from TallyPrime as follows.
Tag <DESC> can contain report configurations like Company Name, Format of export, etc. as
desired and which should be enclosed within <STATICVARIABLES> tag list.
If the Report Name specified in the <ID> tag does not exist within Tally running at the
specified port, the TDL defining the Report & other supporting definition needs to be
Object To get one particular object. For example, Ledger, Stock Item
Data To get the reports. For example, Balance Sheet, Trial Balance
The below mentioned XML request gets the Name and Parent of a single ledger from Tally
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>OBJECT</TYPE>
<SUBTYPE>Ledger</SUBTYPE>
<ID TYPE=”Name”>NameofTheLedger</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<FETCHLIST>
<FETCH>Name</FETCH>
<FETCH>Parent</FETCH>
</FETCHLIST>
</DESC>
</BODY>
</ENVELOPE>
The below mentioned XML request gets the data of all stock items from Tally
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>List of Accounts</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
</STATICVARIABLES>
</DESC>
</BODY>
</ENVELOPE>
The below mentioned XML request gets the data of ledgers of a particular group ‘Bank accounts’.
The default report ‘List of Accounts’ in Tally provides all the masters created in a
company. Hence, an XML request can be sent to Tally to get details for the required
masters like Ledgers, Groups, Stock Items, Stock Groups, etc.
The below mentioned XML request gets the data of ledgers of a particular group ‘Bank accounts’
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>COLLECTION</TYPE>
<ID>List of Ledgers</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<NATIVEMETHOD>Name</NATIVEMETHOD>
<NATIVEMETHOD>Parent</NATIVEMETHOD>
</COLLECTION>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
The default collection ‘List of Ledgers’ is available in Tally and it is altered in the above
request to pull only the ledgers created under the group ‘Bank Accounts’
Similar to masters, the data of transactions can be gathered from Tally through XML request. The
below mentioned XML request gets data of transactions for a specific period.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>DayBook</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
</DESC>
</BODY>
</ENVELOPE>
The below XML request gets data of transactions for a specific period and for specific voucher type
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Daybook</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
The default report ‘Day book’ in Tally provides all the transactions entered in a
company. Hence, an XML request can be sent to Tally to get the details of the required
vouchers. In the above example, the vouchers are filtered for a specific voucher type by
specifying a formula using TDL.
Gathering Reports
The reports available in Tally can be gathered through XML request/response. The below mentioned
XML request gets the existing report ‘Trial Balance’ from Tally.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Trial Balance</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
</DESC>
</BODY>
</ENVELOPE>
<DSPACCNAME>
<DSPDISPNAME>Current Liabilities</DSPDISPNAME>
</DSPACCNAME>
<DSPACCINFO>
<DSPCLDRAMT>
<DSPCLDRAMTA>
</DSPCLDRAMTA>
</DSPCLDRAMT>
<DSPCLCRAMT>
<DSPCLCRAMTA>1526292.00</DSPCLCRAMTA>
</DSPCLCRAMT>
</DSPACCINFO>
<DSPACCNAME>
<DSPDISPNAME>Current Assets</DSPDISPNAME>
</DSPACCNAME>
<DSPACCINFO>
<DSPCLDRAMT>
<DSPCLDRAMTA>-43092.00</DSPCLDRAMTA>
</DSPCLDRAMT>
<DSPCLCRAMT>
<DSPCLCRAMTA></DSPCLCRAMTA>
</DSPCLCRAMT>
</DSPACCINFO>
<DSPACCNAME>
<DSPDISPNAME>Sales Accounts</DSPDISPNAME>
</DSPACCNAME>
<DSPACCINFO>
<DSPCLDRAMT>
<DSPCLDRAMTA></DSPCLDRAMTA>
</DSPCLDRAMT>
<DSPCLCRAMT>
<DSPCLCRAMTA>36000.00</DSPCLCRAMTA>
</DSPCLCRAMT>
</DSPACCINFO>
<DSPACCNAME>
<DSPDISPNAME>Purchase Accounts</DSPDISPNAME>
</DSPACCNAME>
<DSPACCINFO>
<DSPCLDRAMT>
<DSPCLDRAMTA>-1521000.00</DSPCLDRAMTA>
</DSPCLDRAMT>
<DSPCLCRAMT>
<DSPCLCRAMTA></DSPCLCRAMTA>
</DSPCLCRAMT>
</DSPACCINFO>
<DSPACCNAME>
<DSPDISPNAME>Indirect Expenses</DSPDISPNAME>
</DSPACCNAME>
<DSPACCINFO>
<DSPCLDRAMT>
<DSPCLDRAMTA></DSPCLDRAMTA>
</DSPCLDRAMT>
<DSPCLCRAMT>
<DSPCLCRAMTA>1800.00</DSPCLCRAMTA>
</DSPCLCRAMT>
</DSPACCINFO>
</ENVELOPE>
The value of the Tag <TALLYREQUEST> is Export, which indicates that some information
needs to be exported from Tally.
The value of the Tag <TYPE> is Data, which indicates that the data needs to be exported from
Tally. The value of the Tag <ID> must be a TDL Report Name, if the previous Tag <TYPE>
contains Data and Tag <TALLYREQUEST> contains Export. Any Report, which needs to be
exported from Tally, needs to be specified within these Tags.
<BODY> Tag contains parameters, if any. Additional settings for the report like format
required, company from which data is required, etc. can be passed within
<STATICVARIABLES> Tag enclosed within <DESC> Tag. All variables are considered as Tag
Names and their value are enclosed within these tags.
For example, in the above sample XML, Variable SVEXPORTFORMAT is considered as Tag and its
value $$SysName:XML is enclosed within. TDL Internal Function SysName is evaluated at Tally end
and the response is being sent accordingly.
Example:
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
<SVFROMDATE TYPE=”Date”>1-Apr-2016</SVFROMDATE>
<SVTODATE TYPE=”Date”>1-Apr-2016</SVTODATE>
</STATICVARIABLES>
Tag <TDL>
The tag <TDL> is used to specify the TDL related information. This particular Tag is specified only
when the TDL Code required to serve the request and which is not present in default code of
TallyPrime. The complete TDL to be executed in order to handle the Request; The TDL will be sent
within the TDL block. Tally application will respond depending on the TDL request.
Example: A Request for a report ‘Simple Trial Balance’ has to be made. But, ‘Simple Trial balance’ is
not present in default code, thus, the definition of the same is specified in the TDL tag.
The TDL program is sent using TDL tag as per the following structure:
<TDL>
<TDLMESSAGE>
</TDLMESSAGE>
</TDL>
The <TDLMESSAGE> tag is mandatory inside the <TDL> tag. Inside that, we can write all the
definitions and its attributes with their values. All TDL definitions and attributes are represented as
tags.
Report, Collection, Function and Object can be specified inside the <TDL> tag. Consider the
following examples, which demonstrate the usage of <HEADER> values:
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Report Name</ID>
</HEADER>
In the above header format, the value of TallyRequest is Export and the Type is ‘Data’. Therefore, the
value of ID must be a name of a Report. This report name should be specified inside the tag
<REPORT> within the <TDL> tag.
Example:
<TDL>
<TDLMESSAGE>
</REPORT>
.
.
</TDLMESSAGE>
</TDL>
Let’s illustrate this case by sending a request to fetch data from the report ‘Simple Trial Balance’
that doesn’t exist at Tally end.
The XML Request with the TDL code for the customized report ‘Simple Trial Balance’
<ENVELOPE><HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<EXPLODEFLAG>Yes</EXPLODEFLAG>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<TITLE>”Trial Balance”</TITLE>
</REPORT>
<TOPPARTS>Simple TB Part</TOPPARTS>
<HEIGHT>100% Page</HEIGHT>
<WIDTH>100% Page</WIDTH>
</FORM>
<TOPLINES>
</TOPLINES>
<SCROLLED>Vertical</SCROLLED>
<COMMONBORDERS>Yes</COMMONBORDERS>
</PART>
<USE>Simple TB Details</USE>
<BORDER>Flush Totals</BORDER>
</LINE>
<LEFTFIELDS>Account Name</LEFTFIELDS>
<RIGHTFIELDS>Account Value</RIGHTFIELDS>
</LINE>
<USE>Account Name</USE>
<SET>$Name</SET>
</FIELD>
<USE>Account Value</USE>
<SET>$ClosingBalance</SET>
<BORDER>Thin Left</BORDER>
</FIELD>
<TYPE>Ledger</TYPE> <FILTERS>NoProfitsimple</FILTERS>
</COLLECTION>
NOT $$IsLedgerProfit
</SYSTEM>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
The above XML Request is similar to the previous request given for getting the report Trial Balance.
The difference here is the Report Name contained within the Tag “<ID>” is not specified in Tally.
Therefore, In the Tag <BODY> within Tag <DESC>, an additional tag <TDL> must be specified with
the TDL describing the Report and its components enclosed within Tag <TDLMESSAGE>.’
<ENVELOPE>
<ACCTSINFO>
<ACCOUNTVALUE>1,29,377.00</ACCOUNTVALUE>
</ACCTSINFO>
<ACCOUNTNAME>Sales</ACCOUNTNAME>
<ACCOUNTVALUE>1,29,277.00</ACCOUNTVALUE>
</ACCTSINFO>
</ENVELOPE>
The feature ‘Convert to XML TDL’ in TallyPrime Developer allows you to convert
projects/files that are in TDL to XML TDL. This simplifies the generation of XML
request.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Data</TYPE>
<ID>Trial Balance</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:HTML</SVEXPORTFORMAT>
</STATICVARIABLES>
</DESC>
</BODY>
</ENVELOPE>
The HTML content of the response has to be saved in an html file (*.html) to view the
content as shown above.
Guidelines
Names of some most frequently used reports in Tally
Accounting Reports
Details of vouchers
Day Book
for a specified period
Opening / transacted
/ Closing Balances
Trial Balance
of all accounting
groups and ledgers
Outstanding report
Bills Receivable
for Receivables
Inventory Reports
Common Variables used in Tally Reports
Note: All the other variables used across the reports in Tally can be referred in default
TDL which is available in TallyPrime Developer.
Example: To find the TDL code of the Tally report ‘Profit and Loss’
Step-1: Click on menu ‘Navigate’ and select the option ‘Jump to Definition’
Step-2: Select Report from this definition list shown in field Definition Type
Step-3: Type Profit and Loss and select the report from the list of reports shown in field Definition
Name
The cursor will be jumped to the selected definition as per the example as given below:
Related Topics
Integration using ODBC Interface