0

Trying to retrieve the GSTIN of the active company in Tally ERP. Making a POST call using the following **<FETCH>Gstnotificationnumber</FETCH>** command

But no data is returned as part of the response under **<DATA>** output given below

Any help would be really great!!

<ENVELOPE>
    <HEADER>
        <VERSION>1</VERSION>
        <TALLYREQUEST>EXPORT</TALLYREQUEST>
        <TYPE>OBJECT</TYPE>
        <SUBTYPE>COMPANY</SUBTYPE>
        <ID TYPE="Name">Example Company Name</ID>
    </HEADER>
    <BODY>
        <DESC>
            <STATICVARIABLES>
                <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
            </STATICVARIABLES>
            <FETCHLIST>
                <FETCH>Gstnotificationnumber</FETCH>
            </FETCHLIST>
        </DESC>
    </BODY>
</ENVELOPE>

Output From Tally ERP which is missing Gstnotificationnumber from the COMPANY object

Tally Object Schema - (For Reference)

<DATA>
    <TALLYMESSAGE>
        <COMPANY NAME="Example Company Name" RESERVEDNAME="" REQNAME="Example Company Name">
            <NAME TYPE="String">Example Company Name</NAME>
            <ISDEEMEDPOSITIVE TYPE="Logical"></ISDEEMEDPOSITIVE>
            <CANDELETE TYPE="Logical">No</CANDELETE>
            <MASTERID TYPE="Number"> 29</MASTERID>
        </COMPANY>
    </TALLYMESSAGE>
</DATA>

1 Answers1

1

So the GSTIN number in Tally is not a field belonging to the Company Object. Some of the fields belonging to the Company Object are Address, Phone Number, Email, State etc. For example, modify the <FETCH> tag to have Address and the <DATA> tag in the response will give you the required details.

    <ENVELOPE>
    <HEADER>
        <VERSION>1</VERSION>
        <TALLYREQUEST>EXPORT</TALLYREQUEST>
        <TYPE>OBJECT</TYPE>
        <SUBTYPE>COMPANY</SUBTYPE>
        <ID TYPE="Name">Example Company Name</ID>
    </HEADER>
    <BODY>
        <DESC>
            <STATICVARIABLES>
                <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
            </STATICVARIABLES>
            <FETCHLIST>
                <FETCH>Address</FETCH>
            </FETCHLIST>
        </DESC>
    </BODY>
</ENVELOPE>

If you look deep into the Tally database structure, the GSTIN Number belongs to the Tax Unit Object. Assuming that default configurations have not been changed for a sample company, the Tax Unit object is usually 'Default Tax Unit'. Now you can query the Tax Unit Object for the company and fetch the GSTIN.

    <ENVELOPE>
        <HEADER>
            <VERSION>1</VERSION>
            <TALLYREQUEST>EXPORT</TALLYREQUEST>
            <TYPE>OBJECT</TYPE>
            <SUBTYPE>Tax Unit</SUBTYPE>
            <ID TYPE="Name">Default Tax Unit</ID>
        </HEADER>
        <BODY>
            <DESC>
                <STATICVARIABLES>
                    <SVCURRENTCOMPANY>Example Company Name</SVCURRENTCOMPANY>
                    <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
                </STATICVARIABLES>
                <FETCHLIST>
                    <FETCH>GSTRegNumber</FETCH>
                </FETCHLIST>
            </DESC>
        </BODY>
    </ENVELOPE>

If you're getting errors in the Tax Unit, it's easier to just use the in-built code to get what you need. There's two ways you can get the GSTIN Number:

  1. By using the formula - CMPGSTaxNumber
  2. By using the direct Object-Method notation : $GSTRegNumber:TaxUnit:@@CMPExcisePrimaryGodown

To get these in your XML, you would need to add TDL code within <TDL></TDL> tags in your SOAP request.

A sample is below, if you're interested in reading how the TDL Report structure works, you can refer this document by Tally Solutions.


    <ENVELOPE>
        <HEADER>
            <VERSION>1</VERSION>
            <TALLYREQUEST>EXPORT</TALLYREQUEST>
            <TYPE>Data</TYPE>
            <ID>GSTReport</ID>
        </HEADER>
        <BODY>
            <DESC>
                <STATICVARIABLES>
                    <SVCURRENTCOMPANY>Example Company Name</SVCURRENTCOMPANY>
                    <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
                </STATICVARIABLES>
                <TDL>
                    <TDLMESSAGE>
                        <REPORT NAME="GSTReport">
                            <FORM>GSTReportForm</FORM>
                        </REPORT>
                        <FORM NAME="GSTReportForm">
                            <PART>GSTReportPart</PART>                      
                        </FORM>
                        <PART NAME="GSTReportPart">
                            <LINE>GSTReportLine</LINE>
                            <SCROLLED>Vertical</SCROLLED>
                        </PART>
                        <LINE NAME="GSTReportLine">
                            <FIELDS>GSTNumber</FIELDS>                
                        </LINE>
                        <FIELD NAME="GSTNumber">            
                            <SET>$GSTRegNumber:TaxUnit:@@CMPExcisePrimaryGodown</SET>
                        </FIELD>
                    </TDLMESSAGE>
                 </TDL>
                </DESC>
            </BODY>
        </ENVELOPE>

Mitalee Rao
  • 191
  • 6
  • Receiving the following error with some customers data `code`Could not find Tax Unit:Default Tax Unit!`code` – Prabakaran K Oct 15 '19 at 11:12
  • @PrabakaranK - The SOAP XML specification is a little unstable in Tally because the source code is very vast and there are multiple object inheritances. I've given a very short answer here, but the long answer is that you would need to study the Tally Source Code in order to make better XML requests and generate the responses you need. ATB! – Mitalee Rao Oct 16 '19 at 04:25
  • As far as I know there is no relation between company and GST. So the SVCURRENTCOMPANY would be ignored and you will get the GST number of the opened company in tally assuming all companies use "Default Tax Unit". – kp666 Dec 23 '19 at 14:07