0% found this document useful (0 votes)
256 views51 pages

Integration With Tallyprime

TallyPrime can integrate with third party applications by sending and receiving XML over HTTP. It supports integration through ASP, Java, PHP, and other applications that support XML and HTTP. TallyPrime can act as an HTTP server, receiving XML requests and responding with XML responses. This allows third party applications to access and modify TallyPrime data without using the Tally interface. The document provides information on the HTTP request format, XML request and response format, and examples of sending requests from third party applications to TallyPrime using PHP, Java, C#, and VB.Net.

Uploaded by

Sanjay Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
256 views51 pages

Integration With Tallyprime

TallyPrime can integrate with third party applications by sending and receiving XML over HTTP. It supports integration through ASP, Java, PHP, and other applications that support XML and HTTP. TallyPrime can act as an HTTP server, receiving XML requests and responding with XML responses. This allows third party applications to access and modify TallyPrime data without using the Tally interface. The document provides information on the HTTP request format, XML request and response format, and examples of sending requests from third party applications to TallyPrime using PHP, Java, C#, and VB.Net.

Uploaded by

Sanjay Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

Login

Home Developer Reference Integration Capabilities Introduction Integration With TallyPrime

Integration With TallyPrime


Introduction
Tally can communicate with any environment capable of sending and receiving XML over HTTP.
TallyPrime supports integration with Third Party Applications (like web scripting languages such as
ASP/Java/PHP and applications built, which supports XML and HTTP).

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.

Pre-requisites for Integration


1. TallyPrime must be running on one of the port (For example: 9000)

Open TallyPrime

Go to Exchange > Data Synchronization

The Data Synchronization Configuration screen appears.


Configure the parameters as given below:

Configuration Value

TallyPrime acting as Both / Server / Client / None

Enable ODBC Yes/No

Port 9000 (desired port number)

2. Company must be loaded in TallyPrime

To select a company Go to Company > Select, it lists the companies created, select the company
and load it.

HTTP Request Format


Every request send to Tally from a third party must contain the information shared below. Tally
processes the HTTP request and sends response in XML format itself.

HTTP Request Headers Information

HTTP method POST  HTTP/1.1

Host Localhost:9000

Content-Type text/xml,UTF-8,UTF-16,ASCII

HTTP Body Information


Content-Type text/xml, UTF-8, UTF-16, ASCII

Data XML request content

XML Request and Response


A basic XML structure will have an Envelope enclosed tags with Header and Body tags. This basic
XML structure will be present in both XML request and response.

<ENVELOPE>

       <HEADER> . . . </HEADER>

       <BODY> . . . </BODY>

</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>

              <VERSION>Version Number</VERSION>

              <TALLYREQUEST>Request Type</TALLYREQUEST>

              <TYPE>Information Type</TYPE>

              <SUBTYPE>Sub Type</SUBTYPE>

              <ID >Identifier</ID>

       </HEADER>

       <BODY>

       <DESC>

           <STATICVARIABLES>Static Variables Specification</STATICVARIABLES>

           <REPEATVARIABLES>Repeat Variables Specification</REPEATVARIABLES>

           <FETCHLIST> Fetch Specification</FETCHLIST>

           <FUNCPARAMLIST> Parameter specification in case of function type 

           </FUNCPARAMLIST>     

              <TDL>   TDL Information     </TDL>


       </DESC>

              <DATA>  Data (if applicable) </DATA>

       </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>

     <STATICVARIABLES> Static Variables Specification </STATICVARIABLES>

 </DESC>

 <DATA> Data retrieved (if available)</DATA>

</BODY>

</ENVELOPE>

For detailed information about the tags used in request and response, refer here.

How to send a request from Third Party Applications to TallyPrime


To send a HTTP request to Tally application following details are required:

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.

Headers – Use the standard HTTP headers

HTTP method:   POST HTTP/1.1

Host: Localhost: 9000

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.

For example, Content-type:”UTF-8” or Content-type: “text/XML”

UTF-16

Unicode Text Format – 16 (UTF-16) is an extended text format of UTF-8. UTF-16


supports special characters, such as currency symbols Rupee, Euro etc.

The request content need to be encoded as Unicode encoding to post to Tally, so that
Tally will respond in Unicode UTF-16 format.

For example, Content-type:”UTF-16”

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.

For example, Content-type:”ASCII”

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>

              <ID>List of Ledgers</ID>

       </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 = new HttpRequest();

$request->setUrl(‘http://localhost:9000/’);

$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(

   ‘cache-control’ => ‘no-cache’,

   ‘content-type’ => ‘text/xml’));

$request->setBody(‘ Request XML ‘);

try {   $response = $request->send();

  echo $response->getBody();

} catch (HttpException $Msg_ex) { echo $Msg_ex;   }    ?>

Sample Java Request


You can include the following code in a Java class to initiate a request

OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse(“text/xml “);

RequestBody body = RequestBody.create(mediaType, “Request XML”);

Request request = new Request.Builder()

  .url(“http://localhost:9000/”)

  .post(body)

  .addHeader(“content-type”, “text/xml”)

  .addHeader(“cache-control”, “no-cache”)

  .build();

Response response = client.newCall(request).execute();

Sample C# Request
Include the following code in a C# class to initiate a request
var client = new RestClient(“http://localhost:9000/”);

var request = new RestRequest(Method.POST);

request.AddHeader(“cache-control”, “no-cache”);

request.AddHeader(“content-type”, “text/xml”);

request.AddParameter(“text/xml”,” Request XML “, ParameterType.RequestBody);

IRestResponse response = client.Execute(request);

Sample VB.Net Request


Include the following code in a VB class to initiate a request

Dim data As String = RequestXML

Dim url As String = “http://localhost:9000“

Dim myReq As HttpWebRequest = WebRequest.Create(url)

Dim encoding As New UnicodeEncoding

Dim buffer() As Byte = encoding.GetBytes(data)

myReq.AllowWriteStreamBuffering = False

myReq.Method = “POST”

myReq.ContentType = “UTF-16”

myReq.ContentLength = buffer.Length

Dim post As Stream = myReq.GetRequestStream

post.Write(buffer, 0, buffer.Length)

post.Close()

Dim myResponse As HttpWebResponse = myReq.GetResponse

      If myResponse.StatusCode = HttpStatusCode.OK Then

         Dim responsedata As Stream = myResponse.GetResponseStream

         Dim responsereader As StreamReader = New StreamReader

           (responsedata, System.Text.Encoding.Unicode, True)

           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

Ledger is the actual accounting master used for recording


Ledger
transactions and generating account reports

Voucher Type used to categorize the different nature of


Voucher Type transactions,  provide specific voucher number and configure
its behaviour while recording the transactions

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>

       <TALLYREQUEST>Import Data</TALLYREQUEST>

</HEADER>

<BODY>

<IMPORTDATA>

          <REQUESTDESC>

              <REPORTNAME>All Masters</REPORTNAME>

          </REQUESTDESC>

          <REQUESTDATA>

              <TALLYMESSAGE xmlns:UDF=”TallyUDF”>

                     <GROUP Action=”Create”>

                        <NAME>North Zone Debtors</NAME>


                        <PARENT>Sundry Debtors</PARENT>

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

Tag Data type Is mandatory Description

LEDGER   Yes Opening tag

To provide the name


NAME String Yes
of the Ledger

This should contain


a group name from
list available in Tally.
We can also create
our own groups and
PARENT String Yes
classify ledger under
that group subject to
the group is created
prior to ledger
creation.

The below given XML request creates a ledger in Tally

<ENVELOPE>

<HEADER>
       <TALLYREQUEST>Import Data</TALLYREQUEST>

</HEADER>

<BODY>

<IMPORTDATA>

          <REQUESTDESC>

              <REPORTNAME>All Masters</REPORTNAME>

          </REQUESTDESC>

          <REQUESTDATA>

              <TALLYMESSAGE xmlns:UDF=”TallyUDF”>

                     <LEDGER Action=”Create”>

                        <NAME>Customer ABC</NAME>

                        <PARENT>Sundry Debtors</PARENT>

                     </LEDGER>

              </TALLYMESSAGE>

          </REQUESTDATA>

</IMPORTDATA>

</BODY>

</ENVELOPE>

Adding Address Information in Ledger Master


The below mentioned XML tags can be included in the XML request to add the address information
in ledger master.

<LEDGER Action=”Create”>

   <NAME>Customer ABC</NAME>

   <PARENT>Sundry Debtors</PARENT>

   <MAILINGNAME.LIST TYPE=”String”>

       <MAILINGNAME>Customer – Mailing name</MAILINGNAME>

   </MAILINGNAME.LIST>

   <ADDRESS.LIST TYPE=”String”>

       <ADDRESS>Door No </ADDRESS>

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

<Ledger NAME=”Customer ABC” Action=”Alter”>

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

warning/error message to the user.

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 groups holds collection of stock items.

A Stock item is the actual inventory master used in the 


Stock Items
transactions

Stock Items are transacted based on the quantity. The quantity


Unit of Measure
is measured by the Unit of Measure.         

To maintain the availability of stock at various locations. Stock


Locations/Godowns
items are stored under the Godowns

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>

       <TALLYREQUEST>Import Data</TALLYREQUEST>

</HEADER>

<BODY>

<IMPORTDATA>

          <REQUESTDESC>

              <REPORTNAME>All Masters</REPORTNAME>

          </REQUESTDESC>

          <REQUESTDATA>

              <TALLYMESSAGE xmlns:UDF=”TallyUDF”>

                     <STOCKGROUP Action=”Create”>


                        <NAME>Electronics</NAME>

                     </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:

Tag Data type Is mandatory Description

Name of the stock


NAME String Yes
item

BASEUNITS String No Name of the UOM

Creating a Stock Item


Stock item can be created in Tally from a third party application by using the below mentioned
sample XML request

<ENVELOPE>

         <HEADER>

              <TALLYREQUEST>Import data</TALLYREQUEST>

              <TYPE>Data</TYPE>

              <ID>All Masters</ID>

          </HEADER>

       <BODY>

              <IMPORTDATA>
                     <REQUESTDESC>

                            <REPORTNAME>All Masters</REPORTNAME>

                     </REQUESTDESC>

                     <REQUESTDATA>

                            <TALLYMESSAGE xmlns:UDF=”TallyUDF”>

                                   <STOCKITEM Action=”Create”>

                                        <NAME>Red Colored Striped Shirt</NAME>

                                         <BASEUNITS>lts</BASEUNITS>

                                          <NAME.LIST TYPE=”String”>

                                              <NAME>Red Colored Striped Shirt</NAME>

                                          </NAME.LIST>

                                   </STOCKITEM>

                            </TALLYMESSAGE>

                     </REQUESTDATA>       

              </IMPORTDATA>

       </BODY>

</ENVELOPE>

To create multiple stock items, the tag set <Stockitem> can be repeated as required.

Altering of a Stock Item


You can do the alteration of stock item using the following tag and value

<STOCKITEM NAME=”Red Colored Striped Shirt” Action=”Alter”>

UOM of a stock item cannot be altered when the stock item used in a transaction or in
a master.

XML Response for Import Data Request

Tally responses in the following XML format for the XML request:

Tag Description

<RESPONSE> Opening tag of response XML

<CREATED>0</CREATED> Number of masters/transactions created


<ALTERED>0</ALTERED> Number of masters/transactions altered

<DELETED>0</DELETED> Number of masters/transactions deleted

<LASTVCHID>0</LASTVCHID> Master ID of last imported voucher

<LASTMID>0</LASTMID> Last Master ID (it always returns 0)

<COMBINED>0</COMBINED> Number of combined masters

<IGNORED>0</IGNORED> Number of ignored masters

<ERRORS>0</ERRORS> Number of errors while importing the request

<CANCELLED>0</CANCELLED> Number of transactions cancelled

</RESPONSE> Closing tag of response XML

Other Optional Attributes of a Stock Item


Depending on the features enabled in Tally, the tags can be added in the XML request.

Example:

Name Usage of the Tag Tag

<STANDARDPRICELIST.LIST>

To provide standard selling      <DATE>14092016</DATE>

Standard Selling price for stock item      <RATE>1145.99</RATE>

  </STANDARDPRICELIST.LIST>

<STANDARDCOSTLIST.LIST>

To provide standard cost for       <DATE>12092016</DATE>


Standard Cost price
stock item       <RATE>875.23</RATE>

</STANDARDCOSTLIST.LIST>
Parent To provide stock group name <PARENT>
to stock item name
”Electronics”

</PARENT>

<BATCHNAME>

BatchName To provide batch name        Apr2016

</BATCHNAME>

To provide opening quantity <OPENINGBALANCE>25


Opening balance
for the item </OPENINGBALANCE>

To provide opening rate for <OPENINGRATE>490


Opening Rate
the item </OPENINGRATE>

To provide opening value for <OPENINGVALUE>12250


Opening Value
the item </OPENINGVALUE>

To provide godown name.


Incase,  godown feature is <GODOWN>
not enabled, the name of
Godown Name   Main Location
godown can be set to Main
Location as this is the </GODOWN>
default value in Tally

Identify/Map Items Pushed by Third Party Applications


There may be a need to map the stock items maintained in Tally Vs stock items maintained in third
party applications. In such case, it is necessary to store a reference value in stock item master.
This can be achieved using the fields Alias or Part number of the stock item. Tally has a capability
to provide multiple Aliases and Part numbers to a master.
Alias
The Alias field gets enabled by the option “Provide aliases along with name?” in stock item master
configuration.

Tag Data type Is mandatory Description

NAME.LIST
List Yes It is the header of alias list
                  

NAME String Yes Alias name

Third party applications can store multiple unique aliases using this following XML tags.

<NAME.LIST TYPE=”String”>

    <NAME>Red Striped Shirt</NAME>

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

Tag Data type Is mandatory Description

It is the header of
MAILINGNAME.LIST List Yes
part number list

To provide the Part


MAILINGNAME String Yes
number

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.

UOM contains the following fields.

Tag Data type Is mandatory Description

Name of the UOM. This would be


used as symbol for unit.

(Applicable for simple unit.


NAME String Yes however, Tally creates the name
for compound unit based on the
conversion factor of Base unit and
additional unit)

To set the unit as simple or


ISSIMPLEUNIT Logical Yes
compound

ORIGINALNAME String No Formal name for the unit

To provide number of decimal


DECIMALPLACES Number No places. (Applicable for simple
unit)

BASEUNITS String Yes To provide the name of base unit


(Applicable for Compound unit)
 

To provide the name of additional


ADDITIONALUNITS String Yes unit (Applicable for Compound
unit)

To provide the conversion factor

CONVERSION Number Yes from base to additional unit

(Applicable for Compound unit)

Simple & Compound Unit Creation


XML tags for simple unit and compound unit creation are as given below:

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.

Simple Unit Compound Unit

<ENVELOPE> <ENVELOPE>

<HEADER> <HEADER>

<TALLYREQUEST>Import <TALLYREQUEST>Import
Data</TALLYREQUEST> Data</TALLYREQUEST>

</HEADER> </HEADER>

<BODY> <BODY>

<IMPORTDATA> <IMPORTDATA>

   <REQUESTDESC>    <REQUESTDESC>

       <REPORTNAME>All Masters              <REPORTNAME>All Masters         


</REPORTNAME>   </REPORTNAME>

   </REQUESTDESC>    </REQUESTDESC>

   <REQUESTDATA>    <REQUESTDATA>

     <TALLYMESSAGE      <TALLYMESSAGE xmlns:UDF=”TallyUDF”>


xmlns:UDF=”TallyUDF”>
         <UNIT Action = “Create”>
       <UNIT Action = “Create”>
       <NAME>Pcs</NAME>          <NAME>Dozen of 12 Pieces</NAME>

                <ISSIMPLEUNIT>No</ISSIMPLEUNIT>


<ISSIMPLEUNIT>Yes</ISSIMPLEUNIT>
        
       <ORIGINALNAME>Pieces <ORIGINALNAME>Liters</ORIGINALNAME>
</ORIGINALNAME>
        
       <DECIMALPLACES>2</DECIMALPLACES>
<DECIMALPLACES>2</DECIMALPLACES>
         <BASEUNITS>Doz</BASEUNITS>
       </UNIT>
<ADDITIONALUNITS>Pcs</ADDITIONALUNITS>
       <UNIT Action = “Create”>
         <CONVERSION>12</CONVERSION>
       <NAME>Doz</NAME>
         </UNIT>
      
       </TALLYMESSAGE>
<ISSIMPLEUNIT>Yes</ISSIMPLEUNIT>
     </REQUESTDATA>
       <ORIGINALNAME>Dozen
</ORIGINALNAME>    </IMPORTDATA>

       </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>

       <TALLYREQUEST>Import Data</TALLYREQUEST>

</HEADER>
<BODY>

<IMPORTDATA>

          <REQUESTDESC>

              <REPORTNAME>All Masters</REPORTNAME>

          </REQUESTDESC>

          <REQUESTDATA>

              <TALLYMESSAGE xmlns:UDF=”TallyUDF”>

                     <GODOWN Action=”Create”>

                        <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

This tag decides


whether the
ledger amount
to be debited or
credited. In
ISDEEMEDPOSITIVE Logical Boolean
sales voucher
this should be
set to YES for all
debiting a
ledger

To identify
whether the
ISPARTYLEDGER Logical Boolean
ledger is a party
ledger or not

To provide
AMOUNT Amount Amount amount for the
ledger

BILLALLOCATIONS.LIST List Tag   This is opening


tag for providing
bill details for
party ledger and
is mandate only
for party ledger.
For other
ledgers the tag
is not required

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

This tag is set


to NO for
ISDEEMEDPOSITIVE Logical Boolean
outward
transactions
ACTUALQTY Quantity Number To provide
actual quantity
of the item

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

This tag decides


whether the
ledger amount
to be debited or
ISDEEMEDPOSITIVE Logical Boolean credited. In
sales voucher
this should be
set to No for
Sales ledger

To provide
AMOUNT Number Amount amount for the
ledger

/ACCOUNTINGALLOCATIONS.LIST List Tag   This is a closing


tag for
accounting
allocations

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

/BATCHALLOCATIONS.LIST List Tag   This is a closing


tag for Batch
allocations

This is a closing
tag for Inventory
/ALLINVENTORYENTRIES.LIST List Tag  
Entries of
voucher

This is a closing
/VOUCHER List Tag  
tag for voucher

Sales Transaction – As Voucher


The voucher mode is the traditional way to record an entry with only the accounting information,
i.e., Recording the entry in Dr-Cr or By-To format to specify ledger amount either debit and credit.

Sample XML Request for Creating a sales transaction in voucher mode

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

    <PERSISTEDVIEW>Accounting Voucher View</PERSISTEDVIEW>

    <ISINVOICE>No</ISINVOICE>

    <LEDGERENTRIES.LIST>

      <LEDGERNAME>ABC Company Limited</LEDGERNAME>

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

        <STOCKITEMNAME>SAMSUNG DVD PLAYER</STOCKITEMNAME>

        <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>

        <AMOUNT>21546.00</AMOUNT>

        <ACTUALQTY> 1 nos</ACTUALQTY>

        <BILLEDQTY> 1 nos</BILLEDQTY>

        <BATCHALLOCATIONS.LIST>
         <GODOWNNAME>Factory</GODOWNNAME>

         <BATCHNAME>Primary Batch</BATCHNAME>

         <AMOUNT>21546.00</AMOUNT>

         <ACTUALQTY> 1 nos</ACTUALQTY>

         <BILLEDQTY> 1 nos</BILLEDQTY>

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

<PERSISTEDVIEW>Invoice Voucher View</PERSISTEDVIEW>

<ISINVOICE>Yes</ISINVOICE>

Sales Transaction – As Invoice


The Item invoice recorded in Tally using the Invoice mode where the calculations can be automated
and the user can experience the ease of feeding the transactions into the system. The invoice mode
is the modern way to record an entry. i.e. you simply provide required data and an auto calculation
would take place.

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.

Sample XML Request for Creating a Sales Transaction in Invoice Mode


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

  <PERSISTEDVIEW>Invoice Voucher View</PERSISTEDVIEW>

  <ISINVOICE>Yes</ISINVOICE>

  <OBJVIEW>Invoice Voucher View</OBJVIEW>

  <LEDGERENTRIES.LIST>

    <LEDGERNAME>ABC Company Limited</LEDGERNAME>

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

   <STOCKITEMNAME>Sony Television 14 inches</STOCKITEMNAME>

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

      <STOCKITEMNAME>Samsung DVD Player</STOCKITEMNAME>

      <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

In case of voucher alteration or cancellation, a vital information required is voucher identifier.


Identification of voucher can be achieved through Master ID, Voucher Number, Voucher Type and
date

Sample XML Request for Voucher Alteration

<ENVELOPE>

      <HEADER>

         <VERSION>1</VERSION>

         <TALLYREQUEST>Import</TALLYREQUEST>

         <TYPE>Data</TYPE>

         <ID>Vouchers</ID>

      </HEADER>

    <BODY>

    <DESC></DESC>

    <DATA>

    <TALLYMESSAGE>

       <VOUCHER DATE=”01-Apr-2016″ TAGNAME =”Voucher Number”

                TAGVALUE=”1″ Action=”Alter” VCHTYPE = “Sales”>

       <NARRATION>Being Goods sold</NARRATION>

       </VOUCHER>

    </TALLYMESSAGE>

    </DATA>

    </BODY>

</ENVELOPE>

Voucher Cancellation

Voucher cancellation is similar to above Voucher Alteration. For Voucher Cancellation, Action must
be set to “Cancel”

Sample XML Request for cancellation

<ENVELOPE>

<HEADER>

  <VERSION>1</VERSION>
  <TALLYREQUEST>Import</TALLYREQUEST>

  <TYPE>Data</TYPE>

  <ID>Vouchers</ID>

 </HEADER>

 <BODY>

   <DESC></DESC>

   <DATA>

   <TALLYMESSAGE>

   <VOUCHER DATE=”01-Apr-2016″ TAGNAME = “VoucherNumber” TAGVALUE=”2″

    ACTION=”Cancel” VCHTYPE = “Sales”>

      <NARRATION>Being good returned</NARRATION>

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

Examples of few possible errors

 DESC not found

Sample XML response:

<ENVELOPE>

  <HEADER>

     <VERSION>1</VERSION>

     <STATUS>0</STATUS>

   </HEADER>

   <BODY>

     <DATA>DESC not found </DATA>

   </BODY>
</ENVELOPE>

Solution: Ensure the specified masters in the XML are created and available in Tally.

Voucher totals do not match! 

Sample XML response:

<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

All dates must follow the YYYYMMDD format.

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.

The reports of Tally can be gathered through XML request/response.

Tags used for sending a request to export data from TallyPrime as follows.

<HEADER> contains the following:

Tag <TALLYREQUEST> must contain value Export

Tag <TYPE> must contain value Data


Tag <ID> should contain the Name of the Report

<BODY> contains the following:

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

described and enclosed within tag <TDL>.

Gathering data and reports from Tally


Gathering data
The data of any master or transaction in Tally can be pulled through XML request/response. There
are three ‘type’ of requests used for exporting the data from Tally and the purpose of each type is
given below:

Object To get one particular object. For example, Ledger, Stock Item

To get multiple objects. For example, List of Ledgers, List of


Collection
Stockitems

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>

         <AccountType>Stock Items</AccountType>

</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>

<COLLECTION NAME=”List of Ledgers” ISMODIFY=”Yes”>

<ADD>CHILD OF : Bank Accounts</ADD>

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

              <SVFROMDATE TYPE=”Date”>1-Apr-2016</SVFROMDATE>

              <SVTODATE TYPE=”Date”>1-Apr-2016</SVTODATE>

    </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>

<REPORT NAME=”Day Book” ISMODIFY=”Yes” ISFIXED=”No” ISINITIALIZE=”No” ISOPTION=”No”


ISINTERNAL=”No”>

<LOCAL>Collection : Default : Add :Filter : VchTypeFilter</LOCAL>


<LOCAL>Collection : Default : Add :Fetch  : VoucherTypeName</LOCAL> </REPORT>

<SYSTEM TYPE=”Formulae” NAME=”VchTypeFilter” ISMODIFY=”No” ISFIXED=”No”


ISINTERNAL=”No”>$VoucherTypeName=Sales   </SYSTEM>

</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>

Sample XML response for above request:


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

In the above XML request, <HEADER> describes the expected result.

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>

      <SVCurrentCompany>ABC company Private Limited</SVCurrentCompany>

      <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>

      <SVFROMDATE TYPE=”Date”>1-Apr-2016</SVFROMDATE>

      <SVTODATE TYPE=”Date”>1-Apr-2016</SVTODATE>

</STATICVARIABLES>

Gathering a customized report 


When a required report is not available at Tally end, the TDL code required for the custom report
can be sent through the XML request to get the information.

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>

TDL request specification

</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:

Report Specification in TDL


<HEADER>

  <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 NAME=”TDL Report” ISMODIFY=”No” ISFIXED=”No” ISINITIALIZE=”No” ISOPTION=”No”


ISINTERNAL=”No”>

<FORMS>First TDL Form</FORMS>

</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>

<ID>Simple Trial balance</ID>

</HEADER>

<BODY>

<DESC>

    <STATICVARIABLES>

      <EXPLODEFLAG>Yes</EXPLODEFLAG>                                                                 
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>

    </STATICVARIABLES>

<TDL>

<TDLMESSAGE>

<REPORT NAME=”Simple Trial balance”>

<FORMS>Simple Trial balance</FORMS>

<TITLE>”Trial Balance”</TITLE>

</REPORT>

<FORM NAME=”Simple Trial balance”>

<TOPPARTS>Simple TB Part</TOPPARTS>

<HEIGHT>100% Page</HEIGHT>

<WIDTH>100% Page</WIDTH>

</FORM>

<PART NAME=”Simple TB Part”>

   <TOPLINES>

     Simple TB Title, Simple TB Details

   </TOPLINES>

   <REPEAT>Simple TB Details : Simple TB Ledgers </REPEAT>

   <SCROLLED>Vertical</SCROLLED>

   <COMMONBORDERS>Yes</COMMONBORDERS>

</PART>

<LINE NAME=”Simple TB Title”>

    <USE>Simple TB Details</USE>

    <LOCAL>Field : Default : Type : String    </LOCAL>


    <LOCAL>Field : Default : Align : Centre      </LOCAL>

    <LOCAL>Field : Account Name : Set as: “Particulars” </LOCAL>

    <LOCAL>Field : Account Value: Set as: “Amount”</LOCAL>

    <BORDER>Flush Totals</BORDER>

</LINE>

<LINE NAME=”Simple TB Details”>

    <LEFTFIELDS>Account Name</LEFTFIELDS>

    <RIGHTFIELDS>Account Value</RIGHTFIELDS>

    <XMLTAG>”Accts Info”</XMLTAG >

</LINE>

<FIELD NAME=”Account Name”>

    <USE>Account Name</USE>

    <SET>$Name</SET>

</FIELD>

<FIELD NAME=”Account Value”>

    <USE>Account Value</USE>

    <SET>$ClosingBalance</SET>

    <BORDER>Thin Left</BORDER>

</FIELD>

<COLLECTION NAME=”Simple TB Ledgers”>

<TYPE>Ledger</TYPE>                                                    <FILTERS>NoProfitsimple</FILTERS>

</COLLECTION>

<SYSTEM TYPE=”Formulae” NAME=”NoProfitSimple”>

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

XML Response Received

<ENVELOPE>

 <ACCTSINFO>

  <ACCOUNTNAME>Abc Company Limited</ACCOUNTNAME>

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

Gathering a report in HTML format


Apart from XML format, the reports of Tally can be gathered in HTML format as well. The below
mentioned XML request gets the report ‘Trial Balance’ in HTML format:

<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 below mentioned output/screen is the response received in HTML format.

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

Description of the Purpose of


Name of the Report Mandatory Variables
report mandatory variables

Details of vouchers
Day Book    
for a specified period

Opening / transacted
/ Closing Balances
Trial Balance    
of all accounting
groups and ledgers

Ledger Account for a To set the Name of


Ledger Vouchers LedgerName
ledger the ledger

Ledger Outstandings Outstanding report LedgerName To set the Name of


for a ledger the ledger

Bills Payable Outstanding report


   
  for Payables

Outstanding report
Bills Receivable    
for Receivables

Outstanding report To set the Name of


Group Outstandings GroupName
for a group the group

Inventory Reports
Common Variables used in Tally Reports

Name of the Variable Data Type Permissible value Description

Uni date in format of To provide from-date


SVFROMDATE Date
YYYYMMDD of the period

Uni date in format of To provide the To-


SVTODATE Date
YYYYMMDD date of the period

$$SysName:XML To set the format of


SVEXPORTFORMAT String
$$SysName:HTML the report

To get the report in


EXPLODEFLAG Logical Boolean the Detailed or
Condensed Mode

Note: All the other variables used across the reports in Tally can be referred in default
TDL which is available in TallyPrime Developer.

Finding the report name/code in default TDL


The TDL code for the required Tally report can be viewed 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

Integration Using JSON

Integration Using XML Interface

Integration Capabilities - An Introduction

Release Notes for TallyPrime and TallyPrime Edit Log Release…

You might also like