on 03-22-2004 11:52 AM
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()
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.