General Journal Upload using .NET Business Connector

Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
edited 2008-10-27 in Dynamics AX
Hi,
I am learning AX. The version is 4.0

I created a VB.NET app to pass General Journal line entries using .NET Business Connector.
The process consist of two parts :
1) Upload General Journal
2) Upload General Journal Lines.

first part i.e creating a general Journal (header/batch), using .NET Business Connector is working fine.
The problem is with 2nd part i.e. inserting lines.
The error I am getting is :

"Error executing code : NumberSeqFormHandlerLedgerJournal Object not initialized."

my VB.NET code :
Public Sub CreateJournal()
        Try
            Dim AX As New Axapta
            Dim JnlLine As AxaptaObject
            Dim numberSeqFormHandlerLedgerJournal As AxaptaObject
            Dim LedgerJournalTable As AxaptaObject        
            Dim LoopRow As Integer
            Dim CompanyName As String          



            AX.Logon("", "", "", "")
            AX.TTSBegin()
            DataGridView1.ReadOnly = True
            LedgerJournalTable = AX.CreateAxaptaObject("AxLedgerJournalTable")
            
             numberSeqFormHandlerLedgerJournal = AX.CreateAxaptaObject("numberSeqFormHandlerLedgerJournal")

            LedgerJournalTable.Call("parmJournalName", Me.TxtJournalName.Text.ToString())
            LedgerJournalTable.Call("parmJournalNum", Me.TxtJournalNumber.Text.ToString())
            LedgerJournalTable.Call("parmVoucherSeries", Me.TxtVoucherSeries.Text.ToString())
            LedgerJournalTable.Call("save")
// till here it works fine, i.e. ....able to insert in  LedgerJournalTable. 






         // Just to test, inserting just one line and hard coded values 
            JnlLine = AX.CreateAxaptaObject("AXLedgerJournalTrans")
            JnlLine.Call("parmJournalNum", "San1")
            JnlLine.Call("parmLineNum", 1)
            JnlLine.Call("parmAccountType", 1)
            JnlLine.Call("parmAccountNum", "605500")
            JnlLine.Call("parmAmountCurDebit", 800)
            JnlLine.Call("parmCurrencyCode", "USD")
            JnlLine.Call("parmVoucher", "V_0001")
            JnlLine.Call("parmAmountCurCredit", 0)
            JnlLine.Call("parmOffsetAccount", 131100)
            JnlLine.Call("parmOffsetAccountType", 1)
            JnlLine.Call("parmTransDate", Today())
            JnlLine.Call("parmCompany", "dmo")
            JnlLine.Call("parmOffsetCompany", "dmo")
                                 
            JnlLine.Call("Save")

            DataGridView1.Rows.Clear()
            AX.TTSCommit()
            AX.Logoff()

            MessageBox.Show(" Uploaded....!! ")
        Catch ex As Exception
            MsgBox(ex.Message)  // here I get the exception msg triggered after  "JnlLine.Call("Save")"  Error executing code : NumberSeqFormHandlerLedgerJournal Object not initialized
        End Try



    End Sub

Please help...
thanks in advance.
Sandeep Prajapati
Technical Consultant, MS Dynamics NAV

Comments

Sign In or Register to comment.