Playing with Tally software

I was playing around a bit with Tally ERP software. I like it for its simplicity. This is from the perspective of a software developer who wants to integrate with Tally, and not as a user of Tally. I am not competent to talk about that.
My intention was to understand what it takes to integrate with Tally; write a piece of Java code to query for information from within Tally, and to update information within Tally. Decided to use their XML/HTTP interface to try this out.

In essence, these are the steps for that – first install the software, then configure it, and finally try the XML/HTTP interface to interact with it.

Install

  • Download Tally. I tried the “Educational Version”.
  • Double-click the installable to install it.
  • Once you start Tally, create a default “Company” in it. Also enable the Payroll module, so that you can perform CRUD operations on Employee information.
  • The documentation or a web search can help you with these steps, in case you falter.

Configure

  • To initiate XML interaction over HTTP with Tally, the server port has to be enabled in Tally. Click on “Configurations” or F3-> “Advanced Configurations”, and then select the following options: I set the “Tally is acting as” to “Both”, and “Port” to “9002”. Save, and exit. Restart Tally.
  • Open a browser, and enter http://localhost:9002 in the address bar. You should see a message “<RESPONSE>Tally.ERP 9 Server is Running</RESPONSE>”. Now you are good to go. Else, have a look at the documentation.

Integration using XML over HTTP

  • Tally requires the client (the one which is integrating with Tally) to HTTP-POST XML documents. The XML documents contain the action to be performed, and details of the Tally Data on which this action needs to be performed.
  • I searched for some sample XMLs with which I could experiment with this interaction. I came across some useful ones on the RTSLink site: http://www.rtslink.com/download-tally-xml-tags.html.
  • Used cURL command line tool to try this out:
curl -X POST localhost:9002 --data @all_inventory_master.xml
  • The structure of all_inventory_master.xml is as follows:
<ENVELOPE>
<HEADER>
<TALLYREQUEST>Export Data</TALLYREQUEST>
</HEADER>
<BODY>
<EXPORTDATA>
<REQUESTDESC>
<REPORTNAME>List of Accounts</REPORTNAME>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
<ACCOUNTTYPE>All Inventory Masters</ACCOUNTTYPE>
</STATICVARIABLES>
</REQUESTDESC>
</EXPORTDATA>
</BODY>
</ENVELOPE>
  • The next option was to insert an Employee’s information into Tally.
  • curl -X POST localhost:9002 –data @payrollEnvelope.xml
  • The structure of payrollEnvelope.xml is as follows:
<ENVELOPE>
 <HEADER>
 <TALLYREQUEST>Import Data</TALLYREQUEST>
 </HEADER>
 <BODY>
 <IMPORTDATA>
 <REQUESTDESC>
 <REPORTNAME>All Masters</REPORTNAME>
 <STATICVARIABLES>
 <SVCURRENTCOMPANY>MyCompany</SVCURRENTCOMPANY>
 </STATICVARIABLES>
 </REQUESTDESC>
 <REQUESTDATA>
 <TALLYMESSAGE xmlns:UDF="TallyUDF">
 <COSTCENTRE NAME="ImportPSOFT" RESERVEDNAME="">
 <ADDRESS.LIST TYPE="String">
 <ADDRESS>Bangalore</ADDRESS>
 </ADDRESS.LIST>
 <MAILINGNAME.LIST TYPE="String">
 <MAILINGNAME>10</MAILINGNAME>
 </MAILINGNAME.LIST>
 <CATEGORY>Primary Cost Category</CATEGORY>
 <LOCATION>Bangalore</LOCATION>
 <DESIGNATION>Software Engineer</DESIGNATION>
 <BLOODGROUP>O Positive</BLOODGROUP>
 <AFFECTSSTOCK>No</AFFECTSSTOCK>
 <FORPAYROLL>Yes</FORPAYROLL>
 <FORJOBCOSTING>No</FORJOBCOSTING>
 <ISEMPLOYEEGROUP>No</ISEMPLOYEEGROUP>
 <SORTPOSITION> 1000</SORTPOSITION>
 <DEFAULTLANGUAGE>0</DEFAULTLANGUAGE>
 <LANGUAGENAME.LIST>
 <NAME.LIST TYPE="String">
 <NAME>Kiran Subbaraman</NAME>
 </NAME.LIST>
 <LANGUAGEID> 1033</LANGUAGEID>
 </LANGUAGENAME.LIST>
 </COSTCENTRE>
 </TALLYMESSAGE>
 </REQUESTDATA>
 </IMPORTDATA>
 </BODY>
</ENVELOPE>
  • This should insert a new employee record, in Tally.

References

Use this Tally Integration Guide (pdf) to better understand what goes into the various integration options that Tally supports.

Good luck, and let me know if this works for you.

Advertisements

79 thoughts on “Playing with Tally software”

  1. Hi Kiran,
    Good post. Very informative.

    I am also playing with Tally integration via http interface. May be we can catch up and learn from each other. I am at kishalay.haldar@gmail.com

    Have you tried to obtain list of all vouchers in a particular ledger? For example I want to retrieve all vouchers that have been passed in “Cash” ledger. I have been unsuccessful so far.

    Cheers,
    Kish

    1. Kishalay,
      Thanks for stopping by. Well, am no expert with Tally, but this is something I tried:

      • I tried to export all the masters from Tally:
        curl -X POST localhost:9002 --data @allmasters.xml
        where allmasters.xml contains the following:

        <ENVELOPE>
        <HEADER>
        <TALLYREQUEST>Export Data</TALLYREQUEST>
        </HEADER>
        <BODY>
        <EXPORTDATA>
        <REQUESTDESC>
        <REPORTNAME>List of Accounts</REPORTNAME>
        <STATICVARIABLES>
        <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
        <ACCOUNTTYPE>All Masters</ACCOUNTTYPE>
        </STATICVARIABLES>
        </REQUESTDESC>
        </EXPORTDATA>
        </BODY>
        </ENVELOPE>
      • Then I ran a query to export all Ledgers from Tally.
        curl -X POST localhost:9002 --data @ledger.xml
        where ledger.xml contains this:

        <ENVELOPE>
        <HEADER>
        <TALLYREQUEST>Export Data</TALLYREQUEST>
        </HEADER>
        <BODY>
        <EXPORTDATA>
        <REQUESTDESC>
        <REPORTNAME>List of Accounts</REPORTNAME>
        <STATICVARIABLES>
        <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
        <ACCOUNTTYPE>Ledgers</ACCOUNTTYPE>
        </STATICVARIABLES>
        </REQUESTDESC>
        </EXPORTDATA>
        </BODY>
        </ENVELOPE>
      • I haven’t had the time, yet, to figure out how I can export a specific ledger information from Tally.
  2. Kiran: Thanks dude!!!

    But can you help me on a very specific problem i want to export excel files in to tally. I dont want to purchase the tool need urgently please help.

    🙂

    1. Pratiek, I do not have a mechanism to do this. I would explore the various excel munching libraries and write the code to extract/insert content from/to excel and Tally.
      Good luck with your search.

    2. I am Creating such tool in Python! But i am a bit confused to weather i should manipulate the exported xml file or should i use the XML over HTTP by tally! Though i was successful in importing list of ledgers, Purchase and sales vouchers but after the alteration of xml file we have to import the altered xml again!

  3. Kiran, very informative post.

    I had dozens of xmls that I make from excel sheets and I had to keep re-import them via UI until I had no errors. You post helped me to batch script all this using curl – Thanks a looot!!

    Pratiek – you can make Tally format xml file from excel sheets data.

  4. One addition – I could not import decent sized xml files – curl would not submit all data.

    But I could import using wget:
    wget –post-file all_data.xml localhost:9002

  5. Hello,

    I am from Give Foundation, a non-profit.
    When I try to import data through XML, the data gets imported into Tally. However, when I push the SAME data into Tally through VBA using the command-

    Dim tally_db As New MSXML2.ServerXMLHTTP30
    tally_db.Open “POST”, “http://localhost:9000”, False
    tally_db.send xml_string

    I get error
    Could not set ‘SVCurrentCompany’ to ‘Give Foundation -2010-2011 – (From 1-Apr-2010)’
    The SAME data in the XML works and XML gets imported. I tried importing on educational version using XML over HTTP, it worked, but on server, it gave me the above error. In both cases, data was EXACTLY the same, company name was SAME.

    Please help.

    Regards,
    Umesh

    1. Umesh,
      As much as I would like to help you out with this one, I really have no idea as to what is causing this error.
      A general web search yielded the trouble-shooting guide, where the explanations seem to be:

      Could not set ‘SVCurrentCompany’ to Server company
      Reason: This occurs if the right company has not been chosen on the Server.
      Solution: Choose the correct company from Gateway of Tally on the Server and try to synchronize the data again.

      and

      Could not set ‘SVCurrentCompany’ to Client company
      Reason: This error occurs if the same company is not loaded on the Server and the Client for Synchronization.
      Solution: Make sure that the same company is loaded on the server and client before starting the Synchronization. Or else, choose the company from Gateway of Tally on the Server.

      Maybe you have come across this already.
      Good luck with your search for a solution.

  6. Hello,

    I was able to see only few sample XML formats to connect to Tally. Where can i find the complete API document?

    Please help.

    Thanks,
    Mike

  7. Hello,

    I was able to see only few sample XML formats to connect to Tally. Where can i find the complete API document?

    Please help.

    Thanks,
    Mike

  8. Tally is very closed, very difficult to customize. Though Tally software itself offers customizations, it is clear those avenues are open for Tally and their ‘selected partners’ to take advantage of, to sell more software to customers and not really for developers to take advantage of these Tally features.

    Google searching for Tally xml tags for a few days kept leading me to the 2-3 sites which were not useful at all. I couldn’t even find a proper list of basic xml tags to query Tally. All I find is desperate people crying out for help without any assistance given.

    Emails to Tally Solutions have not yielded any satisfactory answers.

    If Tally needs to reach a broader audience and fast, it will need to be more open, lay out more APIs, xml tags for downloads, more extensive sample codes.

    Meanwhile, all the best to developers trying to extend Tally. If I get a breakthrough, I will definitely put it up in a website for everyone’s benefit and I urge fellow developers to do the same so we can all share and leverage the power of Tally.

  9. Hi Kiran,

    I have followed the steps that you have mentioned, but whatever xml I post, I get a constant static response as ‘Tally.ERP 9 Server is Running’
    Did it happen to you ever, and know of a fix? Kindly Let me know.

    Regards,
    Nilesh

    1. Nilesh, I do not have a clue as to what the issue could be. I have not faced such an issue – you are sure the XML you are posting is well formed?

  10. yea, Its exactly same as what you have, Just that I am using PHP to post it, curl library. Din’t mention it earlier coz I think it shouldn’t make any difference.

  11. oh, seems to be an issuse with my PHP thing, works fine from console. Will get back to you if I need anything. Thanks

    1. Sithes,
      Not sure what could be causing it; did you try with the curl tool? And also do the other verbs work for you – GET, HEAD, PUT, DELETE? I would check for all of that.

    1. Jovish,
      The Tally XML interface is one integration option. I would recommend that you have a look at the Tally Integration documentation to better understand all the available integration options, and choose the one that Tally recommends AND fits your application’s requirements.

  12. I gone through that document already , in that document they specified the version of Tally as Tally ERP 9. My doubt is can we use Tally XML interface and Tally ODBC interface for earlier versions of Tally? Where we can find the proper documentation for XML Tags that we are using to make the request ?

    1. Jovish, I don’t know the answer to that one. I would give it a try to see if it works. As for the documentation on the XML schemas, see one of my comments above

  13. Thanks Kiran. I have one doubt regarding Tally Integration , is it possible to access data from Tally when it is closed?

  14. Hi Kiran, I am trying to run a jsp code which connects java code with tally using jdbc – “TallyODBC_9000″ DSN but stuck up at GENERAL EXCEPTION. I dont know how to go ahead as I cant even fetch couple of fields from Tally DB…here is my code,

    Obtaining a Connection

    This Page Obtains a Connection to with Tally and executes a query
    <%
    try {
    out.println("” + “Not Yet Connected”);
    Connection conn = DriverManager.getConnection(“jdbc:odbc:TallyODBC_9000”);
    out.println(“” + “Connected”);
    Statement stmt = conn.createStatement ();
    ResultSet rset = stmt.executeQuery (“SELECT * FROM `TallyUser`.`Ledger`”);
    if (rset.next()) {
    %>

    Name
    Closing Balance

    $

    $

    Sorry, the query returned no rows!

    <%
    }
    rset.close();
    stmt.close();
    } catch (SQLException e) {
    out.println("” + “There was an error doing the query:”);
    out.println (“

    ” + e + “

    \n “);

    }
    %>

    Can you or anybody provide me few insights?

  15. sir i am new to tally and curl,
    i am not getting hw to use curl,
    where to type this “curl -X POST localhost:9002 –data @all_inventory_master.xml”
    i mean where is COMMAND LINE,,

    and in which directory “all_inventory_master.xml” to be saved.

  16. Hi…How can Integrate tally ERP 9.0 with php… Please send me sample code to my mail ID (prdpraik@gmail.com) if some one worked on this,,,,,,,

  17. Hi, kiran

    i m trying to integrate tally with java application using xml.
    so how can i do it.
    thanks in advance .please help

    1. Raju,
      This blog entry is supposed to give you some ideas on how to integrate with Tally. Have you tried it out, or are facing issues with it?
      Or can you elaborate on your question?

  18. really it is great work thank you very much about you effort,i searched a lot about this concept finally i very happy to find this stuff i got some idea but i am working on PHP can you please help me or give an idea how to integrate with php.

  19. Hi…How can Integrate tally ERP 9.0 with php… Please send me sample code to my mail ID (kinkar.sneha@gmail.com) if some one worked on this

  20. Hi Kiran,

    I’m trying to integrate Tally ERP9 with .Net(C# & Windows forms).

    so my question is there any possibility to give the Tally Company Directory path through XML to get the data?

  21. Hi,
    Have you tried deleting a voucher by XML?
    I’m not getting any success by following the format given in the Tally Integration document. All I get is a message saying tally is running.
    Any ideas?

  22. Hie I am failing to import vouchers to Tally I am get an error “Unknown request, cannot be completed, can you show me an example of how u can import vouchers to tally, I have managed to do ledger creation everything works preety fine except for the vouchers, I adapted vouchers xml from the link u gave, if I import using the tally Import Data option (“Opening tally”) it imports succefully but if I post the very same thing It doesnt work it gives the above error,

    1. Chaddy,
      Again, not something that I have tried, or will be able to do anytime now. Opening up the question here, in case some other user has a solution.

  23. Hi,
    Kiran, have you encountered any problem so far in passing a voucher creation string containing the special character ‘&’ ?
    Every time i try to pass such a voucher, tally returns an error : Unspecified or unknown request.
    But tally does allow me to create such a voucher or ledger manually.
    So I don’t know where the fault lies.

    BTW thanks for starting such a great discussion.

    1. Chinmay,
      You include an ‘&’ in the XML definition, and if so, have you tried escaping the ampersand? Again, am really providing a rather vague suggestion here.

  24. Hi,
    Yes I managed to solve the problem by escaping ‘&’ and such other similar characters. XML requires only 5 chars to be escaped. So it was easy.
    Thanks man

  25. Hi Kiran
    can you tell me from where I can download TallyODBC_9000 driver please
    reply me I newbie in Tally integration.

  26. Hi I got drivers and all
    but how can I achieve your tutorial here I am not getting anything.
    According to your cURL command I did same thing but it display
    WEB PAGE IS NOT AVAILABLE.
    please guide me bro .

  27. Hello
    This post is surely helpful. I have been looking to create a solution (I know I am not reinventing the wheel here) to let my customers add orders remotely, probably using a web browser. I am not sure if I could have the Tally erp 9 installed on a server, configure Apache and run a PHP code on the same machine to access the DB via DBMS interface. The idea is to make the Tally inventory and cost data made available to customers to place orders. Am I heading in the correct direction? My knowledge of Tally is highly limited and I have tried to read all the documents possible on Tally.

    Regards

  28. Hi All,
    I have get all Sales Order by below code :

    1
    Export
    Data
    Sales Orders Book

    Yes
    $$SysName:XML
    67

    Now, I want to filter single order details by passing orderid or referenceno(any parameter). anyone please provide me XML post request for this.

  29. I am unable to Fetch the Daybook entries for a particular date can you help me in fetching(Exporting) the DayBook Entries for a particular date or fetch the entries by the voucher key or voucher id . i am trying to fetch the daybook entries for a particular date but in response i am getting all the entries made for other dates also i.e all the entries.
    Either of the ways will help me XML(Soap) or ODBC

  30. Sir my computer is not supporting cURL. So please can you give a way out of this. Maybe another command line in tool!!

  31. Friends,
    to get xml codes for tally vouchers(Any thing like-receipts/payments/purchase/sales/stock entries etc.)-create a sample entry & save-open the entry via display/ledger menu..click export button-choose xml version-choose destination.That is it.use same code for your imports into tally.But delete lines & .use the rest.But there are lots of avoidable codes lines.Defaults.
    I am trying to integrate my web application with tally using XMLHHTPRequest.But not successful because of same origin issue. Can any one suggest me some suitable codesHtml/Java script/Php) I am 80 yrs and evince interest in software developements.
    Thanking you all,

    1. Hi Guru,

      You can’t make requests to localhost because of Same Origin policy in your webapp.
      You can do one thing to stop same origin policy. You can start chrome or firefox with disable web security flag or in chrome you can install a plugin called Allow Cross Origin Headers and then you can make XMLHTTPRequest to tally and get data otherwise you cannot at all because tally doesn’t allow it. In fact most websites don’t allow it.

  32. dear Kiran,
    Thanks for your propt reply & suggestion.i saw that.my problem is -status error-404-File not found.i used file path-“http://localhost:9002. if i try that directly on browser i get Tally response.i am held up for this reason.Any suggestion. Thanks

    1. Opening the url – http://localhost:9002 – in a browser, you are able to view some result. You are seeing a 404-file-not-found, when opening that url from your program? Some details of your code, and program would help. I suggest that you post these details on http://stackoverflow.com/ . It is easier to have this discussion on that site.

  33. Dear Sri Kiran,
    After scanning thru stackoverflow.com,i understand,one of the solutions to cross domain issue,is a proxy server.I also, find some provisions in Tally’s Advance configuration menu,for a Proxy server.But I do not find anything in Tally Integration manual about Proxy server.Are both the same?.whether Tally organisation has published any thing about this?can you enlighten me on this please.

  34. Owsome…thanks for support…for integration with mvc to tally………..excellent presentation and clerfications….thanks….best of luck…keep it up

  35. hi , can you help me .. I want to open/load company in tally through xml request . is it possible to change or select company through xml request ???

  36. Hi
    I tried to create a voucher(in a remote server) using XMLs…. I am receiving the line error “Could not set the SVCurrent Company to MyTesting” . (MyTesting is my Company’s name) I am not sure what’s the issue. The XML works fine if I import it to the Tally running on my local system . Please help me out. Thanks in advance!

    1. Souri, not sure what the issue could be. Have you tried posting that XML, via XML/HTTP on your local Tally? That may give you a clue as to what is going on. If this works, then try the remote server. Am not sure if Tally has any permissions related stuff on the remote server.
      Also, are you able to post to a different – dummy – company on your local / remote Tally?
      I would also try other different operations just to understand what is going on.
      Maybe the Tally integration document, for your version of Tally, has more useful details.
      These are things I would check for …

  37. One of my Customer wants tally on web…means he want to see all main reports of tally online (on website or something). anybody has solution for this ?

  38. hello sir,need ur help regarding integration.
    I want XML input/request for bank reconciliation entry for bank ledger.I tried lot of things but unable to proceed.pls help me for the same.

    1. Trushar, I suggest you post this query on stackoverflow.com … there are chances you may get better answers there.
      Also, it would help if you show some code, on what you tried to do … post those details too on stackoverflow.com.

  39. Anybody tried to create a new or alter existing company in Tally through XML? I am not able to find the XML format for doing this.

  40. Hi Kiran,

    How can i get the currently selected company using xml tags instead of list of companies currently open in tally.

    1. Ashish, stackoverflow.com is your best bet to get an answer to this question. Or the tally documentation.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s