Significance of Tags
There are some significant tags that are required for requesting any info from TallyPrime. The tags are divided into two categories:
Header Tags
Header tags are enclosed with the tag <HEADER> and </HEADER>. These tags give all the header information.
<VERSION
It gives the version of the messaging format. The tag <VERSION> is a mandatory tag which is used in Header tags.
<TALLYREQUEST>
TALLYREQUEST tag specifies the type of request. This tag is vital as it determines the response required. The permissible values for this tag are Import, Export and Execute and these values further determine the range of values required for this tag.
Import
Import is specified when we want Tally to import data from the XML fragment to Tally. i.e Tally validates and saves the data. A request is made to Import Data or File which can be specified within the subsequent tags.
Export
Export is specified when we want to retrieve data from Tally. A request is made to Export Data, Collection, Object, Function, etc. which is specified within the tag <TYPE>.
Execute
Execute is specified when we want to execute some TDL actions in TallyPrime. Here the request is made to Execute TDL Action which can be specified within the <TYPE> tag.
The following table describes the value of <TALLYREQUEST> tag.
Request Type |
Action |
Comments |
Import |
Set |
Requesting recipient to import the data. |
Export |
Get |
Request for Exporting Data from other end. |
Execute |
Run |
Request for executing the action in Tally |
The TYPE attribute of this tag can be used to identify specific instance of an entity. The attribute Type can be used like the following example:
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>OBJECT</TYPE>
<SUBTYPE>Ledger</SUBTYPE>
<ID TYPE=”Name”>ABC India Pvt. Ltd. </ID>
</HEADER>
TYPE |
ID – Value |
Qualification |
DATA |
Name of the Request / Report |
Not Applicable |
COLLECTION |
Name of the Collection |
Not Applicable |
OBJECT |
Object ID or Name of the Object |
Object Identifier Attribute |
ACTION |
Name of the Action to be performed – As of now, only the action Sync is introduced |
Not Applicable |
FUNCTION |
Name of the Function to be executed |
Not Applicable |
<STATUS>
The <STATUS> tag is applicable only for Response. Value within this tag indicates success or failure of the request made. Possible values are SUCCESS (1), FAILURE (0).
Example for a Failure Response
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>DATA</TYPE>
<ID>All masters</ID>
</HEADER>
<BODY>
<DESC>
</DESC>
</BODY>
</ENVELOPE>
Failure Response
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<STATUS>0</STATUS>
</HEADER>
<BODY>
<DATA>
</DATA>
</BODY>
</ENVELOPE>
At the time of request within <HEADER>…</HEADER>, all tags must have appropriate value. Only <SUBTYPE> is optional and can be used where applicable. In case of Response Header has only two tags i.e., <VERSION> tag to indicate the version of the messaging format and <STATUS> tag to indicate Success / Failure.
Body Tags
As discussed, there are two sections under the tag <BODY>:
- <DESC>: Description for Request/Response
- <DATA>: Data required for Request/Response
<DESC>: Description for Request/Response
The description block is used for providing a description of Request / Response. Following are the different types of descriptions available inside the description tag:
- StaticVariables
- RepeatVariables
- ComputeList
- FetchList
- Function ParamList
- TDL
<STATICVARIABLES>
The STATICVARIABLES provides all configuration details and all global variable details. All tags inside Staticvariable would be any of the system variables. In the following example SVCurrent-Company, SVFromDate and SVToDate are the system variables. All elements inside the tag <STATICVARIABLES> would be starting with SV.
<DESC>
<STATICVARIABLES>
<SVCURRENTCOMPANY>
ABC Company Ltd
</SVCURRENTCOMPANY>
<SVFROMDATE TYPE=”Date”>1-Apr-2008</SVFROMDATE>
<SVTODATE TYPE=”Date”>31-Mar-2009</SVTODATE>
</STATICVARIABLES>
</DESC>
<REPEATVARIABLES>
REPEATVARIABLES is used to specify the details for all the repeated variable information such as Date Range, Block Range etc. All the information related to repeated variables will be enclosed within the tag <REPEATSET>. Here also the value will be enclosed with the system variables. In the following example shows the repeated usage of variables.
<REPEATVARIABLES>
<REPEATSET> <SVFROMDATE>1-Apr-2007</SVFROMDATE> <SVFROMDATE>1-Oct-2007</SVFROMDATE>
</REPEATSET>
<REPEATSET> <SVTODATE>30-Sep-2007</SVTODATE> <SVTODATE>31-Mar-2008</SVTODATE>
</REPEATSET>
</REPEATVARIABLES>
<FETCHLIST>
FETCHLIST is used to specify the list of storages to be fetched. In case of type object the methods that need to be retrieved within the <FETCHLIST> Tag using <FETCH> Tags.
<FETCHLIST>
<FETCH>TBalClosing</FETCH>
<FETCH>TBalOpening</FETCH>
<FETCH>StkClBalance</FETCH>
<FETCH>StkOpBalance</FETCH>
</FETCHLIST>
<FUNCPARAMLIST>
It is used to specify the parameters used for function execution. In the time of using Function as a type with parameters then the parameter list will come under the tag <PARAMLIST>. The structure of PARAMLIST as follows:
<FUNCPARAMLIST>
<PARAM>@@FirstParameter</PARAM>
<PARAM TYPE=”Number”>0.10</PARAM>
</FUNCPARAMLIST>
<TDL>
It is used to specify the TDL related information. The complete TDL to be executed in order to handle the Request; will be sent within the TDL block. TDL tag is specified, when Report, Collection, Object or Function is to be sent as a request to Tally. Tally application will respond depends on the TDL request. A TDL specification is required only when the TDL required for serving the request does not exist at the Tally end.
The TDL program is sent using TDL tag as per the following structure:
<TDL>
<TDLMESSAGE>
<REPORT NAME=”TDL Report” ISMODIFY=”No” ISFIXED=”No” ISINITIALIZE=”No” ISOPTION=”No” ISINTERNAL=”No”>
<FORMS>First TDL Form</FORMS>
</REPORT>
<FORM NAME=”First TDL Form” ISMODIFY=”No” ISFIXED=”No” ISINITIALIZE=”No” ISOPTION=”No” ISINTERNAL=”No”>
<TOPPARTS>First TDL Part</TOPPARTS>
</FORM>
.
.
.
<FIELD NAME=”First TDL Field” ISMODIFY=”No”ISFIXED=”No” ISINITIALIZE=”No” ISOPTION=”No” ISINTERNAL=”No”>
<SET>”Welcome to the world of TDL”</SET>
</FIELD>
</TDLMESSAGE>
</TDL>
TDL request should be enclosed within <TDL> tags. The <TDLMESSAGE> tag is mandatory inside the <TDL> tag. Inside that we can write all the definitions and its attributes with their values. All definitions and attributes are represented as tags. 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. Specifying the value of ID is ReportName. This report name should come 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>
Collection specification in TDL
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Collection</TYPE>
<ID>Collection Name</ID>
</HEADER>
In the above template the value of TallyRequest is Export and the Type is Collection. Specifying the value of ID is CollectionName. This collection name should come inside the tag <COLLECTION > within the <TDL> tag.
<TDL>
<TDLMESSAGE>
<COLLECTION NAME=”Collection of Ledgers” ISMODIFY=”No” ISFIXED=”No” ISINITIALIZE=”No” ISOPTION=”No” ISINTERNAL=”No”>
<TYPE>Ledger</TYPE>
</COLLECTION>
.
.
.
</TDLMESSAGE>
</TDL>
Object specification in TDL
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Object</TYPE>
<ID>Object Name</ID>
</HEADER>
In the above template the value of TallyRequest is Export and the Type is Object. Specifying the value of ID is ObjectName. This object name should come inside the tag <OBJECT> within the <TDL> tag.
Consider the following example:
<TDL>
<TDLMESSAGE>
<OBJECT NAME=”Ledger” ISINITIALIZE=”Yes”>
<LOCALFORMULA>
TNetBalance: $$AsPositive: $$AmountSubtract: $ClosingBalance: $OpeningBalance
</LOCALFORMULA>
</OBJECT>
</TDLMESSAGE>
</TDL>
Function specification in TDL
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>Export</TALLYREQUEST>
<TYPE>Function</TYPE>
<ID>Function Name</ID>
</HEADER>
In the above template the value of TallyRequest is Export and the Type is Function. Specifying the value of ID is FunctionName.
<DESC>
<FUNCPARAMLIST>
<PARAM>@@FirstParameter</PARAM>
<PARAM TYPE=”Number”>0.10</PARAM>
</FUNCPARAMLIST>
<TDL>
<TDLMESSAGE>
<SYSTEM TYPE=”Formulae” NAME=”FirstParameter”>
1242849 / 1000
</SYSTEM>
</TDLMESSAGE>
</TDL>
</DESC>
In the above example, the function parameter list enclosed with the tag <FUNCPARAMLIST>. The formula which is used inside the Function parameter list is specified inside TDL Tag.
<DATA>: Data required for the Request/Response
Data contains the actual data being transferred from one system to another. If the information is retrieved then the data will be obtained inside the <DATA> tag.
<DATA>
<COLLECTION>
<OBJECT NAME=”CDROM Disks 10s – Defective”>
<NAME TYPE=”String”>CDROM Disks 10s – Defective</NAME>
</OBJECT>
<OBJECT NAME=”TVS MSP 245 132 Col Printer”>
<NAME TYPE=”String”>TVS MSP 245 132 Col Printer</NAME>
</OBJECT>
<OBJECT NAME=”Assembled PIV”>
<NAME TYPE=”String”>Assembled PIV</NAME>
</OBJECT>
</COLLECTION>
</DATA>
In the case of importing data to be sent to Tally, to be specified within the <DATA> tag.
<DATA>
<TALLYMESSAGE>
<LEDGER Action = “Create”>
<NAME>ICICI Test</NAME>
<PARENT>Bank Accounts</PARENT>
<OPENINGBALANCE>13500</OPENINGBALANCE>
</LEDGER>
</TALLYMESSAGE>
<DATA>
After having a clear idea about all the important tags and their usage, will concentrate on some examples.