A blog on Tally Integration, to import and export data from Tally.ERP programmatically using VB6, VB.NET,C#,ASP.NET etc

Friday, April 20, 2007

Analyzing the Tally Server Response

RTSLINK DLL

This article describes how to read the Tally Server Response after a XML request is sent using the Send() function. To begin with, let us see the C language declaration of the Send() function.

C language declaration of the Send() function
int __stdcall Send(message);

Remarks:-
  1. The send function returns an Integer value (Zero for success, otherwise the error-code).
  2. If the return value is Zero, it implies that the XML request has been successfully sent to the Tally server.

Analysing the Tally Server Response
As mentioned above, if the Send() function returns 0 (Zero), it implies that the XML Request has been successfully sent to the Tally Server. The XML requested can be either reading or writing data to the Tally' database. Example of XML Request:-
  1. Export (read) any report data (Trial balance, Ledger etc.)
  2. Import (write) any master or voucher data to Tally's database
On receiving the XML Request message, the Tally Server processes it and then delivers a response/result which can be retrieved using the ResponseText() function which is described later on. Example:-
  1. If you had requested for any Report, the Tally Server response will contain the Report data.
  2. If you had requested for writing data to Tally's database, the Tally Server response will contain details whether a new records is created; or altered or deleted.
In the later case, when the XML request is to write to Tally's database, it becomes essential to analyze the Tally Server response and check for errors. For this the ResponseText() function is to be used. The ResponseText() function retrieves the Tally Server response and returns it in a string.

C language declaration of ResponseText() function
LPSTR __stdcall ResponseText(void);

You can either display the response message in a Message-Box or parse it using XML DOM. Use the following VB code to parse the response message and check if any errors are there or not.

Sample VB code
Set ChildNodes = XMLDOM.SelectNodes("/RESPONSE/LINEERROR")
if (ChildNodes.Length > 0) then
MsgBox "Tally write error"
else
MsgBox "Success"
end if

For more information about using XML DOM, please refer the topic "Using XML DOM" in "RTSlink - An Insight" document which can be downloaded from www.rtslink.com/downloads.html


Shweta Computers
www.rtslink.com

2 comments:

Anonymous said...

Is it possible to retrive a sales voucher with all the information i.e inventory list ,ledger list using sql statement as what we export from sales voucher alteration screen in xml format

Shweta Softwares said...

We are working on the same.