Tally ERP 9 to SQL Server

20
DX-Fusion - Tally to database /MQSQL/EXCEL/XML DX-Fusion (Free Edition) is an utility that transfers data from Tally ERP 9 into your database. It transfers all masters and all vouchers without any restriction on date or voucher-type or number of records. You can get more details about DX-fusion at http://www.rtslink.com/dx-fusion/index.html The DX-fusion (Commercial Editions) supports transfer of all masters and vouchers from Tally into your database in Real-time (online mode). Tally ERP 9 to SQL Server Preface This document is for Software developers who wish to get data from Tally ERP 9 into their database using VB6, VB.NET, C# or any other programming language. The sample program provided underneath is written in VB6. It uses the free utility DX-Fusion to get the Tally ERP 9 data into SQL Server. However, with some minor modifications (i.e. connection string) you can get the data in any other database. Getting data from Tally ERP 9 into SQL Server using VB / VB.NET / C# / PHP etc It is presumed that you have already downloaded and installed the DX-Fusion Free Edition utility. Steps :- 1) Create a new database named 'Tally' in SQL Server. 2) Specify proper connection string in 'c:\wamp\www\dx-fusion\dx-fusion.ini file' to connect to your SQL Server database. 3) Start Tally ERP 9 and open your Company which contains some data. 4) Create a program in VB6 (or any other programming language of your choice). 5) Place a button on the Form / Window. 6) In the button click event, use HTTP Post to send a post-xml-request to the DX-Fusion Server at http://127.0.0.1:90/dx-fusion/upload.php 6a) XML request to be sent to DX-Fusion Server (for Masters): <!-- This is the request format which must be sent to the DX-FUSION server --> <!-- You must specify proper values for tags given below --> <ENVELOPE>

Transcript of Tally ERP 9 to SQL Server

Page 1: Tally ERP 9 to SQL Server

DX-Fusion - Tally to database /MQSQL/EXCEL/XML

DX-Fusion (Free Edition) is an utility that transfers data from Tally ERP 9 into your database. It transfers all masters and all vouchers without any restriction on date or voucher-type or number of records.

You can get more details about DX-fusion at http://www.rtslink.com/dx-fusion/index.html

The DX-fusion (Commercial Editions) supports transfer of all masters and vouchers from Tally into your database in Real-time (online mode).

Tally ERP 9 to SQL Server

Preface

This document is for Software developers who wish to get data from Tally ERP 9 into their database using VB6, VB.NET, C# or any other programming language.

The sample program provided underneath is written in VB6. It uses the free utility DX-Fusion to get the Tally ERP 9 data into SQL Server. However, with some minor modifications (i.e. connection string) you can get the data in any other database. 

Getting data from Tally ERP 9 into SQL Server using VB / VB.NET / C# / PHP etc

It is presumed that you have already downloaded and installed the DX-Fusion Free Edition utility.

Steps :-

1) Create a new database named 'Tally' in SQL Server.2) Specify proper connection string in 'c:\wamp\www\dx-fusion\dx-fusion.ini file' to connect to your SQL Server database.3) Start Tally ERP 9 and open your Company which contains some data.4) Create a program in VB6 (or any other programming language of your choice). 5) Place a button on the Form / Window.6) In the button click event, use HTTP Post to send a post-xml-request to the DX-Fusion Server     at http://127.0.0.1:90/dx-fusion/upload.php

6a) XML request to be sent to DX-Fusion Server (for Masters):

<!-- This is the request format which must be sent to the DX-FUSION server --><!-- You must specify proper values for tags given below -->

<ENVELOPE> <HEADER> <TALLYREQUEST>Export Data</TALLYREQUEST> </HEADER> <BODY> <EXPORTDATA> <REQUESTDESC> <STATICVARIABLES>

<!-- Specify the MASTER Type here --> <RTS_SVMASTERTYPE>GROUP</RTS_SVMASTERTYPE>

Page 2: Tally ERP 9 to SQL Server

<!-- Specify the MASTER Name here --> <RTS_SVMASTERNAME>Fixed Assets</RTS_SVMASTERNAME>

<!-- Specify the ACTION here --> <RTS_SVACTIONTYPE>CREATE</RTS_SVACTIONTYPE>

<!-- Must be set to Yes always --> <REDIRECTREQUESTTOTALLY>YES</REDIRECTREQUESTTOTALLY>

<!-- If the Tally Server and DX-Fusion Server are on the same machine --> <!-- then keep 127.0.0.1 else specify the IP address for Tally Server --> <TALLYSERVERIP>127.0.0.1</TALLYSERVERIP> <TALLYSERVERPORT>9000</TALLYSERVERPORT> </STATICVARIABLES> <REPORTNAME>RTSExportData</REPORTNAME> </REQUESTDESC> </EXPORTDATA> </BODY></ENVELOPE>

6b) XML request to be sent to DX-Fusion Server (for Vouchers):

<!-- This is the request format which must be sent to the DX-FUSION server --><!-- You must specify proper values for tags given below -->

<ENVELOPE> <HEADER> <TALLYREQUEST>Export Data</TALLYREQUEST> </HEADER> <BODY> <EXPORTDATA> <REQUESTDESC> <STATICVARIABLES>

<!-- Record-type --> <RTS_SVMASTERTYPE>VOUCHER</RTS_SVMASTERTYPE>

<!-- Specify the MASTERID here --> <RTS_SVMASTERID>1</RTS_SVMASTERID>

<!-- Specify the ACTION here --> <RTS_SVACTIONTYPE>CREATE</RTS_SVACTIONTYPE>

<!-- Must be set to Yes always --> <REDIRECTREQUESTTOTALLY>YES</REDIRECTREQUESTTOTALLY> <RTS_SVMULTIPLERECORDS>No</RTS_SVMULTIPLERECORDS>

<!-- If the Tally Server and DX-Fusion Server are on the same machine --> <!-- then keep 127.0.0.1 else specify the IP address for Tally Server --> <TALLYSERVERIP>127.0.0.1</TALLYSERVERIP> <TALLYSERVERPORT>9000</TALLYSERVERPORT>

Page 3: Tally ERP 9 to SQL Server

</STATICVARIABLES> <REPORTNAME>RTSExportData</REPORTNAME> </REQUESTDESC> </EXPORTDATA> </BODY></ENVELOPE>

DX- Fusion

Product    : DX-FusionPlatform   : Windows 2000 and aboveTally         : Tally ERP 9 Release 1.61 and aboveCategory : Utility to transfer data from Tally Software into RDBMS (database) in real-time.

An Introduction to DX-Fusion

DX-Fusion is an utility that transfers data from Tally Accounting Software into your database in real-time. It supports MS-SQL Server, MS-Access, MySQL, Oracle and many other popular databases.

DX-Fusion works with Tally ERP 9 Release 1.61 and higher versions. It can retrieve data from Tally in both online (real-time) and off-line modes.

DX-Fusion utility does NOT require any coding (except for a connection-string to connect to the database) and can be used by developers and end-users both. Developers can use this data for designing of MIS reports and Integration with other external softwares.

DX-Fusion Editions

Free EditionA fully functional edition of DX-Fusion utility which supports transfer of all masters and vouchers data from Tally Sofware into your database without any restriction on number of entries or any date restriction. It supports off-line mode only.

Standard EditionA software utility for transferring masters and vouchers data from Tally Accounting Software into your database in Real-time (online mode).

DownloadDX-Fusion (Free Edition)

Getting StartedDX-Fusion - Getting Started

FAQsFrequently Asked Questions

Tally ERP 9 to SQL ServerGetting data from Tally ERP 9 into SQL Server

EditionsFREE Edition Vs Standard Edition

Bloghttp://dx-fusion.blogspot.com

Page 4: Tally ERP 9 to SQL Server

Tally Customization with Text File

- No need of Tally Developer 2.7 to compile the files- You can use plain TXT files rather than the TCP files for  Tally Customization

In simple words, you can create plain TXT files (using any editor like Notepad) and customize Tally Accounting Software. It works with Tally 7.2 and Tally 9. It even works with the educational version of Tally. Other users may try it own their own.

And now here's what you need to do.

STEPS:-

1) Create a TXT file using Notepad with the following TEXT.

[#Menu: Gateway of Tally]  Item: My Option : Menu : MySubMenu

[Menu: MySubMenu]  Item: MyOption1  Item: MyOption2  Item: MyOption2

2) Save the file as TEST1.TXT in your Tally folder (C:\TALLY)

3) Open the file Tally.ini using Notepad which is located in the Tally folder and make the following changes:-

User TDL = YesTDL = C:\TALLY\TEST1.TXT

4) Save the Tally.ini file and then run the Tally Software.5) A new menu-option will appear in the "Gateway of Tally" screen at the end.

To learn more about TDL programming, visit tdlplayground

Page 5: Tally ERP 9 to SQL Server

TDL Functions

An Alphabetical-list of TDL functions  (Partial list) is provided herewith  for your reference. 

Function Syntax Return Value Remarks

$$Abs $$Abs : <Expression> Same as parameter type

Returns the absolute (positive) value for the given expression

$$Alias $$Alias String

$$Alias returns alternate value for the current Object. Stock Item and Ledger have Alias name. Example:-Fetch Ledger-Alias using SQLRequest()

$$Allow $$Allow : <mode> : <family-report-name> Logical

Checks whether the current user has permission to access the specified object or report.

$$CollectionList$$CollectionList: <Method/Field> :<PositionNumber> : <Collection>

Method/ FieldDatatype

$$CollectionList function is used to fetch the nth Method/field of a Collection.Sample program using $$CollectionList function

$$DateFrom $$DateFrom Date Returns the Period starting date

$$DateTo $$DateTo Date Returns the Period ending date

$$FullList $$FullList : <Collection> : <FieldList>

Method/ FieldDatatype

$$FullList function is used to fetch any Method/Field of a Collection. The Method/Field values are separated by commas.

$$InPrintMode $$InPrintMode LogicalReturns true if the selected mode is Print, otherwise false. Refer program TDL42

$$IsContra $$IsContra : <VoucherTypeName> Logical Checks whether the specified VoucherType is

Contra

$$IsCreditNote $$IsCreditNote : <VoucherTypeName> Logical Checks whether the specified VoucherType is

CreditNote

$$IsDebitNote $$IsDebitNote : <VoucherTypeName> Logical Checks whether the specified VoucherType is

DebitNote

$$IsDelNote $$IsDelNote : <VoucherTypeName> Logical Checks whether the specified VoucherType is

Delivery Note

$$IsEmpty $$IsEmpty: <parameter> Logical

Checks whether the parameter passed is empty or not. Parameter type can be String; Numeric; Date; Logical

Example:-$$IsEmpty:  $$Value

Refer program TDL34

$$IsFirstObject $$IsFirstObject Logical Returns true if the current Object is the 1st object of the Collection. Refer program TDL42

$$IsJournal $$IsJournal : <VoucherTypeName> Logical Checks whether the specified VoucherType is

Journal

$$IsMemo $$IsMemo : <VoucherTypeName> Logical Checks whether the specified VoucherType is

Memo

$$IsPayment $$IsPayment : <VoucherTypeName> Logical Checks whether the specified VoucherType is

Payment Voucher

$$IsPhyStock $$IsPhyStock : <VoucherTypeName> Logical Checks whether the specified VoucherType is

PhysicalStock Voucher

$$IsPurchase $$IsPurchase : <VoucherTypeName> Logical Checks whether the specified VoucherType is

Purchase Voucher

$$IsPurcOrder $$IsPurcOrder : <VoucherTypeName> Logical Checks whether the specified VoucherType is

Purchase Order Voucher

$$IsRcptNote $$IsRcptNote : <VoucherTypeName> Logical Checks whether the specified VoucherType is

ReceiptNote Voucher

$$IsReceipt $$IsReceipt : Logical Checks whether the specified VoucherType is

Page 6: Tally ERP 9 to SQL Server

<VoucherTypeName> Receipt Voucher

$$IsRejIn $$IsRejIn : <VoucherTypeName> Logical Checks whether the specified VoucherType is RejectionIn Voucher

$$IsRejOut $$IsRejOut : <VoucherTypeName> Logical Checks whether the specified VoucherType is

RejectionOut Voucher

$$IsRevJrnl $$IsRevJrnl : <VoucherTypeName> Logical Checks whether the specified VoucherType is

Reverse Journal Voucher

$$IsSales $$IsSales : <VoucherTypeName> Logical Checks whether the specified VoucherType is Sales Voucher

$$IsSalesOrder $$IsSalesOrder : <VoucherTypeName> Logical Checks whether the specified VoucherType is

Sales Order Voucher

$$IsStockJournal $$IsStockJournal : <VoucherTypeName> Logical Checks whether the specified VoucherType is

StockJournal Voucher

Function Syntax Return Value Remarks

$$LocaleString $$LocaleString: <string> Unicode stringAccepts a string parameter and returns unicode string. This is to provide multi-lingual support to Tally

$$IsVchTypeOf Family

$$IsVchTypeOfFamily :<VoucherTypeName>

Logical

Checks whether the Field value of the <Field> is equal to the <ExpC>

Example:$$IsVchTypeOfFamily: $VoucherTypeName : "Payment"

Remarks: The function $$IsVchTypeOfFamily returns true if the Field-value of $VoucherTypeName is "Payment"

$$MachineDate $$MachineDate Date

Returns the Date as per your computer system settings

Example:-Select $$MachineDate from Company

$$MachineTime $$MachineTime String

Returns the Time as per your computer system settings

Example:-Select $$MachineTime from Company

$$Max $$Max : <Expression> Same as parameter type

Returns the Miniimum value.  The parameter type can be Numeric, Date or StringExample:-$$Max:100:15  returns 100

$$Min $$Min : <Expression> Same as parameter type

Returns the Miniimum value.  The parameter type can be Numeric, Date or StringExample:-$$Min:100:15  returns 15

$$MonthEnd $$MonthEnd: <ExpD> Date

Returns the ending date of the specified month.

Example:-Select $$MonthEnd:$$MachineDate from Company

$$MonthOfDate $$MonthOfDate:<ExpD> Numeric

Returns the Month (example 12) of the specified date

Example:-Select $$MonthOfDate:$$MachineDate from Company

$$MonthStart $$MonthStart: <ExpD> Date Returns the starting date of the specified month.

Page 7: Tally ERP 9 to SQL Server

Example:-Select $$MonthStart:$$MachineDate from Company

$$Round $$Round : <ExpN> : <RoundLimit> Numeric

$$Round function is used to round-off a valueExample:-$$Round : 125.72 : 0.10   returns 125.70  

$$RoundDown $$RoundDown : <ExpN> : <RoundLimit> Numeric

$$Round function is used to round-off a valueExample:-$$Round : 125.72 : 0.10   returns 125.70  

$$RoundUp $$RoundUp : <ExpN> : <RoundLimit> Numeric

$$Round function is used to round-off a valueExample:-$$Round : 125.72 : 0.10   returns 125.80  

$$SelectedCmps $$SelectedCmps NumericReturns the number of companies currently open in Tally Software. Refer Example at www.rtslink.blogspot.com

$$SerialNumber $$SerialNumber StringReturns the Tally Serial Number. Refer example atwww.rtslink.blogspot.com

$$String $$String: <ExpN> String

Converts numeric expression into string.Example:-[Field: My Field]  Set as : $$String:500

$$StringLength $$stringLength: <ExpC> Numeric

Returns the length of the string parameterExample:-[Field: My Field]  Set as: $$StringLength:"Shweta Softwares"

$$StringPart $$StringPart: <expC>: <StartPos>: <Length> String

Used to extract a sub-string from another string.Example:-[Field: My Field]  Set as: $$StringPart:"Shweta Softwares":7:9

Remarks:-This will return "Computers".i.e. beginning at the 8th character, it returns the next 9 characters. Please note that the 1st character is numbered as 0.

$$StringRemWord $$StringRemWord: <Index>: <ExpC> String

Returns the remaining word from the <ExpC> string after the Index.

Example:-$$StringRemWord:2:"Shweta Softwares Gandhidham"This returns the word "Gandhidham". i.e. the word after 2 words as specified by the Index

$$StringWord $$StringWord: <Index>: <ExpC> String

Returns the word specified by the Index.

Example:-$$StringWord:2:"Shweta Softwares Gandhidham"This returns the word "Computers". i.e. the 2nd word as specified by the Index

$$SysName $$SysName: <reserved-string> String Specifies the System-name for the reserved string

$$SystemPeriod From $$SystemPeriodFrom Date

Returns the value for the System variable SVFROMDATE

Example:-Select $$SystemPeriodFrom from CompanyorSelect ##SVFROMDATE from Company

$$SystemPeriodTo $$SystemPeriodTo Date Returns the value for the System variable SVTODATE

Page 8: Tally ERP 9 to SQL Server

Example:-Select $$SystemPeriodTo from CompanyorSelect ##SVTODATE from Company

$$Upper $$Upper: <ExpC> String Converts the string to upper-case

$$Value $$Value Method/Field data type

Returns the value of a field/method.

Example:-[Field: My Field]  Use: Name Field  Validate: NOT $$IsEmpty:$$Value

In the above code, function $$Value is used which returns the value of the field 'My Field'.Refer program TDL34

$$YearOfDate $$YearOfDate: <ExpD> Numeric

Returns the Year for the specified Date.

Example:-Select $$YearOfDate:$$MachineDate from Company

The above returns the year (.i.e 2007)

$$YearEnd $$YearEnd: <ExprD> Date

Returns the Year end-date for the Current year (based on the Date passed as parameter)

Example:-Select $$YearEnd:##SVTODATE from Company

The above returns the year-end date (ex. in my system it returns 31-3-2008).

$$ZeroFIll $$ZeroFill : <ExpC> : <ExpN> String$$Zero pads the given string with zeros.Example:-$$Zero : "525" : 5   returns  "00525"

You can test check the TDL functions by writing TDL code or by using WRAPPER.EXE provided with RTSlink DLL.

STEPS for using WRAPPER.EXE to try out the TDL functions:-1) Create a plain text file (say SQL1.TXT) using notepad which contains the following text:-     SELECT  $$Max:100:15  from Company

2) Save the file in C:\RTSlink folder.

3) Go to DOS prompt and change to C:\RTSlink folder.    (It is assumed that you have already downloaded and installed RTSlink DLL)

4) Type the following command:-    Wrapper  <FileName>   /SQL

5) This will generate response in a file named RESPONSE.LOG

Tags:

Page 9: Tally ERP 9 to SQL Server

Tally & Excel:

Cash Receipt Vouchers Here's a Excel sheet that contains "Cash Receipt Vouchers"

Sales Vouchers without Items

Here's a sample Excel sheet that contains Sales Vouchers (without Items). As this is the first exercise (for Vouchers), we have purposely taken up a simple Excel sheet.

Here's what the sample Excel sheet looks like.Column A - Invoice No

Column B - Invoice DateColumn C - Party NameColumn D - Sales Ledger

Column E - NarrationColumn F - Invoice Amount

XML tags for

Page 10: Tally ERP 9 to SQL Server

XML tags Explanation

1) First, you must write XML tags to create Masters (i.e. Party Ledgers and Sales Ledgers) . As you can see in the Excel sheet snapshot, the Column C contains Party Names whereas the Column D contains the

Sales Ledgers. The XML tags to create Ledger Masters look like this :-

<MASTER TYPE="LEDGER">...... tags......</MASTER>

Remarks:-a. Please refer the XML tags file for complete tags. You can also view it online by clicking on the link given

above.b. UDIMagic first processes the MASTER tags and then the VOUCHER tags.

2. You can get the Tally supported tags for Vouchers from Tally Software itself. All you need to do is to manually enter the sample data (only 1 voucher) as given in the Excel sheet into the Tally Software.

Next, export it in XML format using option "Gateway of Tally >> Display >> Daybook >> Alt+E". This will generate the tags in Daybook.xml file. You can open/view these tags in IE. In the Daybook.xml file, refer to the tags that appear within the <TALLYMESSAGE> tag and try relating the same with the tags as given

in the XML tags for this exercise.

Welcome to the world of VBA / Macros VBA or Visual Basic for Applications is a light weight programming language (quite similar to Visual Basic)

that allows automation of tasks in MS-Office Applications.

UDI Magic v3.0 or higher supports the use of VBA. Using VBA, you can sort data; perform calculations; insert or delete columns or rows in MS-Excel at run-time. In simple words, VBA allows you to do almost

any task that you can manually do in MS-Office Applications.

In this exercise, we shall take up "How to use VBA (Visual Basic for Applications) with UDI Magic ?"

STEP 1: Creating a macro file

To begin with, we shall write a simple macro that displays a message "Hello World". You can use Notepad (or any text-editor) to create macro files. Here's a simple macro file (Exercise-15-macro.txt)

which displays a message.

Sub HelloWorld

MsgBox "Hello World !!!"

Page 11: Tally ERP 9 to SQL Server

End Sub

Remarks:-Sub...End Sub is used to declare a procedure / routine.

Before we write XML tags for importing data from our Excel sheet into Tally, let's have a look at the UDI Magic supported XML tags for loading and executing macros.

XML tags for Loading / executing the Macro file

Syntax:-<VBA LOADFILE="macro-filename-with-path" RUNMACROATSTARTUP="macro-name"/>

Example 1:-<VBA LOADFILE="exercise-15-macro.txt" RUNMACROATSTARTUP="HelloWorld"/>

Example 2:-<VBA LOADFILE="c:\exercise-15-macro.txt" RUNMACROATSTARTUP="HelloWorld"/>

Explanation:-1) In the first example, we have not specified the full-path for the macro-file. Hence, UDIMagic searches for the macro-file in the UDI Magic startup folder. In the second exmple, we have specified the full-path

for the macro-file.2) The tag <VBA> is UDI Magic specific.

3) The attribute LOADFILE="macro-filename" is used to specify the macro-filename. 4) The attribute RUNMACROATSTARTUP is used to specify the macro name which is to be executed at

startup. 5) The Macro-file is executed before the Excel sheet data is processed. As a result,the macro used in this

exercise displays a message "Hello World".

STEP 2: Create an Excel Sheet and write XML tags for it

To make the task simple, we shall take up an Excel sheet with Stock Item Masters records (having only one field i.e. the NAME field).

For your reference, the XML tags given below:-

<XMLTAGS CELLREFERENCE="A1" xmlns:UDF="TallyUDF">

<!-- This loads and processes the macro-file --><VBA LOADFILE="exercise-15-macro.txt" RUNMACROATSTARTUP="HelloWorld"/>

Page 12: Tally ERP 9 to SQL Server

<!-- Create StockItem Masters --><MASTER TYPE="STOCKITEM">

<NAME.LIST><!-- Fetch the value for NAME tag from Column A of Excel Sheet -->

<NAME COLUMNREFERENCE="A"/></NAME.LIST>

</MASTER></XMLTAGS>

Import data into Multiple Companies simultaneously Here's an Excel sheet that contains Stock Item master records. The XML tags for this Excel sheet have

been written such that the data is imported into two companies simultaneously.

Follow these steps to import data into Tally1) Create a company named "Company A" in Tally.

2) Create another company named "Company B" in Tally.3) Next, Minimize Tally software.

Make sure that both the companies are open in Tally.4) Run UDI Magic software and select option "Excel to Tally".

5) Next, select option "Masters".6) Next, select the Excel sheet and the XML tags file.

You must select the XML tags file in the same screen in which you are prompted to select the Excel file.7) Follow the wizard instructions to import data into Tally.

Understanding the XML tags

The XML tags used in this exercise are quite simple. We have already written such tags (for Stock Item Master) in our previous exercises. Now, let's see how do we import data into multiple companies...

STEP 1Write XML tags to create STOCKGROUP masters

<!--This will create StockGroup Masters in Company A --><MASTER TYPE="STOCKGROUP" COMPANYNAME="Company A"/>

<NAME.LIST><!--Fetch StockGroup Name from Column B of the Excel Sheet-->

<NAME COLUMNREFERENCE="B"/><NAME.LIST>

Page 13: Tally ERP 9 to SQL Server

</MASTER>

<!--This will create StockGroup Masters in Company B --><MASTER TYPE="STOCKGROUP" COMPANYNAME="Company B"/>

<NAME.LIST><!--Fetch StockGroup Name from Column B of the Excel Sheet-->

<NAME COLUMNREFERENCE="B"/><NAME.LIST></MASTER>

Remarks:-1) Note that COMPANYNAME attribute is used to specify in which Company the data is to be imported.

2) We used the same tags twice, only the Company Name has been changed.

STEP 2Write XML tags to create STOCKITEM masters

<!-- Create STOCKITEM Masters in Company A-->< MASTER TYPE="STOCKITEM" COMPANYNAME="Company A">

<NAME.LIST><!-- Fetch the value for NAME tag from Column A of Excel Sheet -->

<NAME COLUMNREFERENCE="A"/></NAME.LIST>

<!-- StockGroup Name is to be taken from Column B--><PARENT COLUMNREFERENCE="B"/>

</MASTER>

<!-- Create STOCKITEM Masters in Company B-->< MASTER TYPE="STOCKITEM" COMPANYNAME="Company B">

<NAME.LIST><!-- Fetch the value for NAME tag from Column A of Excel Sheet -->

<NAME COLUMNREFERENCE="A"/></NAME.LIST>

<!-- StockGroup Name is to be taken from Column B--><PARENT COLUMNREFERENCE="B"/>

</MASTER>

Using the COMPANYNAME attribute

To import data into a specific Company in Tally, you need to use the COMPANYNAME attribute. Generally, this is required when two or more companies are open in Tally and you wish to import data

Page 14: Tally ERP 9 to SQL Server

into a specific company.

Herein, we shall take a simple Excel sheet that contains Stock Item Masters. For simplicity, we have taken only the Stock Item NAME in the Excel Sheet.

Follow these steps to import data into Tally1) Create two Companies in Tally. viz "Company A" and "Company B"

2) Select the "Company A".3) Minimize Tally software.

4) Run UDIMagic and follow instructions in the wizard to Import data from the sample Excel-sheet.You must select the XML tags file in the same screen in which you are prompted to select the Excel file.

If everything goes fine, then 5 Stock Item master records will be imported into "Company B" in Tally.You can view the same using "Gateway of Tally >> Inventory Info >> Stock Item >> Display" option.

Attribute : COMPANYNAMEApplies to: MASTER and VOUCHER tags

Example 1:-

<MASTER TYPE="LEDGER" COMPANYNAME="MyCompany">.....XML tags.....

</MASTER>

Example 2:-

<VOUCHER COMPANYNAME="MyCompany">.....XML tags.....</VOUCHER>

Remarks:-1) The COMPANYNAME attribute can be used with the MASTER and VOUCHER tags only.

2) If there two or more MASTER tags (or VOUCHER tags) in a single XML file, then you need to use the COMPANYNAME attribute with each MASTER tag.

Using the SCROLL attribute In this exercise, we shall take up an Excel sheet that contains Stock Item Master records with Standard Cost and Standard Price details. As the data for a single MASTER record may span to multiple rows, we

have used the SCROLL attribute which is described later on.

Page 15: Tally ERP 9 to SQL Server

Here's a snapshot of the Excel sheet that we shall be using in this exercise. You can create a similar sheet

STEP 1Write XML tags to create UNIT masters

<MASTER TYPE="UNIT"/><NAME COLUMNREFERENCE="D"/>

<ISSIMPLEUNIT>Yes</ISSIMPLEUNIT></MASTER>

STEP 2Write XML tags to create STOCKGROUP masters

<MASTER TYPE="STOCKGROUP"/><NAME.LIST>

<NAME COLUMNREFERENCE="C"/><NAME.LIST></MASTER>

STEP 3Write XML tags to create Stock Item Masters

<!-- Create STOCKITEM Masters -->< MASTER TYPE="STOCKITEM">

<NAME.LIST><!-- Fetch the value for NAME tag from Column A of Excel Sheet -->

<NAME COLUMNREFERENCE="A"/>

Page 16: Tally ERP 9 to SQL Server

<!-- ALIAS to be taken from Column B of Excel Sheet --><NAME COLUMNREFERENCE="B"/>

</NAME.LIST><!-- StockGroup Name is to be taken from Column C-->

<PARENT COLUMNREFERENCE="C"/><!-- BaseUnits is to be taken from Column D-->

<BASEUNITS COLUMNREFERENCE="D"/>

<!-- Standard Cost details --><STANDARDCOSTLIST.LIST SCROLL="Yes">

<DATE COLUMNREFERENCE="E"/><RATE FORMULA="=+F# &amp; &quot;/&quot; &amp; +G#"/>

</STANDARDCOSTLIST.LIST>

<!-- Standard Price details --><STANDARDPRICELIST.LIST SCROLL="Yes">

<DATE COLUMNREFERENCE="H"/><RATE FORMULA="=+I# &amp; &quot;/&quot; &amp; +J#"/>

</STANDARDPRICELIST.LIST>

</MASTER>

a) As you can see in the Excel sheet, the Standard Cost and Standard Price data for the first Master Record "BunnyBT1" spans to 3 rows. Also note that the Column A (key-field) contains the same Name i.e.

"BunnyBT1" as all these 3 rows are part of one MASTER record.

b) Example:-<STANDARDCOSTLIST.LIST SCROLL="Yes">

<DATE COLUMNREFERENCE="E"/><RATE FORMULA="=+F# &amp; &quot;/&quot; &amp; +G#"/>

</STANDARDCOSTLIST.LIST>

The SCROLL attribute used in the above XML tags, instructs UDI Magic that the data spans to multiple rows.

c) Use option "Alter Standard Rates" to specify the Standard Cost and Price details in the Stock Item Master as shown below:-

Page 17: Tally ERP 9 to SQL Server

Exercise 11 Alternative 1

Change the Heading in Cell A1 to NAME

Alternative 2

Add the following tags in your XML tags file :-

<COLUMNNAME.LIST><COLUMNNAME>NAME</COLUMNNAME>

</COLUMNNAME.LIST>

Remarks:-1) Tally use the Master's NAME as the key-field to uniquely identify the Master records. Hence, we must

have a Column titled as NAME or specify the same using <COLUMNNAME> tag.