I have managed to create an AR Invoice record using the following code:
private SAPbobsCOM.Documents oInvoice;
oInvoice = ( ( SAPbobsCOM.Documents )( oCompany.GetBusinessObject( SAPbobsCOM.BoObjectTypes.oInvoices ) ) );
int lRetCode;
oInvoice.CardCode = "979";
oInvoice.DocDate = DateTime.Parse("18.07.2007");
oInvoice.DocDueDate = DateTime.Parse("18.07.2007");
oInvoice.TaxDate = DateTime.Parse("18.07.2007");
oInvoice.Lines.ItemCode = "12345";
oInvoice.Lines.Quantity = 2;
oInvoice.Lines.Price = 10.00;
lRetCode = oInvoice.Add();
The problem is that I want to give the invoices my own DocNum. I tried doing this by using this code:
oInvoice.Series = -1;
oInvoice.DocNum = 9999;
but it doesn't create any record of the invoice. Can anyone help?