Dear All,
i've facing problem in AR Invoice posting draft mode using technologie is vb.net with C#
i got the error code is -4002 and message is "To generate this document, first define the numbering series in the Administration module"
this is code i was used here
SAPbobsCOM.Company com = new Company();
//SAPbouiCOM.Application uiap = new SAPbouiCOM.Application();
//connection
com.Server = server_name;
com.CompanyDB = companu_DB;
com.DbUserName = company_user;
com.DbPassword = company_userPWd;
com.UserName = SAP_User;
com.Password = SAP_userPWD;
com.language = BoSuppLangs.ln_English;
com.DbServerType = BoDataServerTypes.dst_MSSQL2005;
com.UseTrusted = false;
long j = com.Connect();
int sd = Convert.ToInt32(j);
string s;
com.GetLastError(out sd, out s);
// posting invoice in draft mode
Documents sapDoc;
sapDoc = (SAPbobsCOM.Documents)com.GetBusinessObject(BoObjectTypes.oDrafts);
//sapDoc = (SAPbobsCOM.Documents)com.GetBusinessObject(BoObjectTypes.oInvoices);
sapDoc.DocObjectCode = BoObjectTypes.oInvoices;
sapDoc.DocType = BoDocumentTypes.dDocument_Items;
sapDoc.CardCode = "C00001";
sapDoc.HandWritten = BoYesNoEnum.tNO;
sapDoc.DocTotal = Convert.ToDouble("264.3");
//sapDoc.Project = "CASS";
//sapDoc.DocNum = 1;
sapDoc.DocDate=Convert.ToDateTime("8/18/2008");
sapDoc.Series = 0;
sapDoc.Lines.ItemCode = "A00001";
sapDoc.Lines.PriceAfterVAT = 2.36;
sapDoc.Lines.Price = 118;
long sj = sapDoc.Add();
int ssd = Convert.ToInt32(sj);
string ss;
com.GetLastError(out ssd, out ss);
com.GetNewObjectCode(out ss);
advance thanks
kannan
Edited by: kannan_mani on May 2, 2009 7:26 AM