Saturday, November 10, 2012

Significance of Tally XML Tags

Significance of Tally XML Tags. 

Following are some significant tags that are required for requesting any info from Tally.ERP 9.
The tags are divided into two categories:
  • Header Tags
  • Body
Header Tags.

Header tags are enclosed with the tag <HEADER> and </HEADER>. These tag gives all the header information.

Example : Tags coming under the header tags.

        <HEADER>
                  <VERSION>1</VERSION>
                  <TALLYREQUEST>EXPORT</TALLYREQUEST>
                  <TYPE>OBJECT</TYPE>
                  <SUBTYPE>Ledger</SUBTYPE>
                  <ID TYPE="Name">ABC India Pvt. Ltd. </ID>
        </HEADER>
 
<VERSION>  .....  </VERSION>

It gives the version of the messaging format. The tag <VERSION> is a mandatory tag which is used in Header tags.

<TALLYREQUEST>  .....  </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. This value further determines 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 Action in Tally.ERP 9. Here the request is made to Execute TDL Action which can be specified within the <TYPE> tag.

<TYPE>  .....  </TYPE>

The <TYPE> tag provides the type of information being requested / responded. The tag TALLYREQUEST determines the value for this tag.

The possible values of <TYPE> tag are as follows: 
  • Data - Request for the data or Response of data.
  • Collection - Collection Request or Response.
  • Object - Object Request or Response.
  • Action - Action to be performed by the message recipient.
  • Function - Execute the Function Request.

<SUBTYPE>  .....  </SUBTYPE>

<SUBTYPE> is an optional tag. In cases the <TYPE> tag alone is not sufficient to identify the entity then SUBTYPE tag will be used. For example OBJECT refers to various types of objects such as GROUP, LEDGER, and CURRENCY etc.

<ID>  .....  </ID>

<ID> tag provides the identification of Request. The TYPE attribute of this tag can be used to identify specific instance of an entity.

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

Body Tags.

As discussed, there are two sections under the tag <BODY>: 
  • <DESC>: Description for Request / Respons
  • <DATA>: Data required for Request / Response 
<DESC> ..... </DESC>  : Description for Request / Response

The description block is used for providing description of Request / Response. Following are the different types of descriptions available inside the description tag: 
  • StaticVariable
  • RepeatVariables
  • ComputeList
  • FetchList
  • Function ParamList
  • TDL

<STATICVARIABLES>  .....  </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 SVCurrentCompany, 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>

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>

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

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

12 comments:

  1. It sounds interesting. I have xml request file for export stock summary. How can i export item-wise stock summary report by using xml request file.

    Could you please help me...

    Thanks,
    Dhinakaran P.
    Email : spdhina90@gmail.com

    ReplyDelete
    Replies
    1. how can I export Itemwise stock summary report in xml.Please help to solve in tdl.

      Delete
    2. what is the use VOUCHERKEY tag in xml

      Delete
  2. sir, while importing sales data from excel to tally using xml, the data is correctly imported, but after importing to tally i found a mistake in data and corrected the mistake in excel file and again imported same file to tally. But now instead of updating data, tally has double entry. how to solve this problem.

    thanks in advance

    ramdas (ramdasmji@gmail.com)

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. In <VOUCHER ACTION="Create" put ACTION="Create" when you want to update the record.

    ReplyDelete
  5. I WANT DETAILED XML FOR PUCHASE INVOICE WITH SPECIFIC ITEMS MENTIONED IN TALLY

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  6. i have a TDL code with some functions and collections. can u help me guys to convert it to corresponding XML format?i dont know how to write the functions and collections in XML from usual TDL language(syntax).pls help me if u can....plzzzz..

    ReplyDelete
  7. Where can i find all the tall xml tag documentions so that we will be able make our own vouchers and make use if it

    ReplyDelete
  8. Can We create Company in tally with XML integration to tally ??

    ReplyDelete