How to retrieve GSTN of a company : Tally XML integration

拟墨画扇 提交于 2020-01-06 05:45:10

问题


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:


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>



来源:https://stackoverflow.com/questions/57756766/how-to-retrieve-gstn-of-a-company-tally-xml-integration

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!