Showing results for 
Search instead for 
Did you mean: 

Postin AR Invoice in Draft Mode

Former Member
0 Kudos

Dear All,

i've facing problem in AR Invoice posting draft mode using technologie is 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();


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.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


Edited by: kannan_mani on May 2, 2009 7:26 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos

Pl post it in

SAP Business One SDK