<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>DATA</TYPE>
<ID>CA_VOUCHER</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:xml</SVEXPORTFORMAT>
<SVCURRENTCOMPANY>Company Name</SVCURRENTCOMPANY>
<SVFROMDATE TYPE="Date">07-03-2023</SVFROMDATE>
<SVTODATE TYPE="Date">07-03-2023</SVTODATE>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<REPORT ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_VOUCHER">
<FORM>CA_VOUCHER</FORM>
</REPORT>
<FORM ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHER">
<PART>CA_VOUCHER</PART>
<XMLTAG>VOUCHERS</XMLTAG>
</FORM>
<PART ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHER">
<LINE>CA_VOUCHER</LINE>
<REPEAT>CA_VOUCHER:CA_VOUCHERCOLLECTION</REPEAT>
<SCROLLED>Vertical</SCROLLED>
</PART>
<PART ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHERLEDGER">
<LINE>CA_VOUCHERLEDGER</LINE>
<REPEAT>CA_VOUCHERLEDGER:ALLLEDGERENTRIES</REPEAT>
<SCROLLED>Vertical</SCROLLED>
</PART>
<PART ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHERLEDGERINVENTORY">
<LINE>CA_VOUCHERLEDGERINVENTORY</LINE>
<REPEAT>CA_VOUCHERLEDGERINVENTORY:INVENTORYALLOCATIONS</REPEAT>
<SCROLLED>Vertical</SCROLLED>
</PART>
<LINE ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHER">
<FIELDS>
CA_DATE,CA_VOUCHERTYPENAME,CA_VOUCHERNUMBER</FIELDS>
<XMLTAG>VOUCHER</XMLTAG>
<EXPLODE>CA_VOUCHERLEDGER:Yes</EXPLODE>
</LINE>
<LINE ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHERLEDGER">
<FIELDS>CA_LEDGERNAME</FIELDS>
<XMLTAG>ENTRY</XMLTAG>
<EXPLODE>CA_VOUCHERLEDGERINVENTORY:Yes</EXPLODE>
</LINE>
<LINE ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHERLEDGERINVENTORY">
<FIELDS>CA_STOCKITEMNAME,CA_ACTUALQTY,CA_RATE</FIELDS>
<XMLTAG>STOCKITEM</XMLTAG>
</LINE>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_DATE">
<TYPE>Date</TYPE>
<SET>$Date</SET>
<XMLTAG>DATE</XMLTAG>
</FIELD>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_VOUCHERTYPENAME">
<SET>$VOUCHERTYPENAME</SET>
<XMLTAG>VOUCHERTYPE</XMLTAG>
</FIELD>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_VOUCHERNUMBER">
<SET>$VoucherNumber</SET>
<XMLTAG>VOUCHERNUMBER</XMLTAG>
</FIELD>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_LEDGERNAME">
<SET>$LEDGERNAME</SET>
<XMLTAG>LEDGER</XMLTAG>
</FIELD>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_STOCKITEMNAME">
<SET>$STOCKITEMNAME</SET>
<XMLTAG>NAME</XMLTAG>
</FIELD>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_ACTUALQTY">
<TYPE>Quantity</TYPE>
<SET>$ACTUALQTY</SET>
<XMLTAG>QUANTITY</XMLTAG>
</FIELD>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_RATE">
<TYPE>Rate</TYPE>
<SET>$RATE</SET>
<XMLTAG>RATE</XMLTAG>
</FIELD>
<COLLECTION ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_VOUCHERCOLLECTION">
<TYPE> Vouchers : VoucherType</TYPE>
<CHILDOF>$$VchTypeSales</CHILDOF>
<BELONGSTO>Yes</BELONGSTO>
<NATIVEMETHOD>*</NATIVEMETHOD>
<NATIVEMETHOD>ALLLEDGERENTRIES.LIST</NATIVEMETHOD>
</COLLECTION>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
Abode code is working fine but neither I need any ledger name nor I need my inventory items enclosed in Entry element (ALLLEDGERENTRIES). When I send request with following XML body it throw fatal error and closed tally.
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>DATA</TYPE>
<ID>CA_VOUCHER</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVEXPORTFORMAT>$$SysName:xml</SVEXPORTFORMAT>
<SVCURRENTCOMPANY>Company Name</SVCURRENTCOMPANY>
<SVFROMDATE TYPE="Date">07-03-2023</SVFROMDATE>
<SVTODATE TYPE="Date">07-03-2023</SVTODATE>
</STATICVARIABLES>
<TDL>
<TDLMESSAGE>
<REPORT ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_VOUCHER">
<FORM>CA_VOUCHER</FORM>
</REPORT>
<FORM ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHER">
<PART>CA_VOUCHER</PART>
<XMLTAG>VOUCHERS</XMLTAG>
</FORM>
<PART ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHER">
<LINE>CA_VOUCHER</LINE>
<REPEAT>CA_VOUCHER:CA_VOUCHERCOLLECTION</REPEAT>
<SCROLLED>Vertical</SCROLLED>
</PART>
<PART ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHERLEDGER">
<LINE>CA_VOUCHERLEDGER</LINE>
<REPEAT>CA_VOUCHERLEDGER:ALLLEDGERENTRIES</REPEAT>
<SCROLLED>Vertical</SCROLLED>
</PART>
<PART ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHERLEDGERINVENTORY">
<LINE>CA_VOUCHERLEDGERINVENTORY</LINE>
<REPEAT>CA_VOUCHERLEDGERINVENTORY:INVENTORYALLOCATIONS</REPEAT>
<SCROLLED>Vertical</SCROLLED>
</PART>
<LINE ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHER">
<FIELDS>
CA_DATE,CA_VOUCHERTYPENAME,CA_VOUCHERNUMBER</FIELDS>
<XMLTAG>VOUCHER</XMLTAG>
<EXPLODE>CA_VOUCHERLEDGER:Yes</EXPLODE>
</LINE>
<LINE ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHERLEDGER">
<FIELDS></FIELDS>
<XMLTAG>ENTRY</XMLTAG>
<EXPLODE>CA_VOUCHERLEDGERINVENTORY:Yes</EXPLODE>
</LINE>
<LINE ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHERLEDGERINVENTORY">
<FIELDS>CA_STOCKITEMNAME,CA_ACTUALQTY,CA_RATE</FIELDS>
<XMLTAG>STOCKITEM</XMLTAG>
</LINE>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_DATE">
<TYPE>Date</TYPE>
<SET>$Date</SET>
<XMLTAG>DATE</XMLTAG>
</FIELD>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_VOUCHERTYPENAME">
<SET>$VOUCHERTYPENAME</SET>
<XMLTAG>VOUCHERTYPE</XMLTAG>
</FIELD>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_VOUCHERNUMBER">
<SET>$VoucherNumber</SET>
<XMLTAG>VOUCHERNUMBER</XMLTAG>
</FIELD>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_STOCKITEMNAME">
<SET>$STOCKITEMNAME</SET>
<XMLTAG>NAME</XMLTAG>
</FIELD>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_ACTUALQTY">
<TYPE>Quantity</TYPE>
<SET>$ACTUALQTY</SET>
<XMLTAG>QUANTITY</XMLTAG>
</FIELD>
<FIELD ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_RATE">
<TYPE>Rate</TYPE>
<SET>$RATE</SET>
<XMLTAG>RATE</XMLTAG>
</FIELD>
<COLLECTION ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO"
ISINTERNAL="NO" NAME="CA_VOUCHERCOLLECTION">
<TYPE> Vouchers : VoucherType</TYPE>
<CHILDOF>$$VchTypeSales</CHILDOF>
<BELONGSTO>Yes</BELONGSTO>
<NATIVEMETHOD>*</NATIVEMETHOD>
<NATIVEMETHOD>ALLLEDGERENTRIES.LIST</NATIVEMETHOD>
</COLLECTION>
</TDLMESSAGE>
</TDL>
</DESC>
</BODY>
</ENVELOPE>
I want to generate the following response with above mentioned xml request body.
<VOUCHERS>
<VOUCHER>
<DATE>1-Feb-23</DATE>
<VOUCHERTYPE>Sales</VOUCHERTYPE>
<VOUCHERNUMBER>1</VOUCHERNUMBER>
<STOCKITEM>
<NAME>Product Name</NAME>
<QUANTITY>1000 Pcs</QUANTITY>
<RATE>1.50/Pcs</RATE>
</STOCKITEM>
</VOUCHER>
*
*
*
</VOUCHERS>
Thank you.
In second xml CA_VOUCHERLEDGER line has no fields, so tally throws error instead change to
<LINE ISMODIFY="NO" ISFIXED="NO" ISINITIALIZE="NO" ISOPTION="NO" ISINTERNAL="NO"
NAME="CA_VOUCHERLEDGER">
<FIELDS>SimpleField</FIELDS>
<EXPLODE>CA_VOUCHERLEDGERINVENTORY:Yes</EXPLODE>
<LOCAL>Delete:FIELD:SimpleField</LOCAL>
</LINE>
you will get empty <SIMPLEFIELD></SIMPLEFIELD>
tags you can ignore while parsing