cancel
Showing results for 
Search instead for 
Did you mean: 

JournalEntries - error with lines

Former Member
0 Kudos

Hi,

Is there a Business object expert who can help me?

My problem is, when i am trying to add a journalentry, I get a line error, as if i was writing into the same line, with this code:

Dim vJE As SAPbobsCOM.JournalEntries

vJE = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)

vJE.TaxDate = Now

vJE.Lines.AccountCode = "3000"

vJE.Lines.ContraAccount = "6010"

vJE.Lines.Credit = 0

vJE.Lines.Debit = 150

vJE.Lines.DueDate = Now

'vJE.Lines.Line_ID = 0

vJE.Lines.ReferenceDate1 = Now

vJE.Lines.ShortName = "3000"

vJE.Lines.TaxDate = Now

Call vJE.Lines.Add()

Call vJE.Lines.SetCurrentLine(1)

vJE.Lines.AccountCode = "6010"

vJE.Lines.ContraAccount = "3000"

vJE.Lines.Credit = 150

vJE.Lines.Debit = 0

vJE.Lines.DueDate = Now

'vJE.Lines.Line_ID = 1

vJE.Lines.ReferenceDate1 = Now

vJE.Lines.ShortName = "6010"

vJE.Lines.TaxDate = Now

Call vJE.Lines.Add()

vJe.add()

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

You don't need the last line add. You start with one line, and every time you add you have another line. You did not give enough detail about the error for me to guess if this is the cause of your problem.

Former Member
0 Kudos

Hi Bruce,

Thank for your reply, a more detail describtion is:

The error that comes out, when running this is:

Found Error: [JDT1.Account][Line: 1] Row in transaction with Account No.]

I have changed the code so the last line add is gone, but still the error appear.

There is an example in the help, but it seems to be older than the version I am using.

StephanPutro
Explorer
0 Kudos

Hi Brandon,

i have test your samplecode. It work´s!

Are you sure that the account no. 3000 and 6010 is defined in SBO-Database?

Greeting

Stephan

Former Member
0 Kudos

hi ,

I Have the same problem en error  in this line   'vJE.Lines.Line_ID = 0 or 'vJE.Lines.Line_ID = 1

who can help me please ?

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I have tried this for passing the journal entry using DIAPI. Why you are trying with SetCurrentLine().

string updating = "Select U_IntlTtl from [@ChallanMaster] where U_TotalC1 = '" + Challan + "'";

                                    oRecSet.DoQuery(updating);

                                    while (oRecSet.EoF == false)

                                    {

                                        double Amount = Convert.ToDouble(oRecSet.Fields.Item("U_IntlTtl").Value);

                                        Oje.Reference3 = Challan;

                                        Oje.Lines.AccountCode = "200100004010";

                                        Oje.Lines.Credit = Amount;

                                        Oje.Lines.Add();

                                        Oje.Lines.AccountCode = "50020040010";

                                        Oje.Lines.Debit = Amount;

                                        Oje.Lines.Add();

                                        int ith = 0;

                                        try

                                        {

                                            ith = Oje.Add();

                                            if (ith != 0)

                                            {

                                                int irrcode;

                                                string errmsg;

                                                SBO_Company.GetLastError(out irrcode, out errmsg);

                                                Program.oMainSAPDI.ShowMessage(errmsg, BoStatusBarMessageType.smt_Error);

                                            }

                                            else

                                            {

                                                Program.oMainSAPDI.ShowMessage("Journal Transaction Completed Successfully.", BoStatusBarMessageType.smt_Warning);

                                            }

                                        }

Hope it helps...

Thanks