cancel
Showing results for 
Search instead for 
Did you mean: 

Problems of "General Error"

Former Member
0 Kudos

Hi all, i'm lookin for an explanation of a problem that we have in an development, we made a new window that will make the deliveries for reserve invoices via di api,

My problem is that we made this development testing in a DB already in production from another client, and it works,

Now that i'm testing with the new DB of the client, when i try to make a delivery associated to the reserve invoice:

oDespacho.Lines.BaseEntry = DocEntry

oDespacho.Lines.BaseLine = Z3 - 0 for the first line

oDespacho.Lines.BaseType = SAPbobsCOM.BoAPARDocumentTypes.bodt_Invoice

It just throws "General Error" and i can't make the delivery,

If i do this process without the association it makes a delivery not associated with the invoice but it works, i checked all the accounts of the item, trying to get it equal with another item of another client and the accounts need to make the reserve invoice, then what's wrong?

Any bug? because if i make this process standard in this new DB, it makes the delivery associated with the reserve invoice, i don't know what else can i try about this,

Any suggestion will help, Thanks,

Gabriel

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Gabriel,

I have the same problem when i try to make a delivery associated to the order, the problem occours not in all delivery but in a few of them.

The problem appear when i try to base from order, if i can not base from order the delivery works.

I test in DI 2005 and Di 2007. In DI 2005 i have the error message "general error", in di 2007 when i try to add the delivery the application crash.

Can you resolve your problem?

Regards,

Tiago

Former Member
0 Kudos

Hi, the answer from SAP was,

You can not make a delivery note based on a reserve invoice because the boobjectnum for invoices works only for invoices and not reserved invoices.

Now that i'm testing with the new DB of the client, when i try to make a delivery associated to the reserve invoice:

oDespacho.Lines.BaseEntry = DocEntry

oDespacho.Lines.BaseLine = Z3 - 0 for the first line

oDespacho.Lines.BaseType = SAPbobsCOM.BoAPARDocumentTypes.bodt_Invoice (you cant use this for reserve invoices, that's their explanation)

The best was, why can i do it in one DB of a client and in this one i can't? they just never answered to that, of course the docentry will work because all invoices are in the same table and you can do a GetByKey() with the documents object, and SAP told me i couldn't do this, well i did...

My solution, raise the standar window and make a "macro" that clicks on button copy from, and brings all the data.

Thanks for all your ideas.

Gabriel

Former Member
0 Kudos

I have the next code in c# .net 2008

private void Apply(int Docentry)

{

SAPbobsCOM.Company sCompany;

SAPbobsCOM.Documents dEntrega;

SAPbobsCOM.Documents dFactura;

AGAIN:

try

{

sCompany = new SAPbobsCOM.Company();

sCompany.CompanyDB = "Prueba"; //"zFOSE_P2";

sCompany.DbUserName = "sa"; //"manager";

sCompany.DbPassword = "klop9490"; //"manager";

sCompany.Server = "192.168.1.3"; //"192.168.5.204";

sCompany.UserName = "czelaya"; //"manager";

sCompany.Password = "thinkpad"; //"manager";

sCompany.Connect();

dFactura = (SAPbobsCOM.Documents)sCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);

dEntrega = (SAPbobsCOM.Documents)sCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes);

dFactura.GetByKey(Docentry);

}

catch (Exception E)

{

lbcErrors.Items.Insert(0, "Factura #" + Convert.ToString(Docentry) + ", Error: " + E.Message);

dFactura = null;

dEntrega = null;

//if (sCompany.Connected) sCompany.Disconnect();

//sCompany = null;

goto AGAIN;

}

tsFactura.Text = dFactura.CardName;

tsRow.Text = dFactura.DocNum.ToString();

Application.DoEvents();

try

{

dEntrega.CardCode = dFactura.CardCode;

dEntrega.CardName = dFactura.CardName;

dEntrega.DocDate = dFactura.DocDate;

dEntrega.TaxDate = dFactura.TaxDate;

dEntrega.DocDueDate = dFactura.DocDueDate;

dEntrega.SalesPersonCode = dFactura.SalesPersonCode;

dEntrega.Comments = dFactura.Comments;

dEntrega.NumAtCard = dFactura.NumAtCard;

dEntrega.PaymentMethod = dFactura.PaymentMethod;

for (int i = 0; i < dFactura.Lines.Count; i++)

{

dFactura.Lines.SetCurrentLine(i);

dEntrega.Lines.BaseType = (int)SAPbobsCOM.BoAPARDocumentTypes.bodt_Invoice;

dEntrega.Lines.BaseEntry = dFactura.DocEntry;

dEntrega.Lines.BaseLine = dFactura.Lines.LineNum;

//dEntrega.Lines.ItemCode = dFactura.Lines.ItemCode;

//dEntrega.Lines.Quantity = dFactura.Lines.Quantity;

//dEntrega.Lines.Price = dFactura.Lines.Price;

//dEntrega.Lines.TaxCode = dFactura.Lines.TaxCode;

//dEntrega.Lines.DiscountPercent = dFactura.Lines.DiscountPercent;

//dEntrega.Lines.PriceAfterVAT = dFactura.Lines.PriceAfterVAT;

//dEntrega.Lines.WarehouseCode = dFactura.Lines.WarehouseCode;

//dEntrega.Lines.ProjectCode = dFactura.Lines.ProjectCode;

/*for (int j = 0; j < dFactura.Lines.BatchNumbers.Count; j++)

{

dEntrega.Lines.BatchNumbers.AddmisionDate = dFactura.Lines.BatchNumbers.AddmisionDate;

dEntrega.Lines.BatchNumbers.BaseLineNumber = dFactura.Lines.BatchNumbers.BaseLineNumber;

dEntrega.Lines.BatchNumbers.BatchNumber = dFactura.Lines.BatchNumbers.BatchNumber;

dEntrega.Lines.BatchNumbers.ExpiryDate = dFactura.Lines.BatchNumbers.ExpiryDate;

dEntrega.Lines.BatchNumbers.InternalSerialNumber = dFactura.Lines.BatchNumbers.InternalSerialNumber;

dEntrega.Lines.BatchNumbers.Location = dFactura.Lines.BatchNumbers.Location;

dEntrega.Lines.BatchNumbers.ManufacturerSerialNumber = dFactura.Lines.BatchNumbers.ManufacturerSerialNumber;

dEntrega.Lines.BatchNumbers.ManufacturingDate = dFactura.Lines.BatchNumbers.ManufacturingDate;

dEntrega.Lines.BatchNumbers.Notes = dFactura.Lines.BatchNumbers.Notes;

dEntrega.Lines.BatchNumbers.Quantity = dFactura.Lines.BatchNumbers.Quantity;

dEntrega.Lines.BatchNumbers.Add();

}

for (int j = 0; j < dFactura.Lines.SerialNumbers.Count; j++)

{

dEntrega.Lines.SerialNumbers.BaseLineNumber = dFactura.Lines.SerialNumbers.BaseLineNumber;

dEntrega.Lines.SerialNumbers.BatchID = dFactura.Lines.SerialNumbers.BatchID;

dEntrega.Lines.SerialNumbers.ExpiryDate = dFactura.Lines.SerialNumbers.ExpiryDate;

dEntrega.Lines.SerialNumbers.InternalSerialNumber = dFactura.Lines.SerialNumbers.InternalSerialNumber;

dEntrega.Lines.SerialNumbers.Location = dFactura.Lines.SerialNumbers.Location;

dEntrega.Lines.SerialNumbers.ManufactureDate = dFactura.Lines.SerialNumbers.ManufactureDate;

dEntrega.Lines.SerialNumbers.ManufacturerSerialNumber = dFactura.Lines.SerialNumbers.ManufacturerSerialNumber;

dEntrega.Lines.SerialNumbers.Notes = dFactura.Lines.SerialNumbers.Notes;

dEntrega.Lines.SerialNumbers.ReceptionDate = dFactura.Lines.SerialNumbers.ReceptionDate;

dEntrega.Lines.SerialNumbers.SystemSerialNumber = dFactura.Lines.SerialNumbers.SystemSerialNumber;

dEntrega.Lines.SerialNumbers.WarrantyEnd = dFactura.Lines.SerialNumbers.WarrantyEnd;

dEntrega.Lines.SerialNumbers.WarrantyStart = dFactura.Lines.SerialNumbers.WarrantyStart;

dEntrega.Lines.SerialNumbers.Add();

}*/

dFactura.Lines.LineStatus = SAPbobsCOM.BoStatus.bost_Close;

if (i < dFactura.Lines.Count - 1) dEntrega.Lines.Add();

}

if (dEntrega.Add() != 0)

{

int ierror;

String serror;

sCompany.GetLastError(out ierror, out serror);

lbcErrors.Items.Insert(0, "Factura #" + tsRow.Text + ", Error #" + ierror.ToString() + ": " + serror.ToString());

}

else

{

lbcErrors.Items.Insert(0, "Factura #" + tsRow.Text + ", 0 Error: ");

}

}

catch (Exception Ex)

{

lbcErrors.Items.Insert(0, "Factura #" + tsRow.Text + ", Error: " + Ex.Message);

}

finally

{

dEntrega = null;

dFactura = null;

if (sCompany.Connected) sCompany.Disconnect();

sCompany = null;

}

//break;

}

and don't work, this code raise a General error, Why? i don't now, help me please.

Former Member
0 Kudos

Hi Xiaodan,

In b1 application it does make the delivery when i choose copy from with no problems,

I made a new DB and i selected the necessary accounts to make a invoice, my surprise is that it worked there,

Now our problem is that we had already a DB for the client and it doesn't work for this scenary, so we have to make a new DB for them,

Your code is exactly as i have but without the statusline, because the object does it for himself, but i'll try it,

The solution, new DB, bad for us because we need to make a new one, but then again my question is,

Why that happened?? :S

Thank u Xiaodan for the support, if anyone have passed this, please post, i want to know if i have to make a note for this case, if it really is a bug..

Gabriel

Former Member
0 Kudos

Dear

Thank you for your feedback.

If this is a customer DB related issue, i think it's better log a message for it , so dev support can do a investigation of this DB.

no problem, i will let you know if we come across the same issue.

best regards,

xiaodan an

Former Member
0 Kudos

OK, I'll be posting the note to SAP,

Usually takes time to proceed the note, so if anyone has more suggest i'll keep the DB so i can keep testing on it, and start to work with the new DB for the client,

Thank you for your support

a_vandermaas
Explorer
0 Kudos

Hi,

I get the same error when i want to add a delivery note based on a reserve invoice through the DI API.

However when i do a partial delivery copied from the reserve invoice in the SAP Business One client, and do another partial delivery through the DI API on the same reserve invoice, the DI API succeeds without any error. Only when it is the first deliver note based on the reserve invoice though the DI API I get the general error message.

Did you get any info from SAP on this bug/error?

Kind Regards,

Arjan

Former Member
0 Kudos

Dear

The following code is working for me .

Private Sub btnAddInvoice_Click()

Dim oInv As SAPbobsCOM.Documents

Set oInv = oCompany.GetBusinessObject(oInvoices)

oInv.GetByKey (1188)

Dim oDelivery As SAPbobsCOM.Documents

Set oDelivery = oCompany.GetBusinessObject(oDeliveryNotes)

oDelivery.CardCode = oInv.CardCode

oDelivery.Lines.BaseType = SAPbobsCOM.oInvoices

oDelivery.Lines.BaseEntry = 1188

oDelivery.Lines.BaseLine = 0

oDelivery.Lines.Quantity = 1

'oOrd.Lines.SetCurrentLine (1)

oInv.Lines.LineStatus = bost_Close

'oDelivery.Lines.Add

lRetCode = oDelivery.Add

If lRetCode <> 0 Then

oCompany.GetLastError lErrCode, sErrMsg

MsgBox Str(lErrCode) + ":" + sErrMsg

Else

MsgBox oDelivery.Lines.PickListIdNumber

End If

End Sub

Best Regards,

Xiaodan AN

SAP Business One Forum Team

Former Member
0 Kudos

Dear

did you try to base the delivery on that invoice in B1 application? will it be working ?

Best Regards,

xiaodan an