Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Journal Entry posting for user form

Hi,

I have create a screen like Goods Issue.How do i do Journal entry posting after a record added to the table.

Thanx in advance,

Mohana

Former Member
Former Member replied

Hope the below example helps u.

Private Function createJE(ByVal oDataTable As SAPbouiCOM.DataTable) As Boolean
        Dim oJe As SAPbobsCOM.JournalEntries
        Dim oGrpo As SAPbobsCOM.Documents
        Dim intTemp, intI, intCount, intNewCount, i As Integer
        Dim strCardcode, strSQL, strRltAcc, strAccNo, Str, strItemNo, strItemDesc, strTaxCode As String
        Dim dblRoyaltyQty, dblQty, dblLineTot As Double
        Dim strCardList As New ArrayList
        Dim strQty As New ArrayList
        Dim oCheckbox As SAPbouiCOM.CheckBoxColumn
        Dim RecRlt As SAPbobsCOM.Recordset
        Dim oBP As SAPbobsCOM.BusinessPartners
        Dim blFlag As Boolean
        Dim oEditBPCode, oEditItmCode, oEditRoyaltyAmt As SAPbouiCOM.EditTextColumn
        Dim vRs As SAPbobsCOM.Recordset
        Dim vBOB As SAPbobsCOM.SBObob
        Dim vCH As SAPbobsCOM.ChartOfAccounts
        Dim strAccCD As String
        Dim dtPostingdate, dtEnddate As DateTime
        Dim strBP As String
        Dim RecBP As SAPbobsCOM.Recordset
        Dim strSQLBP As String

        'eForm = objSBOAPI.LoadForm(System.Windows.Forms.Application.StartupPath & "\xml\fileImportDetails.xml", "DSS_fImportDetails")
        'intCount = 0
        'oBP = objSBOAPI.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)
        Try
            '    If (eForm.DataSources.DataTables.Count <= 0) Then
            '        If (eForm.DataSources.DataTables.Item(i).UniqueID <> "DT_0") Then
            '            oDtTable = aForm.DataSources.DataTables.Add("DT_0")
            '            oDtTable.Columns.Add("BPCode", SAPbouiCOM.BoFieldsType.ft_AlphaNumeric)
            '            oDtTable.Columns.Add("DocNo", SAPbouiCOM.BoFieldsType.ft_AlphaNumeric)
            '        End If
            '    Else
            '        For intx As Integer = 0 To eForm.DataSources.DataTables.Count - 1
            '            If (eForm.DataSources.DataTables.Item(intx).UniqueID = "DT_0") Or (eForm.DataSources.DataTables.Item(intx).UniqueID = "Tempdt") Then
            '                oDtTable = eForm.DataSources.DataTables.Item(intx)
            '                blFlag = True
            '                Exit For
            '            End If
            '            blFlag = False
            '        Next
            '    End If

            '    If blFlag = True Then
            '        oDtTable = eForm.DataSources.DataTables.Add("Tempdt")
            '        oDtTable.Columns.Add("BPCode", SAPbouiCOM.BoFieldsType.ft_AlphaNumeric)
            '        oDtTable.Columns.Add("DocNo", SAPbouiCOM.BoFieldsType.ft_AlphaNumeric)
            '    End If
            intNewCount = 0
            dblRoyaltyQty = 0

            For intTemp = 1 To oDataTable.Rows.Count - 1
                If (oDataTable.GetValue("0", intTemp) <> "") Then
                    strCardcode = oDataTable.GetValue(0, intTemp)
                    dtPostingdate = Convert.ToDateTime(oDataTable.GetValue(2, intTemp))
                    If Not strCardList.Contains(strCardcode) Then
                        strCardcode = oDataTable.GetValue(0, intTemp)
                        intCount = 0
                        oJe = objSBOAPI.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)
                        oJe.DueDate = dtPostingdate
                        oJe.TaxDate = dtPostingdate

                        oJe.Lines.AccountCode = "_SYS00000000005"

                        oJe.Lines.ContraAccount = "_SYS00000000005"
                        oJe.Lines.Credit = 0
                        oJe.Lines.Debit = 150
                        oJe.Lines.DueDate = dtPostingdate
                        oJe.Lines.ReferenceDate1 = Now
                        oJe.Lines.ShortName = "_SYS00000000005"
                        oJe.Lines.TaxDate = dtPostingdate
                        Call oJe.Lines.Add()
                        Call oJe.Lines.SetCurrentLine(1)
                        oJe.Lines.AccountCode = "_SYS00000000005"
                        oJe.Lines.ContraAccount = "_SYS00000000005"
                        oJe.Lines.Credit = 150
                        oJe.Lines.Debit = 0
                        oJe.Lines.DueDate = dtPostingdate 'CDate("11/13/ 2002")
                        'oJe.Lines.Line_ID = 1
                        oJe.Lines.ReferenceDate1 = Now
                        oJe.Lines.ShortName = "_SYS00000000005"
                        'oJe.Lines.TaxDate = Now
                        If (oJe.Add() <> 0) Then
                            objUtility.ShowMessage(objSBOAPI.oCompany.GetLastErrorDescription)
                            Return False
                        Else
                            objUtility.ShowSuccessMessage("Journal Entry Created Successfully")
                        End If

                    End If
                End If
            Next
            'For intArLstCnt As Integer = 0 To strCardList.Count - 1
            '    strBP = strCardList.Item(intArLstCnt)
            'Next
            'strCardList.Clear()
            Return True
        Catch ex As Exception
            objUtility.ShowErrorMessage(ex.Message)
            Return False
        End Try
    End Function

Vasu Natari.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question