eConnect - GLTransactionType, taGLTransactionHeaderInsert, taGLTransactionLineInsert

This short code example shows how to code a GL Transaction in eConnect.

We show GLTransactionType, taGLTransactionHeaderInsert, taGLTransactionLineInsert

Related Articles

... and you 'll find more on the eConnect Menu

Imports Microsoft.Dynamics.GP.eConnect.Serialization
Imports Microsoft.Dynamics.GP.eConnect
 
Public Class GLTransactionType
    Sub GLTransactionType()
        Try
            Dim strReturnDoc As String
 
            'declare our eConnect classes
            Dim strSQLServer As String = System.Configuration.ConfigurationManager.AppSettings("SQLServer")
            Dim strDabase As String = System.Configuration.ConfigurationManager.AppSettings("Database")
 
            Dim oeConnectType As New Microsoft.Dynamics.GP.eConnect.Serialization.eConnectType
            Dim oGLTransactionType As New Microsoft.Dynamics.GP.eConnect.Serialization.GLTransactionType
            'this is our eConnect common functions class, you can find it here: http://dyndeveloper.com/thread.aspx?Threadid=1117
            Dim oeConnectFunctions As New eConnect11Lib.GP11.eConnectFunctions(strSQLServer, strDabase)
 
            '============================================================================
            'create the document details
            '============================================================================
            Dim intCurrentLine As Int16 = 0
 
            For a As Int16 = 0 To 0 'simulate a loop
                'declare an object for the detail line
                Dim otaGLTransactionLineInsert As New Microsoft.Dynamics.GP.eConnect.Serialization.taGLTransactionLineInsert_ItemsTaGLTransactionLineInsert
 
                'populate the detail line
                With otaGLTransactionLineInsert
                    .BACHNUMB = "MYBATCH"
                    .CRDTAMNT = 0
                    .DEBITAMT = 100
                    .ACTNUMST = "00-0000"
                    .DSCRIPTN = "description"
                    ReDim Preserve oGLTransactionType.taGLTransactionLineInsert_Items(intCurrentLine)
                    oGLTransactionType.taGLTransactionLineInsert_Items(intCurrentLine) = otaGLTransactionLineInsert
                End With
                intCurrentLine += 1
            Next
 
            '============================================================================
            'create the document header
            '============================================================================
            Dim otaGLTransactionHeaderInsert As New Microsoft.Dynamics.GP.eConnect.Serialization.taGLTransactionHeaderInsert
 
            'populate the header data
            'only the minimum fields are required
            With otaGLTransactionHeaderInsert
                .BACHNUMB = "MYBATCH"
                .TRXDATE = "5/23/2017"
                .REFRENCE = "reference"
                .TRXTYPE = 0
            End With
 
            'assign the header to the master
            oGLTransactionType.taGLTransactionHeaderInsert = otaGLTransactionHeaderInsert
 
 
            ReDim Preserve oeConnectType.GLTransactionType(0)
            oeConnectType.GLTransactionType(0) = oGLTransactionType
            'this is our eConnect common functions class, you can find it here: http://dyndeveloper.com/thread.aspx?Threadid=1117
            strReturnDoc = oeConnectFunctions.CreateTransactionEntity(oeConnectType)
 
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
 
    End Sub
 
End Class

RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences