简体   繁体   中英

Tally not importing data from XML

I am developing tally application in swing. Now I want integrate with the Tally. If I import the data to Tally I am getting error like this.

Importing Data from 'New.xml' on 13-Apr-2016 at 14:11:51

Importing Data to company: 'Technologies Pvt Ltd'

ERROR: Voucher: ID:<REMOTEID:face3a8f-f920-4781-a14b-ed095d0b0145-00000006>,       Voucher Type: Payment, Source Voucher Number: 203, Voucher Number: , Date: 

Import Summary
Created : 0
Altered : 0
Deleted : 0
Combined: 0
Ignored : 0
Errors  : 1
----------------------------------------------

This is my XML file.

<ENVELOPE>
<HEADER>
<TALLYREQUEST>Import Data</TALLYREQUEST>
</HEADER>
<BODY>
<IMPORTDATA>
<REQUESTDESC>
<REPORTNAME>Vouchers</REPORTNAME>
<STATICVARIABLES>
<SVCURRENTCOMPANY>Technologies Pvt Ltd</SVCURRENTCOMPANY>
</STATICVARIABLES>
</REQUESTDESC>
<REQUESTDATA>
<TALLYMESSAGE xmlns:UDF="TallyUDF">
<VOUCHER REMOTEID="face3a8f-f920-4781-a14b-ed095d0b0145-00000006" VCHKEY="face3a8f-f920-4781-a14b-ed095d0b0145-0000a748:000000061" VCHTYPE="Payment" ACTION="Create" OBJVIEW="Accounting Voucher View">
<OLDAUDITENTRYIDS.LIST TYPE="Number">
<OLDAUDITENTRYIDS>-1</OLDAUDITENTRYIDS>
</OLDAUDITENTRYIDS.LIST>
<DATE>20160413</DATE>
<GUID>face3a8f-f920-4781-a14b-ed095d0b0145-00000006</GUID>
<NARRATION>100</NARRATION>
<VOUCHERTYPENAME>Payment</VOUCHERTYPENAME>
<VOUCHERNUMBER>203</VOUCHERNUMBER>
<PARTYLEDGERNAME>Cash</PARTYLEDGERNAME>
<CSTFORMISSUETYPE/>
<CSTFORMRECVTYPE/>
<FBTPAYMENTTYPE>Default</FBTPAYMENTTYPE>
<PERSISTEDVIEW>Accounting Voucher View</PERSISTEDVIEW>
<VCHGSTCLASS/>
<DIFFACTUALQTY>No</DIFFACTUALQTY>
<ISMSTFROMSYNC>No</ISMSTFROMSYNC>
<ASORIGINAL>No</ASORIGINAL>
<AUDITED>No</AUDITED>
<FORJOBCOSTING>No</FORJOBCOSTING>
<ISOPTIONAL>No</ISOPTIONAL>
<EFFECTIVEDATE>20170331</EFFECTIVEDATE>
<USEFOREXCISE>No</USEFOREXCISE>
<ISFORJOBWORKIN>No</ISFORJOBWORKIN>
<ALLOWCONSUMPTION>No</ALLOWCONSUMPTION>
<USEFORINTEREST>No</USEFORINTEREST>
<USEFORGAINLOSS>No</USEFORGAINLOSS>
<USEFORGODOWNTRANSFER>No</USEFORGODOWNTRANSFER>
<USEFORCOMPOUND>No</USEFORCOMPOUND>
<USEFORSERVICETAX>No</USEFORSERVICETAX>
<ISEXCISEVOUCHER>No</ISEXCISEVOUCHER>
<EXCISETAXOVERRIDE>No</EXCISETAXOVERRIDE>
<USEFORTAXUNITTRANSFER>No</USEFORTAXUNITTRANSFER>
<EXCISEOPENING>No</EXCISEOPENING>
<USEFORFINALPRODUCTION>No</USEFORFINALPRODUCTION>
<ISTDSOVERRIDDEN>No</ISTDSOVERRIDDEN>
<ISTCSOVERRIDDEN>No</ISTCSOVERRIDDEN>
<ISTDSTCSCASHVCH>No</ISTDSTCSCASHVCH>
<INCLUDEADVPYMTVCH>No</INCLUDEADVPYMTVCH>
<ISSUBWORKSCONTRACT>No</ISSUBWORKSCONTRACT>
<ISVATOVERRIDDEN>No</ISVATOVERRIDDEN>
<IGNOREORIGVCHDATE>No</IGNOREORIGVCHDATE>
<ISSERVICETAXOVERRIDDEN>No</ISSERVICETAXOVERRIDDEN>
<ISISDVOUCHER>No</ISISDVOUCHER>
<ISEXCISEOVERRIDDEN>No</ISEXCISEOVERRIDDEN>
<ISEXCISESUPPLYVCH>No</ISEXCISESUPPLYVCH>
<ISVATPRINCIPALACCOUNT>No</ISVATPRINCIPALACCOUNT>
<ISSHIPPINGWITHINSTATE>No</ISSHIPPINGWITHINSTATE>
<ISCANCELLED>No</ISCANCELLED>
<HASCASHFLOW>Yes</HASCASHFLOW>
<ISPOSTDATED>No</ISPOSTDATED>
<USETRACKINGNUMBER>No</USETRACKINGNUMBER>
<ISINVOICE>No</ISINVOICE>
<MFGJOURNAL>No</MFGJOURNAL>
<HASDISCOUNTS>No</HASDISCOUNTS>
<ASPAYSLIP>No</ASPAYSLIP>
<ISCOSTCENTRE>No</ISCOSTCENTRE>
<ISSTXNONREALIZEDVCH>No</ISSTXNONREALIZEDVCH>
<ISEXCISEMANUFACTURERON>No</ISEXCISEMANUFACTURERON>
<ISBLANKCHEQUE>No</ISBLANKCHEQUE>
<ISVOID>No</ISVOID>
<ISONHOLD>No</ISONHOLD>
<ORDERLINESTATUS>No</ORDERLINESTATUS>
<VATISAGNSTCANCSALES>No</VATISAGNSTCANCSALES>
<VATISPURCEXEMPTED>No</VATISPURCEXEMPTED>
<ISVATRESTAXINVOICE>No</ISVATRESTAXINVOICE>
<ISDELETED>No</ISDELETED>
<CHANGEVCHMODE>No</CHANGEVCHMODE>
<ALTERID/>
<MASTERID/>
<VOUCHERKEY>183927679483912</VOUCHERKEY>
<EXCLUDEDTAXATIONS.LIST/>
<OLDAUDITENTRIES.LIST/>
<ACCOUNTAUDITENTRIES.LIST/>
<AUDITENTRIES.LIST/>
<DUTYHEADDETAILS.LIST/>
<SUPPLEMENTARYDUTYHEADDETAILS.LIST/>
<INVOICEDELNOTES.LIST/>
<INVOICEORDERLIST.LIST/>
<INVOICEINDENTLIST.LIST/>
<ATTENDANCEENTRIES.LIST/>
<ORIGINVOICEDETAILS.LIST/>
<INVOICEEXPORTLIST.LIST/>
<ALLLEDGERENTRIES.LIST>
<OLDAUDITENTRYIDS.LIST TYPE="Number">
<OLDAUDITENTRYIDS>-1</OLDAUDITENTRYIDS>
</OLDAUDITENTRYIDS.LIST>
<LEDGERNAME>WATER EXP</LEDGERNAME>
<GSTCLASS/>
<ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
<LEDGERFROMITEM>No</LEDGERFROMITEM>
<REMOVEZEROENTRIES>No</REMOVEZEROENTRIES>
<ISPARTYLEDGER>No</ISPARTYLEDGER>
<ISLASTDEEMEDPOSITIVE>Yes</ISLASTDEEMEDPOSITIVE>
<AMOUNT>-100.00</AMOUNT>
<SERVICETAXDETAILS.LIST/>
<BANKALLOCATIONS.LIST/>
<BILLALLOCATIONS.LIST/>
<INTERESTCOLLECTION.LIST/>
<OLDAUDITENTRIES.LIST/>
<ACCOUNTAUDITENTRIES.LIST/>
<AUDITENTRIES.LIST/>
<INPUTCRALLOCS.LIST/>
<DUTYHEADDETAILS.LIST/>
<EXCISEDUTYHEADDETAILS.LIST/>
<SUMMARYALLOCS.LIST/>
<STPYMTDETAILS.LIST/>
<EXCISEPAYMENTALLOCATIONS.LIST/>
<TAXBILLALLOCATIONS.LIST/>
<TAXOBJECTALLOCATIONS.LIST/>
<TDSEXPENSEALLOCATIONS.LIST/>
<VATSTATUTORYDETAILS.LIST/>
<COSTTRACKALLOCATIONS.LIST/>
<REFVOUCHERDETAILS.LIST/>
<INVOICEWISEDETAILS.LIST/>
<VATITCDETAILS.LIST/>
</ALLLEDGERENTRIES.LIST>
<ALLLEDGERENTRIES.LIST>
<OLDAUDITENTRYIDS.LIST TYPE="Number">
<OLDAUDITENTRYIDS>-1</OLDAUDITENTRYIDS>
</OLDAUDITENTRYIDS.LIST>
<LEDGERNAME>Cash</LEDGERNAME>
<GSTCLASS/>
<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
<LEDGERFROMITEM>No</LEDGERFROMITEM>
<REMOVEZEROENTRIES>No</REMOVEZEROENTRIES>
<ISPARTYLEDGER>Yes</ISPARTYLEDGER>
<ISLASTDEEMEDPOSITIVE>No</ISLASTDEEMEDPOSITIVE>
<AMOUNT>100.00</AMOUNT>
<SERVICETAXDETAILS.LIST/>
<BANKALLOCATIONS.LIST>
<DATE>20170331</DATE>
<INSTRUMENTDATE>20170331</INSTRUMENTDATE>
<NAME>d29faa3c-2cb8-429e-9d50-cb4243b68a8d</NAME>
<TRANSACTIONTYPE>Cheque</TRANSACTIONTYPE>
<PAYMENTFAVOURING>Water Exp</PAYMENTFAVOURING>
<CHEQUECROSSCOMMENT>A/c Payee</CHEQUECROSSCOMMENT>
<UNIQUEREFERENCENUMBER>3CODSsNV01ippV7T</UNIQUEREFERENCENUMBER>
<STATUS>No</STATUS>
<PAYMENTMODE>Transacted</PAYMENTMODE>
<BANKPARTYNAME>Water Exp</BANKPARTYNAME>
<ISCONNECTEDPAYMENT>No</ISCONNECTEDPAYMENT>
<ISSPLIT>No</ISSPLIT>
<ISCONTRACTUSED>No</ISCONTRACTUSED>
<AMOUNT>1000.00</AMOUNT>
<CONTRACTDETAILS.LIST/>
</BANKALLOCATIONS.LIST>
<BILLALLOCATIONS.LIST/>
<INTERESTCOLLECTION.LIST/>
<OLDAUDITENTRIES.LIST/>
<ACCOUNTAUDITENTRIES.LIST/>
<AUDITENTRIES.LIST/>
<INPUTCRALLOCS.LIST/>
<DUTYHEADDETAILS.LIST/>
<EXCISEDUTYHEADDETAILS.LIST/>
<SUMMARYALLOCS.LIST/>
<STPYMTDETAILS.LIST/>
<EXCISEPAYMENTALLOCATIONS.LIST/>
<TAXBILLALLOCATIONS.LIST/>
<TAXOBJECTALLOCATIONS.LIST/>
<TDSEXPENSEALLOCATIONS.LIST/>
<VATSTATUTORYDETAILS.LIST/>
<COSTTRACKALLOCATIONS.LIST/>
<REFVOUCHERDETAILS.LIST/>
<INVOICEWISEDETAILS.LIST/>
<VATITCDETAILS.LIST/>
</ALLLEDGERENTRIES.LIST>
<PAYROLLMODEOFPAYMENT.LIST></PAYROLLMODEOFPAYMENT.LIST>
<ATTDRECORDS.LIST></ATTDRECORDS.LIST>
</VOUCHER>
</TALLYMESSAGE>
</REQUESTDATA>
</IMPORTDATA>
</BODY>
</ENVELOPE>

Is there any error in my xml file, please help me. there is no enough document in online.

@shimbu shambu, I also faced the same problem and resolved it by changing the date value in DATE tag. This issue occured due to the variation in the date that of passing in the xml and the current date in tally.If you are using the educational version of tally then you can't change the date in the tally. You have to change it in the xml file.

尝试像这样传递无效的 XML 数据: <![CDATA[ {INVALID XML}]]>

I saw this post when I was trying to the same task which you are doing, wish to share somethings what I did for solving this may be it will help you to proceed further..

java code is as bellow

TallyRequest.java

package tallyrequest;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;

public class TallyRequest {

    public String CreateRequest() {
        String TXML = null;

        TXML = "<ENVELOPE>"
                + "<HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>"
                + "<BODY>"
                + "<IMPORTDATA>"
                + "<REQUESTDESC><REPORTNAME>Vouchers</REPORTNAME><STATICVARIABLES><SVCURRENTCOMPANY>Crane</SVCURRENTCOMPANY></STATICVARIABLES></REQUESTDESC>"
                + "<REQUESTDATA>"
                + "<TALLYMESSAGE xmlns:UDF=\"TallyUDF\">"
                + "<VOUCHER REMOTEID=\"00000001\" VCHTYPE=\"Receipt\" ACTION=\"Create\" OBJVIEW=\"Accounting Voucher View\">"      
                + "<DATE>20160701</DATE>"
                + "<VOUCHERTYPENAME>Receipt</VOUCHERTYPENAME>"
                + "<VOUCHERNUMBER>3</VOUCHERNUMBER>"
                + "<PARTYLEDGERNAME>Cash</PARTYLEDGERNAME>"
                + "<PERSISTEDVIEW>Accounting Voucher View</PERSISTEDVIEW>"      
                + "<ALLLEDGERENTRIES.LIST>"
                + "<LEDGERNAME>Mahes</LEDGERNAME>"
                + "<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>"
                + "<AMOUNT>0</AMOUNT>"       
                + "</ALLLEDGERENTRIES.LIST>"
                + "<ALLLEDGERENTRIES.LIST>"      
                + "<LEDGERNAME>Cash</LEDGERNAME>"
                + "<ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>"
                + "<AMOUNT>-150000.00</AMOUNT>"          
                + "</ALLLEDGERENTRIES.LIST>"    
                + "</VOUCHER>"
                + "</TALLYMESSAGE>"
                + "</REQUESTDATA>"
                + "</IMPORTDATA>"
                + "</BODY>"
                + "</ENVELOPE>";
        return TXML;
    }

    public void SendToTally() throws Exception {
        String Url = "http://127.0.0.1:9000/";

        String SOAPAction = "";

        String Voucher = this.CreateRequest();

        // Create the connection where we're going to send the file.
        URL url = new URL(Url);
        URLConnection connection = url.openConnection();
        HttpURLConnection httpConn = (HttpURLConnection) connection;

        ByteArrayInputStream bin = new ByteArrayInputStream(Voucher.getBytes());
        ByteArrayOutputStream bout = new ByteArrayOutputStream();

        // Copy the SOAP file to the open connection.

        copy(bin, bout);

        byte[] b = bout.toByteArray();

        // Set the appropriate HTTP parameters.
        httpConn.setRequestProperty("Content-Length", String.valueOf(b.length));
        httpConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
        httpConn.setRequestProperty("SOAPAction", SOAPAction);
        httpConn.setRequestMethod("POST");
        httpConn.setDoOutput(true);
        httpConn.setDoInput(true);

        // Everything's set up; send the XML that was read in to b.
        OutputStream out = httpConn.getOutputStream();
        out.write(b);
        out.close();

        // Read the response and write it to standard out.

        InputStreamReader isr = new InputStreamReader(httpConn.getInputStream());
        BufferedReader in = new BufferedReader(isr);

        String inputLine;

        while ((inputLine = in.readLine()) != null) {
            System.out.println(inputLine);
        }

        in.close();
    }

    public static void copy(InputStream in, OutputStream out)
            throws IOException {

        // do not allow other threads to read from the
        // input or write to the output while copying is
        // taking place

        synchronized (in) {
            synchronized (out) {

                byte[] buffer = new byte[256];
                while (true) {
                    int bytesRead = in.read(buffer);
                    if (bytesRead == -1) {
                        break;
                    }
                    out.write(buffer, 0, bytesRead);
                }
            }
        }
    }

    public static void main(String[] args) throws Exception {
        TallyRequest r = new TallyRequest();
        r.SendToTally();
    }
}

here this send the xml output as bellow

XML Message as below

<ENVELOPE>
    <HEADER>
        <TALLYREQUEST>Import Data</TALLYREQUEST>
    </HEADER>
        <BODY>
        <IMPORTDATA>
            <REQUESTDESC>
                <REPORTNAME>Vouchers</REPORTNAME>
                <STATICVARIABLES>
                    <SVCURRENTCOMPANY>Crane</SVCURRENTCOMPANY>
                </STATICVARIABLES>
            </REQUESTDESC>
            <REQUESTDATA>
                <TALLYMESSAGE xmlns:UDF="TallyUDF">
                    <VOUCHER REMOTEID="00000001" VCHTYPE="Receipt" ACTION="Create" OBJVIEW="Accounting Voucher View">
                        <DATE>20160701</DATE>
                        <VOUCHERTYPENAME>Receipt</VOUCHERTYPENAME>
                        <VOUCHERNUMBER>3</VOUCHERNUMBER>
                        <PARTYLEDGERNAME>Cash</PARTYLEDGERNAME>
                        <PERSISTEDVIEW>Accounting Voucher View</PERSISTEDVIEW>
                        <ALLLEDGERENTRIES.LIST>
                            <LEDGERNAME>Mahes</LEDGERNAME>
                            <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
                            <AMOUNT>0</AMOUNT>
                        </ALLLEDGERENTRIES.LIST>
                        <ALLLEDGERENTRIES.LIST>
                            <LEDGERNAME>Cash</LEDGERNAME>
                            <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
                            <AMOUNT>-150000.00</AMOUNT>
                        </ALLLEDGERENTRIES.LIST>
                    </VOUCHER>
                </TALLYMESSAGE>
            </REQUESTDATA>
        </IMPORTDATA>
    </BODY>
</ENVELOPE>

the above code will indicate the ledger and the bill passed from java to tally for the company name, when XML message is be passed to tally make sure that tally is having the same arguments which is passed or modify where ever necessary otherwise message will not pass and you will get a error which can be seen in java Console as well as in tally.imp file on Tally.ERP9 root folder. For doubt regarding the tally XML message structure from your tally just fetch the backup of the Ledger or any other which ever you need to send data to get the format.. or refer the links which was useful for me to send a correct format of XML.

Full reference to Tally and Java integration based on SOAP

Architecture Reference

For further quires pleased do comment elaborating your needs so that I will try to help you!

Remove the remote ID in the voucher TAG and the ID in the GUID tag. Keep the tags, though and see if the voucher is created in the response.

You are probably using the educational version of Tally.

Tally hasn't handled the XML error response for Date not being accessible in Tally - this happens only in the educational version where only the 1st, 2nd and end of month are available to work on.

Try changing the date to 20160401 (you could also play around with the date format-year first, month first or day first).

the one and the only reason for this error is the coding data.

Just remove or delete the data from inverted comma in this 2 lines -

<VOUCHER REMOTEID="face3a8f-f920-4781-a14b-ed095d0b0145-00000006" 
 VCHKEY="face3a8f-f920-4781-a14b-ed095d0b0145-0000a748:000000061"

and in this line too

<GUID>face3a8f-f920-4781-a14b-ed095d0b0145-00000006</GUID>

remove only

" face3a8f-f920-4781-a14b-ed095d0b0145-00000006 "

and problem solved. :D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM