Cannot add journal entries programmatically

Hi everyone
I'm not able to insert Journal entries in the database.
I'm using SAP Business One DI API Version 2007 and a copy of the database SBODemoUS. The code I'm using is inspired by the example in the SDK Help.
I'm trying to add journal entries to the company database. When I execute the code, I get a System Message:
[JDT1.Account][line:1],'Tax account has not been defined for the selected tax code', even though I'm not using a tax code. But when I assign a value to the property .TaxCode, I get a System Message: You can edit VAT fields only in Automatic VAT mode [JDT1.TaxCode][line: 1].
I'm able to create journal entries manually in SAP B1 using the same information that I'm using in my code. But I cannot create journal entries programmatically.
Here is the code that I'm using:
   Private Sub ImportJournalEntry()
      Dim rt As Long
      Dim errCode As Long
      Dim errMsg As String
      oCompany.Server = "PERSONNE-6D3DBE"
      oCompany.CompanyDB = "MYSBODEMO"
      oCompany.UserName = "manager"
      oCompany.Password = "manager"
      oCompany.language = 3
      oCompany.UseTrusted = False
      oCompany.DbServerType = BoDataServerTypes.dst_MSSQL2005
      oCompany.DbPassword = "sapwd"
      oCompany.DbUserName = "sa"
      rt = oCompany.Connect()
      If rt <> 0 Then
         oCompany.GetLastError(errCode, errMsg)
      Else
         Dim entries As SAPbobsCOM.JournalEntries =               DirectCast(Me.oCompany.GetBusinessObject(BoObjectTypes.oJournalEntries), JournalEntries)
         Dim str2 As String
         Try
            entries.TaxDate = DateTime.Now.ToShortDateString
            entries.StornoDate = DateTime.Now.ToShortDateString
            entries.ReferenceDate = DateTime.Now.ToShortDateString
            'First line
            'entries.Lines.TaxCode = "CA"
            entries.Lines.AccountCode = "112200000100101"
            entries.Lines.ShortName = "Cash at Bank "
            entries.Lines.Debit = 0
            entries.Lines.Credit = 125
            entries.Lines.Add() 'Add
            'Second line
         'entries.Lines.TaxCode = "CA"
            entries.Lines.AccountCode = "611000000100101"
            entries.Lines.ShortName = "Travel Expense"
            entries.Lines.Debit = 125
            entries.Lines.Credit = 0
            entries.Lines.Add() 'Add
            If entries.Add <> 0 Then
               Dim num As Integer
               Me.oCompany.GetLastError(num, str2)
               SBO_Application.MessageBox(str2)
            Else
               SBO_Application.MessageBox("Import was successful!")
            End If
            oCompany.Disconnect()
         Catch exception1 As Exception
            SBO_Application.MessageBox(exception1.Message.ToString & _
                  "   Source = " & exception1.Source.ToString & _
                  "    TargetSite = " & exception1.TargetSite.ToString & _
                  "    StackTrace = " & exception1.StackTrace.ToString)
            oCompany.Disconnect()
         End Try
      End If
   End Sub
Thanks for any help

Hello Vitor
Thanks, I got the code to work. You were right about debit or credit, not both. I also removed the tax code.
But the main reason I think it didn't work is because the account code I was using was incorrect. Since the company is using segmentation for their account code, we are suppose to use the account key, not the account code. In order to get the account key I found this function:
Private Function GetAccountKey(ByVal v_sAccountCode As String) As String
      Dim oSBObob As SAPbobsCOM.SBObob
      Dim oRecordSet As SAPbobsCOM.Recordset
      Dim oChartOfAccounts As SAPbobsCOM.ChartOfAccounts
      Dim sStr As String
      '// Get an initialized SBObob object
      oSBObob = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)
      '// Get an initialized Recordset object
      oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
      '// Get an initialized oChartOfAccounts object
      oChartOfAccounts = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oChartOfAccounts)
      '// Execute the SBObob GetObjectKeyBySingleValue method
      oRecordSet = oSBObob.GetObjectKeyBySingleValue(SAPbobsCOM.BoObjectTypes.oChartOfAccounts, "FormatCode", v_sAccountCode, SAPbobsCOM.BoQueryConditions.bqc_Equal)
      sStr = oRecordSet.Fields.Item(0).Value
      GetAccountKey = sStr
   End Function
So the final code looks like this. Although I don't pretend to have perfect code, I'm able to add journal entries.
Private Sub ImportTitan2()
      Dim rt As Long
      Dim errCode As Long
      Dim errMsg As String
      Dim sAccountKey As String
      oCompany.Server = "PERSONNE-6D3DBE"
      oCompany.CompanyDB = "MYSBODEMO"
      oCompany.UserName = "manager"
      oCompany.Password = "manager"
      oCompany.language = 3
      oCompany.UseTrusted = False
      oCompany.DbServerType = BoDataServerTypes.dst_MSSQL2005
      oCompany.DbPassword = "sapwd"
      oCompany.DbUserName = "sa"
      rt = oCompany.Connect()
      If rt <> 0 Then
         oCompany.GetLastError(errCode, errMsg)
      Else
         Dim entries As SAPbobsCOM.JournalEntries = DirectCast(Me.oCompany.GetBusinessObject(BoObjectTypes.oJournalEntries), JournalEntries)
         Dim str2 As String
         Try
            entries.TaxDate = DateTime.Now.ToShortDateString
            entries.StornoDate = DateTime.Now.ToShortDateString
            entries.ReferenceDate = DateTime.Now.ToShortDateString
            'First line
            entries.Lines.SetCurrentLine(0)
            sAccountKey = GetAccountKey("112200000100101")
            entries.Lines.AccountCode = sAccountKey    'Account code
            entries.Lines.ShortName = sAccountKey
            entries.Lines.Credit = 300
            entries.Lines.Add() 'Add
            'Second line
            entries.Lines.SetCurrentLine(1)
            sAccountKey = GetAccountKey("611000000100101")
            entries.Lines.AccountCode = sAccountKey   'Account code
            entries.Lines.ShortName = sAccountKey
            entries.Lines.Debit = 300
            entries.Lines.Add() 'Add
            If entries.Add <> 0 Then
               Dim num As Integer
               Me.oCompany.GetLastError(num, str2)
               SBO_Application.MessageBox(str2)
            Else
               SBO_Application.MessageBox("Import was successful!")
            End If
            oCompany.Disconnect()
         Catch exception1 As Exception
            SBO_Application.MessageBox(exception1.Message.ToString & _
                  "   Source = " & exception1.Source.ToString & _
                  "    TargetSite = " & exception1.TargetSite.ToString & _
                  "    StackTrace = " & exception1.StackTrace.ToString)
            oCompany.Disconnect()
         End Try
      End If
   End Sub
Thank you for your help. You put me in the right direction.

Similar Messages

  • IPhon 4: After recently updating to version 7.1.2, all my past calendar entries disappeared and I cannot add new entries.

    After recently updating to 7.1.2, all of my past calendar entries for 22014 disappeared and I cannot add new entries??

    What account were you using to sync your Calendar?  Make sure that account is added to the device, and make sure that Calendars is turned on for that account. 
    Then, go to Settings > Mail, Contacts, Calendars, and make sure that under the Calendar section that 'Sync' is set to 'All Events'.
    Then go to the Calendar app, go to Calendars, and make sure that you have that account enabled.
    Then, close out all the running apps on your device, and restart it.
    Open up your Calendar app.  Are your entries back?

  • Can I add journal entries that are tagged to calender events?

    I want to be able to add journal entries to certaon calender events as notes so that I can reference these at a later date.  I ee ICal can;t do it,  is there another app that automatically integrates with ICal that will do this.  What about Evernote or Things?

    You can add predefined fields using the "Card" menu and "Add Field" Submenu.
    You can also change labels for multi-values properties by clicking the current label and choose "Customize"
    But I don't think you can add custom fields using AddressBook.
    Perhaps you should consider using other software like RubenSoft's Pack Organizer or ">Objective Decision's Contactizer
    Why reward points ?

  • Cannot preview journal entry in AP Invoice

    Dear Experts,
    Good day!
    One of the users who create AP Invoice cannot preview the journal entry while adding such document. SAP B1 automatically directs it to the approval process? What would be the possible cause of this? He is a limited financial user with full authorization in AP invoice, Journal Entry etc.
    I hope you could help me with this.
    Thank you.
    Regards,
    Alven

    Hi Sir,
    Thank you for your response.
    But in my unit i can preview the journal entry before SAP activates its approval process. By the way I am using SAP v9.0 PL12 and my client use only v9.0 PL05..
    I just discovered that its a program error and such bug was fixed in PL08.
    Please see SAP Notes below.
    http://service.sap.com/sap/support/notes/1905717
    http://service.sap.com/sap/support/notes/1925757
    Regards,
    Alven

  • Add Journal Entries Report - Output to Request Set

    Hi All,
    I'm trying to create a Request Set for the receivable application
    The request set should contains two Programs
    1- AR: Journal Entries Report
    2- Journal Entries Report - Output
    I defined the request set and when i start adding the programs , i selected the first program AR: Journal Entries Report from the list and gave it sequence 10
    when i tried to add the other Report "Journal Entries Report - output" i didn't find it in the list and i'm not able to add it
    1-Do any one know why this program doesn't appeat in the list ?
    2- If i created a copy of this program and gave it other name , this program in the definition doesn't have any parameters although a parameters must be passed to it from the first request AR : Journal Entries report. how to pass parameters from the first program to it
    Best Regards

    nuppara,
    I need to add this report to the request set as it's a workaround to get the output of the AR: Journal Entries Report as Excel - I created a post asking this question also , u already replied to it.
    My workaround is like this , the AR: journal Entries Report automatically sumbit the program "Journal Entries Report - Output" based on the parameters that the user select
    Print Detail By Account , Print Detail By Category , Print Summary By Account , Print Summary By Category
    if i want to to make this report to be an Excel output so i'll have to create 4 templates but won't be able to assign the correct template to it , as the main request AR: journal Entries report calls it automaticcaly, and may run it 4 times
    so my workaround was like this
    i'll create 4 request sets ,
    the first RS will be for example AR: journal Entries Detail By Account, i'll add to it 2 programs the AR: journal Entries Report , and the Journal Entry Report - output -OR a program copied from it with the same design and i'll add parameters to it-
    i'll force the parameters of the AR: Journal Entries in this request set to be Print Detail By Account = 'Y' and the other options = 'N' so the report will call Journal Entry Report - output with the parmeter layout= 'Print Detail By Account ' will be displayed as text ... when it finish the request set will run the Journal Entry Report - output -OR the copied program - that i'll assign the correct template and data definition for it, so it'll run and display the output as Excel .
    I need to try this solution, but i was not able to add the journal Entries Report - Output to the request set :( and i'm not sure if i'll create a copy from it will be added or not,
    and also i'm not sure if this workaround may work , as i know when the AR: Journal Entires report complete it delete the data from the temp table so the 2nd request may work on an empty table , or it'll have a request_id different from the request_id of the temp table so it won't select any row
    all of this is just a brain storming to find the solution. :( i'm thinking by a loud voice here :-D
    i know it may not work but at least to try it i need to add this report to the request set.

  • After my upgrade to iOS6, my iPhone4 lost all entries in the Reading List and Bookmarks.  I cannot add new entries.  Any thoughts on how to fix this?

    I'm not 100% positive that this is related to the iOS6 upgrade, but the timing is certainly suspicios.  Previously, I had 7 entries in Safari's readling list and many entries in the Bookmarks.  Now, I have nothing except the large pair of sunglasses and help text that tells me how to add a link to the reading list.
    When I am looking at a webpage and click on the Forward button, I'm giving all sorts of choices now in full color...  facebook... Message... Twitter... Mail... Add to homescreen.  The following buttons are all grey: Print, Copy, Bookmark, and Add to Reading List.
    I'm guessing that the icon color is a red herring.  Print and Copy, despite being grey, appear to work fine.  Bookmark and Add to Reading List have problems. 
    Adding to the Reading List makes the forwarding screen go away, as though the link was added.  When I click on the Bookmark icon and look at my reading list, it remains empty, displaying the large sunglasses and help text, as though the list has never had an entry added to it.
    Adding a Bookmark prompts me to enter the name and location.  Interestingly, the list of locations is empty.  I have a single folder with no name and a check mark next to it.  I cannot do anything else (make a new folder, for example).  Once added, when I click on the Bookmark icon to look at my bookmarks, that list remains empty of individual bookmarks.  All I have are: Reading List (still empty), History (full of expected entries), Bing (which takesme to some Bing thing).
    Any help in restoring my bookmarks and Reading List entries would be appreciated.  Thanks!

    Thanks. That solved it. I had my doubts since I wasn't concerned about my lost bookmarks. I was concerned about the broken functionality. In any event, restoring from a backup solved both the functionality and the lost bookmarks. I appreciate the response!

  • Ios8 update: cannot add calendar entries via phone

    Since updating to ios8, I can no longer add calendar events to my phone.  I have always used my outlook.com account for email/cal/contacts with no problems, but now I cannot use the calendar very effectively! I can only add events online, and then they'll sync to my phone.  Also noticed that I can no longer set the outlook calendar as the default calendar -- it always reverts to the local iphone calendar.
    I've tried the following:
    - restart phone
    - deactivate/reactivate outlook account
    - from "Calendars" menu in the calendar view, turn off/on individual calendars.
    Nothing works.
    ...wishing I could go back.

    UPDATE: I just installed "Sunrise" calendar and found that this works without a hitch...

  • E71 cannot add iCal entries to Calendar

    Whenever I or someone else forwards to me an iCal calendar entry, as an email attachment, I get an error message, from my Nokia E71, when I attempt to open the iCal entry and add it to the native calendar.
    Here's what happens:
    Email is received.
    Open attachment
    Message is "Calendar entry Add to Calendar?"
    I select "Yes"
    Message is "Calendar entry Failed to add to calendar"
    the iCal attachments are coming from Microsoft Outlook.
    Is there a problem with the iCal format, being sent from Outlook, or with the E71's ability to read the iCal file and add it to its calendar?
    If not iCal, is there another way to send calendar entries from Outlook?

    /t5/Eseries-Devices-and/Mail-for-Exchange-System-Error-try-again-later-Failed-to-store/m-p/471616
    Looks like it's an Outlook 2007 issue rather than Nokia....

  • Unable to use di api to add a journal entry

    Hi All,
    I had trouble with adding a journal entry
    the following are my codes:
            oJournal = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)
            oJournal.DueDate = Now
            oJournal.ReferenceDate = Now
            oJournal.TaxDate = Now
            ' first line
            oJournal.Lines.AccountCode = "11110101"
            oJournal.Lines.ContraAccount = "C00001"
            oJournal.Lines.Credit = 1000
            oJournal.Lines.Debit = 0
            oJournal.Lines.ShortName = "11110101"
            ' second line
            oJournal.Lines.Add()
            oJournal.Lines.AccountCode = "C00001"
            oJournal.Lines.ContraAccount = "11110101"
            oJournal.Lines.Credit = 0
            oJournal.Lines.Debit = 1000
            oJournal.Lines.ShortName = "C00001"
            ' add journal entry
            lRetCode = oJournal.Add()
    The error message is " [JDT1.Account][line: 2] , 'Tax account has not been defined for the selected tax code'"
    Cheers

    I've tried the following codes but I got the same error
            Dim oJournal As SAPbobsCOM.JournalEntries
            oJournal = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)
            oJournal.DueDate = Now
            oJournal.ReferenceDate = Now
            oJournal.TaxDate = Now
            oJournal.Series = 1023
            ' first line
            oJournal.Lines.AccountCode = "11110101"
            oJournal.Lines.Credit = 1000
            oJournal.Lines.Debit = 0
            oJournal.Lines.DueDate = Now
            oJournal.Lines.TaxDate = Now
            oJournal.Lines.ReferenceDate1 = Now
            ' second line
            oJournal.Lines.Add()
            oJournal.Lines.AccountCode = "C00001"
            oJournal.Lines.Credit = 0
            oJournal.Lines.Debit = 1000
            oJournal.Lines.DueDate = Now
            oJournal.Lines.TaxDate = Now
            oJournal.Lines.ReferenceDate1 = Now
            ' add journal entry
            lRetCode = oJournal.Add()

  • Date deviates from permissible range [journal entry - Document Date]

    Hi, i have problem to add journal entry, when i creat journal document last year with:
    Posting date: 06-02-09 (this date)
    Due date: 06-002-09
    and Document date: 20-11-08 (couse the document late to creat at the journal)
    kindly, and thx for solution..
    Regards,
    Ani

    Ani,
    Take a look at this thread
    Re: Delivery Date on Sale Order
    Suda

  • Cannot Add a new Accounting Entries - SDK

    Dear Sir,
    I need to add an accounting entry into SAP BO via SDK.
    I am using the following code:
    For iColCount = 1 To lFactorColl.Count
                        '//Search  Accounting information
                        oTable = oDataSet.Tables("DocList")
                        Dim oSRows() As DataRow = oTable.Select("FactorCode = '" & lFactorColl.Item(iColCount).ToString & "'")
                        oJE = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)
                        Try
                            iIndex = 0
                            oJE.TaxDate = CDate(Right(oDate, 2) & "/" & Mid(oDate, 5, 2) & "/" & Left(oDate, 4))
                            oJE.DueDate = CDate(Right(oDate, 2) & "/" & Mid(oDate, 5, 2) & "/" & Left(oDate, 4))
                            oJE.ReferenceDate = CDate(Right(oDate, 2) & "/" & Mid(oDate, 5, 2) & "/" & Left(oDate, 4))
                            oJE.Memo = "test"
                            '// Set the first lines for the clients invoices - credit side
                            For iRowCount = 0 To oSRows.GetUpperBound(0)
                                iIndex = iRowCount
                                oJE.Lines.SetCurrentLine(iIndex)
                                'sAccountKey = GetAccountKey(oSRows(iRowCount)("CardCode"))
                                oJE.Lines.ShortName = oSRows(iRowCount)("CardCode")
                                'oJE.Lines.AccountCode = oSRows(iRowCount)("CardCode")
                                'sAccountKey = GetAccountKey(oSRows(iRowCount)("FactorCode"))
                                'oJE.Lines.ContraAccount = sAccountKey
                                sFactor = lFactorColl.Item(iColCount + 1).ToString
                                oJE.Lines.Credit = CDbl(Replace(oSRows(iRowCount)("Amount"), ".", ","))
                                sTotalAmt = sTotalAmt + CDbl(Replace(oSRows(iRowCount)("Amount"), ".", ","))
                                oJE.Lines.Add()
                            Next iRowCount
                            'Set the factor line - debit side
                            iIndex = iIndex + 1
                            oJE.Lines.SetCurrentLine(iIndex)
                            'sAccountKey = GetAccountKey(sFactor)
                            'oJE.Lines.AccountCode = sFactor
                            oJE.Lines.ShortName = "02"
                            oJE.Lines.Debit = sTotalAmt
                            oJE.Lines.Add()
                            If oJE.Add = 0 Then
                                Dim num As Integer
                                oCompany.GetLastError(num, sStr2)
                                SBO_Application.MessageBox(sStr2)
                            Else
                                SBO_Application.MessageBox("Import was successful!")
                                oJE.SaveXML("c:\JournalEntries" + Str(oJE.Number) + ".xml")
                            End If
                        Catch exception1 As Exception
                        End Try
                    Next
    this code does not generate any error but no accouting entry are entered although if i try to enter it manually, it is saved in the database.
    please advise what it is wrong in my code making it not working properly.
    PS: both credit and Debit side in my entry is using the BP code and not G/L account.
    Best Regards

    There are a couple of things that I noticed, if I'm reading your code right.  First, it appears you are
    issuing the oJE.Lines.Add()  command at the end of your loop (which would be in preparation for filling that line with data after reading the next row back at the top of the loop).  If that's the case then when you fill your last good line item with data, you're going to add a blank line into the object, and I think that would fail.
    Also, it appears that when you try to add the Journal entry with the code I've copied below,
    you are only checking for error messages when the Add succeeds:
    If oJE.Add = 0 Then
    Dim num As Integer
    oCompany.GetLastError(num, sStr2)
    SBO_Application.MessageBox(sStr2)
    Else
    SBO_Application.MessageBox("Import was successful!")
    oJE.SaveXML("c:\JournalEntries" + Str(oJE.Number) + ".xml")
    End If
    I think that the first line of code, above, should be if oJE.Add <> 0 then....
    Are you getting your message that says "Import was successful!")?

  • Add-On connection for Journal Entry - Failed to Connect to SBO Common

    We have a customer (SAPBO 2005A SP01 PL29) with some specific requirements that required an add-on running in the background to monitor the addition of Goods Receipt PO's to the system. When the GRPO is successfully added, the Add-On will (behind the scenes) create an appropriate Journal Entry through the SAP DI. One of the issues that we encountered during the development of this functionality was that when it was tested by users, they weren't authorized to access the Financials module or the Journal Entry screen. What we ended up doing was creating a secondary connection (vCompany) in the DL pulling the information from the encrypted user information from SAP the Add-On used to connect, but utilizing a management level user ID and password. Once that connection has been made, the Journal Entry is added through the DI and that secondary connection is disconnected.
    The problem that we're encountering is this. When the users are logged into SAP Client with an regular user, and the GRPO adds, the secondary connection fails and returns a message of "Failed to Connect to SBO-Common". However, if the user is logged into SAP as an adminitrative level user and the GRPO is added, the secondary connection is successful and the Journal Entry is created. The secondary connection is strictly used for the JE. Here's the code (VS.Net 2005) for the secondary connection:
    vCompany = New SAPbobsCOM.Company
    vCompany.UseTrusted = True
    vCompany.language = SAPbobsCOM.BoSuppLangs.ln_English
    vCompany.CompanyDB = oCompany.CompanyDB
    vCompany.UserName = "XXXXX"
    vCompany.Password = "YYYYY"           
    vCompany.Server = oCompany.Server
    vCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2005
    lRetConnect = vCompany.Connect()
    Where "XXXXX" would be the appropriate management level SAP User Name and "YYYYY" would be that users password.
    Has anyone else had this kind of issue where you needed a secondary connection with management level access behind the scenes to accomplish something in SAP and had problems getting it to connect? Any thoughts or ideas would be greatly appreciated.

    Hi Dennis,
    what you can try is to make a untrusted connection
    oCompany.UseTrusted = False
    and set the DBUser and Pwd
    oCompany.DbUserName = "sa"
    oCompany.DbPassword = "insertpwd"
    lg David

  • Add Customer Field while posting Journal Entry

    BSEG-KUNNR is not exposed while posting journal entry using FB01. It is not available in the field status group also. How to add customer number field in the field status group to make it available during posting journal entry using FB01.

    Hi Jac,
    1, There is a known issue in a lower version before  2005A SP01 PL30when you try to run a retirement operation for a fixed asset with Net Price equal to the Net Book Value, it failed and you got the following error message:
    21141 error while posting journalentry: -5012 /Unbalanced Transaction.
    If you are in this scenario, please upgrade your Fixed Assest to the latest patch.
    2. If you are not in above scenario, this problem is possibly caused by the incorrect configuration of accounts in G/L
    Account Determination.
    There should not be 'Default VAT Group' related to these accounts except for account 'Default Revenue Acc. Retirement' in G/L Account Determination.
    1) Go to Administration - Setup - Fixed Assets - Open G/L Account Determination;
    2) Select an Account Determination Group;
    3) Under the G/L Account Determination window, open the account linked to 'Balance Sheet of Asset Acc.' by clicking on the yellow arrow;
    3) The Chart of Accounts window will open, click on the'Account Details' button beneath the window to open G/L Account Details;
    4) Empty the field 'Default VAT Code';
    5) Execute the Retirement functionality again.
    You can also refer to SAP Note 1050423 for reference. https://service.sap.com/sap/support/notes/1050423
    I hope it is helpful!
    Regards,
    Ivy Zhang
    SAP Business One Forums Team

  • Requirement for add a journal entry of unbalnce FC  amount

    Hi,expert !
    I want to add a journal entry of unbalnce FC  amount.
    for example: assume the exchage rate is 1.5
    AccountNo  Debit(FC)          Credit(FC)  Debit Credit
    1001                usd 100                           150
    1002                                                                  150
    How can I make it ? Any help  is appreicated . Thank you in advance.

    Hi,
    There is a master setting inorder to allow unbalanced transaction in the journal entry.
    Administration->System Initialization->Document setting->Per document tab->Select Document-Journal Entry
    Uncheck the option 'Block &Unbalanced FC Journal Entry' and update.
    This will allow you to add unbalanced transaction.
    If you need to make a single manual journal entry,Open Journal entry window->Go to form setting->Document tab->General tab-'Allow Unbalanced Transaction in FC',select this option.
    Hope this is helpful!

  • How to add a Journal Entry - Error "Code undefined"

    Hi, i want to add a simple journal entry by using DI-Api. The problem is, i always get the error message "Code undefined" when I use the Debitor-AccountCode.
    My code is like that:
    oJ.TaxDate=dTaxDate;
    oJ.AutoVat=BoYesNoEnum.tNO;
    oJ.Lines.AccountCode="2000";    //Customer
    oJ.Lines.ContraAccount="4020";
    oJ.Lines.Credit=dCredit;
    oJ.Lines.Debit=dDebit;
    oJ.Lines.TaxDate=odTaxDate;
    oJ.Lines.ShortName="23121089";
    oJ.Lines.LineMemo="Ausgangsrechnung";
    oJ.Lines.Add();
    oJ.Lines.AccountCode="3500";   //VAT
    oJ.Lines.ContraAccount="23121089";
    oJ.Lines.Credit=dCredit;
    oJ.Lines.Debit=dDebit;
    oJ.Lines.TaxDate=odTaxDate;
    oJ.Lines.ShortName="23121089";
    oJ.Lines.LineMemo="Ausgangsrechnung";
    oJ.Lines.Add();
    oJ.Lines.AccountCode="4020";
    oJ.Lines.ContraAccount="23121089";
    oJ.Lines.Credit=dCredit;
    oJ.Lines.Debit=dDebit;
    oJ.Lines.TaxDate=odTaxDate;
    oJ.Lines.ShortName="23121089";
    oJ.Lines.LineMemo="Ausgangsrechnung";
    oJ.Add();

    Hi,
    Here is the code to find the BP account number:
    oRecordset = ((SAPbobsCOM.Recordset)(oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
                        oRecordset.DoQuery("SELECT [LinkAct_3] FROM [dbo].[OACP]");
                        oRecordset.MoveFirst();
                        if (oRecordset.EoF == true) // We have a Error
                            oCompany.GetLastError(out vmp_B1_Error_Code_int, out vmp_B1_Error_Message_string);
                            SBO_Application.MessageBox("Add-On Error (Forgestik Inc.): ERR-789 \n " + "Cash Account does not Exist "+ vmp_B1_Error_Message_string, 1, "Ok", "", ""); // My Error Code
                        else
                            vm_CachAccountNumber_string = Convert.ToString(oRecordset.Fields.Item("LinkAct_3").Value);
    ...Then you have to use the system account number "_SYS00000000353" not the displayed account number in B1...
    Thank you,
    Rune

Maybe you are looking for