cancel
Showing results for 
Search instead for 
Did you mean: 

how Cash amount will be posted to Journal ?

Former Member
0 Kudos

hi experts

how cash amount will be posted on journal entry..

please tell me

i have used user define form like i have cash amount 1200

i want to heat to journal entry

i dont have idea .... please tell me ..how to start it

explain me in details.

thanks in advance Animesh

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Dear Animesh Sinha,

You could use SDK DI JournalEntries object to add the Journal entry.

Best Regards

Jane Jing

SAP Business One Forums team

Former Member
0 Kudos

hi experts

i don't want to use SDK DI journal entry

how cash amount will be posted on journal entry on a particular

G/L account

please tell me

i have used user define form like i have a field cash amount

which value is 1200.

i want to insert 1200 on a particular G/l account

i want to heat to journal entry on a particular G/L account

i dont have idea .... please tell me ..how to start it

explain me in details.

thanks in advance

Former Member
0 Kudos

please see above....

hi experts

this is my code....... not working properly,,,,

is this correct.....

Private Sub diplay_journalform()
        Dim oForm As SAPbouiCOM.Form
        Try
            oForm = SBO_Application.Forms.Item("SM_DJR")
            SBO_Application.MessageBox("Form Already Open")
        Catch ex As Exception
            Dim fcp As SAPbouiCOM.FormCreationParams
            fcp = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
            fcp.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed
            fcp.FormType = "SM_DJR"
            fcp.ObjectType = "SM_JR"
            fcp.UniqueID = "SM_DJR"
            fcp.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable
            oForm = SBO_Application.Forms.AddEx(fcp)
            oForm.AutoManaged = False
            ''Function to see the list of Sales Orders.
            ''Function for Sales Territory.  
            DrawAddForm(oForm)           ''Function to Draw the form for 1st Sub Menu 
        End Try
        'oForm.DataBrowser.BrowseBy = "logval"
        oForm.Visible = True
    End Sub
    Public Sub DrawAddForm(ByVal oForm As SAPbouiCOM.Form)
        Dim oItem As SAPbouiCOM.Item
        Dim oButton As SAPbouiCOM.Button
        ''Form specifications
        oForm.Title = "JOURNAL ENTRY"
        oForm.Left = 335 '340
        oForm.ClientWidth = 550 '350
        oForm.Top = 55
        oForm.ClientHeight = 200 '500 
        'oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE
        ShowAllItems(oForm)
        '//************************
        '// Adding a OK button
        '//************************
        oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
        oItem.Left = 27
        oItem.Width = 65
        oItem.Top = 175 '300
        oItem.Height = 20
        oButton = oItem.Specific
        '//************************
        '// Adding a Cancel button
        '//***********************
        oItem = oForm.Items.Add("2", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
        oItem.Left = 101
        oItem.Width = 65
        oItem.Top = 176 '300
        oItem.Height = 20
        oButton = oItem.Specific
    End Sub
    Private Sub ShowAllItems(ByVal oForm)
        oDBDataSource = oForm.DataSources.DBDataSources.Add("@TESTJR")
        oItem = oForm.Items.Add("amtTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC)
        oItem.Left = 5
        oItem.Width = 100
        oItem.Top = 10
        ' oItem.AffectsFormMode = False
        oItem.LinkTo = "amtVal" '"Vndval"
        oStatic = oItem.Specific
        oStatic.Caption = "Cash amount"

        Dim oEditordr As SAPbouiCOM.EditText

        oItem = oForm.Items.Add("amtVal", SAPbouiCOM.BoFormItemTypes.it_EDIT)
        oItem.Left = 110
        oItem.Width = 160
        oItem.Top = 10
        oItem.LinkTo = "OrdrTxt"
        oItem.AffectsFormMode = True
        oEditordr = oItem.Specific
        '' Adding Choose From List
        oEditordr.DataBind.SetBound(True, "@TESTJR", "U_CASHAMT")
    End Sub
    Private Sub JournalEntry(ByVal accntcode1 As String, ByVal newaccnt As String, ByVal value As String)
        On Error GoTo ErrorHandler
        Dim nErr As Long
        Dim errMsg As String
        'add an Journal entry
        Dim vJE As SAPbobsCOM.JournalEntries
        vJE = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries) '(oJournalEntries)
        vJE.TaxDate = Now
        vJE.Lines.AccountCode = accntcode1 '"110000"
        vJE.Lines.ContraAccount = newaccnt '"10110"
        vJE.Lines.Credit = 0
        vJE.Lines.Debit = value '150
        vJE.Lines.DueDate = CDate(Now)
        vJE.Lines.ReferenceDate1 = Now
        vJE.Lines.ShortName = accntcode1  '"110000"
        vJE.Lines.TaxDate = Now
        Call vJE.Lines.Add()
        Call vJE.Lines.SetCurrentLine(1)
        vJE.Lines.AccountCode = newaccnt '"10110"
        vJE.Lines.ContraAccount = accntcode1 '"110000"
        vJE.Lines.Credit = value '150
        vJE.Lines.Debit = 0
        vJE.Lines.DueDate = CDate(Now) 'CDate("11/13/ 2002")
        'vJE.Lines.Line_ID = 1
        vJE.Lines.ReferenceDate1 = Now
        vJE.Lines.ShortName = newaccnt  '"10110"
        'vJE.Lines.TaxDate = Now
        If (0 <> vJE.Add()) Then
            MsgBox("failed to add a journal entry")
        Else
            'MsgBox("Succeeded in adding a journal entry")
            vJE.SaveXML("c:\temp\JournalEntries" + Str(vJE.JdtNum) + ".xml")
        End If

        'Check Error
        Call oCompany.GetLastError(nErr, errMsg)
        If (0 <> nErr) Then
            MsgBox("Found error:" + Str(nErr) + "," + errMsg)
        End If

        'disconnect the company object, and release resource
        'Call oCompany.Disconnect()
        'oCompany = Nothing
        Exit Sub
ErrorHandler:
        MsgBox("Exception:" + Err.Description)
    End Sub

    Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
        Dim oForm As SAPbouiCOM.Form
        oForm = SBO_Application.Forms.Item(FormUID)
        Select Case pVal.EventType
            Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
                If pVal.ItemUID = "1" And pVal.BeforeAction = True Then
                    If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
                    End If
                End If
            Case SAPbouiCOM.BoEventTypes.et_CLICK
                If pVal.ItemUID = "1" And pVal.BeforeAction = True Then
                    If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
                        SBO_Application.MessageBox("animesh")
                        Dim accd1 As String = "720800"
                        Dim newacct As String = "720850"
                        Dim value As String
                        Try
                            value = oForm.Items.Item("amtVal").Specific.value
                            JournalEntry(accd1, newacct, value)
                        Catch ex As Exception
                            SBO_Application.MessageBox(ex.Message)
                        End Try
                    End If
                End If
        End Select
    End Sub

my error is

1} faild to add journal entry

error

2}5002 can't perform tranction title type accounr[ jdt1. account]

Edited by: Animesh Sinha on Sep 26, 2008 1:38 PM

Edited by: Animesh Sinha on Sep 26, 2008 1:42 PM

Edited by: Animesh Sinha on Sep 26, 2008 1:53 PM

Former Member
0 Kudos

hi experts

is any thing wrong my code or concept?

please help me out of this problem?

thanks in advance

Former Member
0 Kudos

it was just small mistake.....

isolved myself

hi all its working.....

Former Member
0 Kudos

Hi experts

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
        Dim oForm As SAPbouiCOM.Form
        oForm = SBO_Application.Forms.Item(FormUID)

        If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
            Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
            oCFLEvento = pVal
            Dim sCFL_ID As String
            sCFL_ID = oCFLEvento.ChooseFromListUID
            'Dim oForm As SAPbouiCOM.Form
            oForm = SBO_Application.Forms.Item(FormUID)
            Dim oCFL As SAPbouiCOM.ChooseFromList
            oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
            If oCFLEvento.BeforeAction = False Then
                Dim oDataTable As SAPbouiCOM.DataTable
                oDataTable = oCFLEvento.SelectedObjects
                Dim val As String
                Dim val1 As String = Nothing
                Dim val2 As String = Nothing
                Try
                    val1 = oDataTable.GetValue(71, 0)
                Catch ex As Exception
                End Try
                If (pVal.ItemUID = "Btn1") Then
                    oEdittext = oForm.Items.Item("crVal").Specific()
                    oEdittext.String = val1
                End If
                If (pVal.ItemUID = "Btn2") And (pVal.BeforeAction = False) Then
                    oEditItem = oForm.Items.Item("dbVal").Specific()
                    oEditItem.String = val1
                End If
            End If
        End If
        If pVal.ItemUID = "1" And pVal.BeforeAction = True Then
            If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE Then
                SBO_Application.MessageBox("201")
                ' Dim accd1 As String = "_SYS00000000377"  ' can i apply system account
                ' Dim newacct As String = "_SYS00000000536" ' can i apply system account
                ' Dim value As String
                Dim accd1 As String = oForm.Items.Item("crVal").Specific.value    '720230SBHQ   
                Dim newacct As String = oForm.Items.Item("dbVal").Specific.value  ' 899999HOHQ
                Dim value As String
                value = oForm.Items.Item("amtVal").Specific.value
                Try
                    JournalEntry(accd1, newacct, value)
                    SBO_Application.MessageBox("its working")
                Catch ex As Exception
                    ' SBO_Application.MessageBox(ex.Message)
                End Try
            End If
        End If
        If (FormUID = "SM_DJR") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) Then
            Windows.Forms.Application.Exit()
        End If
    End Sub

this project account segmentation is used ......

when i appling system account code like "_SYS00000000377"

it is working

but when i appling account no '720230SBHQ this

journal entry not working

please help me..

thanks in advance